my favorite

2011/07/11

nodejs powered goo.gl

This post is shooting for nodejs-powered Mac users

It's pretty useful if we can shorten URL in command-line, especially we can have a helper to achieve below
1. ease to have/install
2. ease to use

for installation
npm-g install goo.gl

we still need do some modification since goo.gl output key -> value, that say if you do shorten google.com you will see
http://google.com -> http://goo.gl/mR2d

edit /usr/local/bin/goo.gl (check installation path)
change line 135 from
console.log('%s -> %s', val, (res.id || JSON.stringify(res)));
to
console.log('%s', (res.id || JSON.stringify(res)));

added a bash helper in ~/.profile

function gg() {
goo.gl $1 | pbcopy
}

then
source ~/.profile

now you can simply type
gg www.yahoo.com and get shorten url in clipboard

1 comment:

Blogger said...

Did you know that you can create short urls with AdFly and get $$$$$ from every click on your short links.

BIO

Taipei, GuTing, Taiwan

huang47 | personal

huang47 | personal