Skip to content

Instantly share code, notes, and snippets.

@jonathanmoore
jonathanmoore / gist:2640302
Created May 8, 2012 23:17
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

@magnusdahlstrand
magnusdahlstrand / Documents folder layout
Created October 26, 2012 12:10
Docpad - setup for multiple languages
/src
/documents
/articles
/gallery
/de
/articles
/gallery
/es
/articles
/gallery
@drart
drart / index.js
Last active March 13, 2024 05:30
MIDI to OSC bridge using Node.js
var midi = require('midi');
var input = new midi.input();
console.log(input.getPortCount());
console.log(input.getPortName(1));
//
input.openPort(0);
input.ignoreTypes(false, false, false);
//
input.on('message', function(deltaTime, message) {
midiMessageReceived(message);
@petervangrieken
petervangrieken / loadCSS
Created March 2, 2015 09:05
Asynchronous font loading
<script defer type="text/javascript">
function loadCSS( href, media ){
link = document.createElement( "link" );
link.href = href;
link.type = "text/css";
link.rel = "stylesheet";
link.media = "only x";
document.getElementsByTagName( "head" )[0].appendChild( link );
@borestad
borestad / elcapitan-bootable-usb.sh
Last active January 13, 2016 06:22
Bootable USB Drive for OS X El Capitan
###
# This script assumes 2 things
# 1. One have already downloaded the El Capitan ( /Applications/Install OSX El Capitan.app) installer through Appstore or at leaast put "Install OSX El Capitan.app" into the /Apps folder
# 2. A fresh 8 GB+ USB Memory is inserted and have the name "Untitled"
#
# Installation instructions:
# 1. Insert a USB stick into your computer (it will be totally erased - make sure you backup your important files on that USB)
# 2. Open up a terminal (Terminal.app, iTerm etc)
# 3. Fire up Disk utilities
# - I.e `open /Applications/Utilities/Disk\ Utility.app`
@bendc
bendc / svgo.json
Created August 30, 2016 07:05
Sketch's SVGO Compressor settings
{
"comment": "This is the settings file for the SVGO Compressor Plugin. For more info, please check <https://github.com/BohemianCoding/svgo-compressor>",
"pretty": false,
"indent": 2,
"plugins": [
{
"name": "cleanupAttrs"
},
{
"name": "cleanupEnableBackground"
@twilight-sparkle-irl
twilight-sparkle-irl / webcrack.js
Last active September 19, 2024 14:29
webcrack: mess with webpacked (webpackJsonp) applications
// webcrack, a script that allows you to break webpack.js's sandbox and randomization easily
// made by @yourcompanionAI
// licensed under the trust that you will credit me for my work visibly and other than that you can go have fun with this
// window.wc is the webcrack object
// wc.get gives you the module attached to the id you give it.
// literally just what webpack functions use. not much to it
// this is the basic part of all this, everything else is just to allow you to updateproof your code
// both find functions return modules in this format:
@una
una / text.md
Last active April 12, 2022 03:29
Cleanup Branches
  1. Go to the remote repo and delete outdated branches

  2. Then either:

    • Locally cleanup only merged branches: git branch --merged | grep -v "\*" | xargs -n 1 git branch -d
  • Locally remove fetched, outdated branches: git for-each-ref --format='%(refname:short) %(upstream)' refs/heads/ | awk '$2 !~/^refs\/remotes/' | xargs git branch -D
@IanColdwater
IanColdwater / twittermute.txt
Last active November 17, 2024 02:37
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@victorlin
victorlin / github-delete-stale-branches.js
Last active March 20, 2024 02:27
Delete stale branches from the GitHub repo's stale branches page (github.com/user/repo/branches/stale). Originally from https://stackoverflow.com/a/69089905
// Paste in browser console and run
async function deleteStaleBranches(delay=500) {
var stale_branches = document.getElementsByClassName('js-branch-delete-button');
for (var i = 0; i < stale_branches.length; i++)
{
stale_branches.item(i).click();
await new Promise(r => setTimeout(r, delay));
}
}