Skip to content

Instantly share code, notes, and snippets.

@Khady
Khady / gist:a70c3892e89dbc8d82d4881ac3f550de
Created May 31, 2017 09:23 — forked from jonathanmoore/gist:2640302
Get the share counts from various APIs

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

@Khady
Khady / tests_hammer.bash
Last active August 29, 2015 14:01
Fix the usage
#! /usr/bin/env bash
## tests_hammer.bash for onitu
## by lenormf
##
function log {
echo "$@" 1>&2
}
function fatal {

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

module Random = struct
let m = Array.create 17 0
let i = ref 4
let j = ref 16
let mdig = 32
let m1 = (1 lsl (mdig - 2)) + (1 lsl (mdig - 2)) - 1
let m2 = 1 lsl (mdig / 2)
let dm1 = 1.0 /. (2. ** float(mdig-1) -. 1.)
let nextDouble() =