Skip to content

Instantly share code, notes, and snippets.

@jsbalsera
jsbalsera / gitcheats.txt
Created February 7, 2020 14:24 — forked from chrismccoy/gitcheats.txt
git cheats
# shortform git commands
alias g='git'
# scan repo for dangerous Amazon Web Service IDs
git ls-tree --full-tree -r --name-only HEAD | xargs egrep -w '[A-Z0-9]{20}'
# remove .DS_Store from the repository
find . -name .DS_Store -exec git rm --ignore-unmatch --cached {} +
# push current branch
@jsbalsera
jsbalsera / gist:85245ab3a89fa2f74096b4325e05db6b
Created June 7, 2016 10:29 — 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

@jsbalsera
jsbalsera / drushrc.php
Created May 14, 2015 09:37
Force drush language
<?php
$options['variables']['language_default']->language = 'en';
@jsbalsera
jsbalsera / bash.rc
Created May 22, 2014 20:10
Configuring PS1 to show git branch and status
export GIT_PS1_SHOWDIRTYSTATE=true
export GIT_PS1_SHOWUNTRACKEDFILES=true
export GIT_PS1_SHOWSTASHSTATE=true
export PS1='\[\033[1;34m\]\u\[\033[0;30m\]@\[\033[0;32m\]\w\[\033[0;30m\]$(__git_ps1 " [\[\e[31;1m\]%s\[\e[0m\]]")\$ '