Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
# one way (older scala version will be installed)
# sudo apt-get install scala
#2nd way
sudo apt-get remove scala-library scala
wget http://www.scala-lang.org/files/archive/scala-2.11.4.deb
sudo dpkg -i scala-2.11.4.deb
sudo apt-get update

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@sasajib
sasajib / app.js
Last active August 29, 2015 14:24 — forked from dbainbridge/app.js
Express and socket io connection
/**
* Module dependencies.
*/
var express = require('express')
, routes = require('./routes')
, http = require('http');
var app = express();
var server = app.listen(3000);
@sasajib
sasajib / angularjs-providers-explained.md
Last active September 2, 2015 02:35 — forked from demisx/angularjs-providers-explained.md
AngularJS Providers: Constant/Value/Service/Factory/Decorator/Provider
Provider Singleton Instantiable Configurable
Constant Yes No No
Value Yes No No
Service Yes No No
Factory Yes Yes No
Decorator Yes No? No
Provider Yes Yes Yes

Constant

@sasajib
sasajib / gist:3447fd5ba5ebfa9a6517
Created September 22, 2015 23:58 — forked from jiggneshhgohel/gist:ade2c57d03c4ad895e82
Adobe Air 2.6 Installation Steps on Ubuntu 14.04 (64-bit)
# coding=UTF-8
from __future__ import division
import re
# This is a naive text summarization algorithm
# Created by Shlomi Babluki
# April, 2013
class SummaryTool(object):
@sasajib
sasajib / Application.java
Created March 3, 2016 12:48 — forked from nraychaudhuri/Application.java
Using custom multipart body parser that uses specified dir to save files
package controllers;
import java.io.File;
import java.util.List;
import play.mvc.BodyParser;
import play.mvc.BodyParser.Of;
import play.mvc.Controller;
import play.mvc.Http.MultipartFormData;
import play.mvc.Http.MultipartFormData.FilePart;
@sasajib
sasajib / uri.js
Created March 29, 2016 12:11 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@sasajib
sasajib / JavaFXTrayIconSample.java
Created June 21, 2016 08:13 — forked from jewelsea/JavaFXTrayIconSample.java
Demonstrate using the System Tray (AWT) to control a JavaFX application.
import javafx.application.*;
import javafx.geometry.Pos;
import javafx.scene.*;
import javafx.scene.control.Label;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;
import javafx.stage.*;
import javax.imageio.ImageIO;
import java.io.IOException;
@sasajib
sasajib / Firebug.java
Created June 27, 2016 05:20 — forked from Splaktar/Firebug.java
Enable Firebug Lite in a JavaFX WebView.
if (isDebugging())
engine.documentProperty().addListener(new ChangeListener<Document>() {
@Override
public void changed(ObservableValue<? extends Document> prop,
Document oldDoc, Document newDoc) {
enableFirebug(engine);
}
});
/**