Skip to content

Instantly share code, notes, and snippets.

View msadouni's full-sized avatar

Matthieu Sadouni msadouni

View GitHub Profile

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

@msadouni
msadouni / reset.sh
Last active August 29, 2015 14:17
Reset script for the golden-master demo https://github.com/mhcommunication/golden-master
#!/bin/bash
sudo echo "LoadModule php5_module /usr/lib/apache2/modules/libphp5.so" > /tmp/php5.load
sudo ln -nfs /vagrant/templates/default /etc/apache2/sites-available/default
sudo ln -nfs /tmp/php5.load /etc/apache2/mods-enabled/php5.load
sudo service apache2 restart
find /vagrant -type f -name "*.default" | while read file
do
cp $file ${file%.*}
done
@msadouni
msadouni / README.md
Last active August 29, 2015 14:06
Bash Shellshock vulnerability fix (CVE-2014-6271, CVE-2014-7169) for OSX

Copy/paste in Terminal:

bash <(curl -s https://gist.githubusercontent.com/msadouni/5ede20cd671c61f29a5a/raw/0809fbc358420d45071014fcb3b63e08ba09daf0/gistfile1.sh)
@msadouni
msadouni / bonjourgem-suggestions.txt
Created June 11, 2012 07:08
Gems suggestions for BonjourGem.com
rails_admin
bullet
sidekiq
devise-async
display-case
decent_exposure
virtus
wicked
apartment
yell
@msadouni
msadouni / git-branch-backup.sh
Created April 6, 2012 15:11
Backup a Git branch
#!/bin/sh
# Usage: git-branch-backup.sh <remote>
# Originally from jlecour but I can't find his version anymore
if [ -z "$1" ]
then
remote='origin'
else
remote=$1
fi
@msadouni
msadouni / deploy.sh
Created March 9, 2012 15:06
Sync a folder via rsync / ssh
#!/bin/bash
export_to='/path/to/export/without/slash'
login='login'
server='server.com'
root='/path/to/app/without/slash'
rm -rf $export_to
git checkout-index -a --prefix=$export_to/
rsync -avz -e ssh $export_to/ $login@$server:$root --exclude-from 'exclude.rsync'
@msadouni
msadouni / git-export.sh
Created March 9, 2012 15:05
Export a git repository content in a directory
#!/bin/bash
if [ -z "$1" ]
then
echo "usage: git-export <project-name> <branch-name|master>"
exit
fi
site_name=$1
if [ -z "$2" ]
@msadouni
msadouni / pre-commit
Created October 14, 2011 14:29
Git pre-commit hook to compile Compass files to production for a Rails (<= 3.0) app
#!/bin/sh
if git-rev-parse --verify HEAD >/dev/null 2>&1; then
against=HEAD
else
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
compass compile --output-style compressed --force
git add public/stylesheets/*.css
@msadouni
msadouni / pre-commit
Created October 14, 2011 14:05
Git pre-commit hook to compile Compass files to production for a CakePHP app
#!/bin/sh
if git-rev-parse --verify HEAD >/dev/null 2>&1; then
against=HEAD
else
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
compass compile --output-style compressed --force
git add webroot/css/*.css
@msadouni
msadouni / restart-ad.rb
Created April 2, 2010 15:23
Redémarrage d'un pack Alwaysdata
require 'net/https'
require 'rubygems'
require 'nokogiri'
require 'open-uri'
username = 'courriel'
password = 'mot de passe'
pack = 'nom du pack'
urls = ['http://www.monsite.com', 'http://test.monsite.com']