Skip to content

Instantly share code, notes, and snippets.

View msadouni's full-sized avatar

Matthieu Sadouni msadouni

View GitHub Profile
@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 / 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-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 / 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 / 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 / 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

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