View gist:10968151
package experiments;
import static javax.media.opengl.GL.GL_COLOR_BUFFER_BIT;
import static javax.media.opengl.GL.GL_DEPTH_BUFFER_BIT;
import java.awt.BorderLayout;
import java.awt.Container;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
View URLShorten
function addLink(msg, from, to){
var url = msg;
googleapis.discover('urlshortener', 'v1').execute(function(err, client){
client.urlshortener.newRequest('urlshortener.url.insert', { resource: {longUrl: url}}).execute(function(err, result){
var shortUrl = 'Cannot shorten '+url;
if(err){
console.log('Shortening error: ',err);
} else {
shortUrl = result.id;
}