Skip to content

Instantly share code, notes, and snippets.

Share this. If I had the below HTML in my DOM:

<a class="st_sharethis_custom button share-track tiny radius secondary share player-share">Share</a>

and it already gets bound, I cannot easily dynamically set the st_url unless I completely delete this from the DOM. So the below code is the only way I could figure out how to dynamically change URLs in the same button. I tried to unset st_processed. And also had issues using jquery's prop function. It seems somehow you guys will only pick up when the function attr() is called.

This is very frustrating of a work around to try to dynamically create a button! Please make developer experience better by producing some kind of article to swap out url's on the fly.

// Detect CSS mask support and hack it into Modernizr
if ( document.body.style[ '-webkit-mask-box-image' ] !== undefined ) {
Modernizr.cssmasks = true;
$('html').addClass('cssmasks');
} else {
Modernizr.cssmasks = false;
$('html').addClass('no-cssmasks');
}
@davidrenne
davidrenne / gist:a84937a091c7cf3084a7
Created March 18, 2015 20:27
Setup mandrillapp on ubuntu with postfix
sudo apt-get install mailutils
sudo apt-get install libsasl2-modules
sudo echo "[smtp.mandrillapp.com] YOURUSER:YOURPASSWORD" > /etc/postfix/sasl_passwd
sudo chmod 600 /etc/postfix/sasl_passwd
sudo postmap /etc/postfix/sasl_passwd
sudo vim /etc/postfix/main.cf
delete relay host line
@davidrenne
davidrenne / gist:6f04054aeadffea496ee
Last active August 29, 2015 14:16
Git Branch Management for multiple repositories in a project
#Repeat these scripts if you want to do branch management across similar repos in the same project obviously change your path /usr/local/repository & /usr/local/repository2 and copy more as needed
alias switch_branch='echo -n "Git branch name?>" && read response && cd /usr/local/repository && git fetch origin && git checkout $response && cd /usr/local/repository2 && git fetch origin && git checkout $response'
alias create_branch='echo -n "Git branch name?>" && read response && cd /usr/local/repository/ && git branch $response && git push origin $response && git checkout $response && cd /usr/local/repository2/ && git branch $response && git push origin $response && git checkout $response'
alias delete_branch='echo -n "Git branch name?>" && read response && cd /usr/local/repository/ && git checkout $response && git checkout master && git branch -d $response && git push origin :$response && cd /usr/local/repository2/ && git checkout $response && git checkout master && git branch -d $response && git push origi
#-*-coding:utf-8-*-
# This script requires an existing SQLite DB for output from Facebook Graph API, it should be stored in the same folder of this script if you do not specify the path to DB
"""
Facebook Graph API Explorer (http://developers.facebook.com/tools/explorer)
GO HERE FOR DEFINITIONS OF VARIABLES RETURNED BY API:
https://developers.facebook.com/docs/reference/api/post/
JSON Viewer (http://jsonviewer.stack.hu/)
@davidrenne
davidrenne / gist:db6896137a31791b3df6
Created February 2, 2015 23:57
Excel formula for wget grep image source
IF column A is an ID, and column C is a URL. Request the URL and get the single image on the page. Then create a new CSV off of this with the source of the image
=CONCATENATE("random_shit=`tr -cd '[:alnum:]' < /dev/urandom | fold -w30 | head -n1`;wget -O /tmp/html$random_shit ",C2655,"; grep '<img' /tmp/html$random_shit | grep -v 'beach-logo' | grep -oP 'src=""([^""]*)' | cut -b 6- > /tmp/html_$random_shit; value=`cat /tmp/html_$random_shit`; echo """,A2655,",$value"" >> /tmp/all; rm /tmp/html_$random_shit; rm /tmp/html$random_shit;")
@davidrenne
davidrenne / gist:1cc1b8db2ad0388c47b5
Created December 29, 2014 19:05
Python log Django Queries
from django.db import connection
for query in connection.queries :
print "\033[1;31m[%s]\033[0m \033[1m%s\033[0m" % (query['time'],
" ".join(query['sql'].split()))
git config --global user.email "davidrenne@gmail.com"
git config --global user.name "David Renne"
git config --global core.editor "vim"
git config --global core.fileMode false
git config --global push.default current
git config --global alias.up 'pull --rebase --autostash'
git config --global alias.cp 'cherry-pick'
git config --global alias.s 'status'
git config --global alias.co 'checkout'
git config --global alias.c 'commit -a'
@davidrenne
davidrenne / gist:9646574
Created March 19, 2014 17:18
Greatest Headache Preventer ONLOAD
if (window.location.hostname == 'localhost') {
$('[id]').each(function(){
var ids = $('[id="'+this.id+'"]');
if(ids.length>1 && ids[0]==this)
alert('Dev Err: Multiple IDs #'+this.id);
});
}
@davidrenne
davidrenne / gist:7468636
Created November 14, 2013 15:21
VMWARE Port forwarding instructions
Testing with Internet Explorer / NAT Port Forwarding
It is possible to connect to the rails server inside the linux virtual machine from the host computer.
This allows testing the development site with Internet Explorer.
Note: This assumes the CentOS vm is running in NAT networking mode.
1) Find out what ip address the vm is using. Open a terminal in the vm and run /sbin/ifconfig
For this example the eth0 inet addr is 192.168.179.128.
2) Open System > Administration > Security Level and Firewall. (Enter the root password if necessary.)
3) On the "Firewall Options" tab, open the "Other ports" section and add ports 3000 and 8080.
4) Click ok and confirm the changes.
2) On the windows host, open C:\ProgramData\VMware\vmnetnat.conf with a text editor.