Skip to content

Instantly share code, notes, and snippets.

@stephanschubert
stephanschubert / share_counts.md
Last active October 10, 2017 19:58 — forked from jonathanmoore/gist:2640302
How to retrieve the share counts for an URL from various social media platforms.

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

#!/bin/bash
# This script creates a custom ruby definition for rbenv
# which incorporates the rvm patches from skaes.
#
# (c) [email protected]
#
rubyexpress_repo="https://github.com/skaes/rvm-patchsets.git"
rubybuild_repo="https://github.com/sstephenson/ruby-build.git"
mkdir rbenv-railsexpress
require "net/http"
def start_server
# Remove the X to enable the parameters for tuning.
# These are the default values as of Ruby 2.2.0.
@child = spawn(<<-EOC.split.join(" "))
XRUBY_GC_HEAP_FREE_SLOTS=4096
XRUBY_GC_HEAP_INIT_SLOTS=10000
XRUBY_GC_HEAP_GROWTH_FACTOR=1.8
XRUBY_GC_HEAP_GROWTH_MAX_SLOTS=0
#!/bin/bash
# git-cleanup-repo
#
# Author: Rob Miller <[email protected]>
# Adapted from the original by Yorick Sijsling
#
# * 2015/11/05 - Fixed formatting issues (Stephan Schubert)
KEEP_BRANCHES='(master|staging|ci-[0-9]+)$'
@stephanschubert
stephanschubert / endpoints.md
Created May 20, 2016 06:57 — forked from derhuerst/_.md
List of HAFAS API Endpoints
@stephanschubert
stephanschubert / PinchZoomPan.js
Created December 1, 2016 15:52 — forked from iammerrick/PinchZoomPan.js
React Pinch + Zoom + Pan
import React from 'react';
const MIN_SCALE = 1;
const MAX_SCALE = 4;
const SETTLE_RANGE = 0.001;
const ADDITIONAL_LIMIT = 0.2;
const DOUBLE_TAP_THRESHOLD = 300;
const ANIMATION_SPEED = 0.04;
const RESET_ANIMATION_SPEED = 0.08;
const INITIAL_X = 0;
@stephanschubert
stephanschubert / Instructions.md
Created January 4, 2019 09:56 — forked from pgilad/Instructions.md
Generate SSL Certificate for use with Webpack Dev Server (OSX)

Generate private key

$ openssl genrsa -out private.key 4096

Generate a Certificate Signing Request

openssl req -new -sha256 \
@stephanschubert
stephanschubert / hyperjs.md
Created November 13, 2020 19:23 — forked from raftheunis87/hyperjs.md
Hyper.js + Hyper.js Plugins + ZSH + Starship + Fira Code + Dark Theme - (macOS)

Hyper.js