Skip to content

Instantly share code, notes, and snippets.

View gist:5600446
IAB_CATEGORIES = {
"IAB1":"Arts & Entertainment",
"IAB1-1":"Books & Literature",
"IAB1-2":"Celebrity Fan/Gossip",
"IAB1-3":"Fine Art",
"IAB1-4":"Humor",
"IAB1-5":"Movies",
"IAB1-6":"Music",
"IAB1-7":"Television",
"IAB2":"Automotive",
View Prune all local branches without remote a branch
git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d
@sshadmand
sshadmand / bash_profile
Last active Aug 29, 2015
Mac Terminal Setup (Alias, ssh, prompt)
View bash_profile
alias ll="ls -allh"
alias bb="git branch"
alias bba="git branch -a"
alias master="git checkout master"
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa_git
ssh-add ~/.ssh/id_rsa_sharethis
#custom terminal prompt
View Travel Embeds
<div id='travellerspoint-map722594_701273' style="width:225px;display:inline-block;"><script src='http://www.travellerspoint.com/badges/badge_membermap.cfm?user=sshadmand&tripid=701273&amp;badgeid=travellerspoint-map722594_701273&amp;height=150&amp;width=225'></script><p class='travellerspoint-map-link'><a href='http://www.travellerspoint.com/member_map.cfm?user=sshadmand&tripid=701273'>South East Asia Part 1</a></p></div>
<div id='travellerspoint-map722594_701275' style="width:225px;display:inline-block;"><script src='http://www.travellerspoint.com/badges/badge_membermap.cfm?user=sshadmand&tripid=701275&amp;badgeid=travellerspoint-map722594_701275&amp;height=150&amp;width=225'></script><p class='travellerspoint-map-link'><a href='http://www.travellerspoint.com/member_map.cfm?user=sshadmand&tripid=701275'>Central/South America</a></p></div>
<div id='travellerspoint-map722594_701277' style="width:225px;display:inline-block;"><script src='http://www.travellerspoint.com/badges/badge_membermap.cfm?user=sshadman
@sshadmand
sshadmand / If Greater Than ... Else ...
Last active Aug 29, 2015
Handlebars Helpers: If Greater Than ... Else ...
View If Greater Than ... Else ...
Handlebars.registerHelper('ifgt', function(val1, val2, options) {
console.log(val1, val2)
if (val1 > val2){
return options.fn(this);
}
return options.inverse(this);
});
@sshadmand
sshadmand / Truncate Words
Created Dec 16, 2014
Handlebar Helpers: Truncate Words
View Truncate Words
Handlebars.registerHelper('truncwords', function(text, length) {
words = text.split(" ");
new_text = text;
if (words.length > length){
new_text = "";
for (var i = 0; i <= length; i++) {
new_text += words[i] + " ";
}
new_text = new_text.trim() + "..."
}
View Bubble icons
<style>
.bubbles-cont {
z-index: 0;
right: 300px;
position: absolute;
}
.bubbles-cont-2 {
z-index: 0;
left: 0px;
margin-bottom: -30px;
@sshadmand
sshadmand / build.sh
Created Dec 25, 2014
Check git diff before deploying
View build.sh
commit(){
echo "Please enter a commit message..."
read msg
git add . --all
git commit -am $msg
}
check_commit(){
echo ========== CHECKING FOR CHANGES ========
changes=$(git diff)
@sshadmand
sshadmand / FB JS Auth
Last active Aug 19, 2021
Facebook JS Auth for Chrome iOS workaround
View FB JS Auth
var ABSOLUTE_URI = "http://yourpage.com/openerhandler.html";
var FB_ID = "123456778";
function openFBLoginDialogManually(){
// Open your auth window containing FB auth page
// with forward URL to your Opened Window handler page (below)
var redirect_uri = "&redirect_uri=" + ABSOLUTE_URI + "fbjscomplete";
var scope = "&scope=public_profile,email,user_friends";
var url = "https://www.facebook.com/dialog/oauth?client_id=" + FB_ID + redirect_uri + scope;
@sshadmand
sshadmand / Jquery Handlebars Extension
Last active Aug 29, 2015
Jquery Handlebars Rendering Extension
View Jquery Handlebars Extension
/*
* Requires Jquery and Handlebars
* Render a template by passing in data and prepend or replace a container in your DOM.
* return DOM object so you can chain subsequent actions.
* Example:
* $("#main-stage").renderTemplate("template-id", dataDict);
* OR
* $("#main-stage").renderTemplate("template-id", dataDict).fadeIn("fast");
*/
jQuery.fn.extend({