Skip to content

Instantly share code, notes, and snippets.

davidrenne / gist:9646574
Created March 19, 2014 17:18
Greatest Headache Preventer ONLOAD
View gist:9646574
if (window.location.hostname == 'localhost') {
var ids = $('[id="''"]');
if(ids.length>1 && ids[0]==this)
alert('Dev Err: Multiple IDs #';
davidrenne / gist:1cc1b8db2ad0388c47b5
Created December 29, 2014 19:05
Python log Django Queries
View gist:1cc1b8db2ad0388c47b5
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()))
davidrenne / gist:db6896137a31791b3df6
Created February 2, 2015 23:57
Excel formula for wget grep image source
View gist:db6896137a31791b3df6
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;")
View gist:60e07ce7e4e237c6268b
# 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 (
JSON Viewer (
davidrenne / gist:6f04054aeadffea496ee
Last active August 29, 2015 14:16
Git Branch Management for multiple repositories in a project
View gist:6f04054aeadffea496ee
#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
davidrenne / gist:a84937a091c7cf3084a7
Created March 18, 2015 20:27
Setup mandrillapp on ubuntu with postfix
View gist:a84937a091c7cf3084a7
sudo apt-get install mailutils
sudo apt-get install libsasl2-modules
sudo echo "[] YOURUSER:YOURPASSWORD" > /etc/postfix/sasl_passwd
sudo chmod 600 /etc/postfix/sasl_passwd
sudo postmap /etc/postfix/sasl_passwd
sudo vim /etc/postfix/
delete relay host line
View gist:09bd9e775b42a9838033
// Detect CSS mask support and hack it into Modernizr
if ([ '-webkit-mask-box-image' ] !== undefined ) {
Modernizr.cssmasks = true;
} else {
Modernizr.cssmasks = false;
View gist:aae2b2e00bcf115ba3cf

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.

View artoo-imm.js
(function(artoo) {
// Artoo Spider for
var scrape = {
iterator: '#wrapTestoStatiche',
data: {
'id': function() {
var id = artoo.$(this).find('.text-align_left a:last-child').attr('href');
if (id) {
id = id.match(/ImmoNews\-(\d+)\.pdf$/);