This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function throttle( fn, time ) { | |
var t = 0; | |
return function() { | |
var args = arguments, ctx = this; | |
clearTimeout(t); | |
t = setTimeout( function() { | |
fn.apply( ctx, args ); | |
}, time ); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# https://gist.github.com/gregferrell/747642 | |
if [[ $1 ]]; | |
then | |
php -r " echo var_dump(unserialize('"$1"')); echo \"\\n\";" | |
else | |
STRING=`pbpaste` | |
php -r " echo var_dump(unserialize('"$STRING"')); echo \"\\n\";" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
System Load Indicator - https://launchpad.net/indicator-multiload | |
cp -p /etc/hosts | |
cp -p /etc/apache2/sites-available | |
Chrome | |
Inkscape | |
Composer Global | |
Drush via Composer | |
PhpStorm + Codesniffer & Drupal Coder rules via Composer | |
Insync | |
Tmux |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://jonthegeek.blogspot.be/2009/07/multi-parameter-firefox-keywords-and.html | |
javascript: | |
var s='%s'; | |
url='http://maps.google.com/maps?saddr=%s&daddr=%s'; | |
query=''; | |
urlchunks=url.split('%s'); | |
schunks=s.split(';'); | |
for(i=0; i<schunks.length; i++)query+=urlchunks[i]+schunks[i]; | |
location.replace(query); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://stackoverflow.com/a/2133217/292408 | |
function scrollToTop() { | |
$( "div.scroll" ).scrollTop( -10000 ) | |
} | |
setInterval( scrollToTop, 1000 ); | |
// clearInterval(tid); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// No directories with --follow. | |
git log -M --follow <filename> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Share an additional folder to the guest VM. The first argument is | |
# the path on the host to the actual folder. The second argument is | |
# the path on the guest to mount the folder. And the optional third | |
# argument is a set of non-required options. | |
dev.vm.synced_folder pubstack_config['synced_folder'], '/var/www/html', | |
type: synced_folder_type, | |
mount_options: ['rw', 'vers=3', 'tcp', 'fsc', 'actimeo=1'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Taken from comment by Eli Hellmann @ http://www.meetup.com/AngularJS-NYC/events/221056642 | |
Array.prototype.reduce.call($('#rsvp-list-waitlist li'), function(agg,e,i){return agg || (/Elijah Lynn/i.test($(e).text()) ? i : agg);},null) //:) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Say you have a Repo and you are in a few levels deep. /profiles/publisher/modules/contrib/ | |
// You have a module called ../contrib/embed_external | |
// You want to pull changes you made to it to upstream | |
// pwd ../contrib | |
// git clone embed-external-upstream EE-upstream | |
// cd EE-upstream | |
git -C ../embed_external/ diff --relative 76da308..HEAD . | patch -p1 | |
// http://stackoverflow.com/a/9507417/292408 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
insert: function(content) { | |
content = this.prepareContent(content); | |
if (CKEDITOR.env.webkit || CKEDITOR.env.chrome || CKEDITOR.env.opera || CKEDITOR.env.safari) { | |
// Works around a WebKit bug which removes wrapper elements. | |
// @see https://drupal.org/node/1927968 | |
var tmp = new CKEDITOR.dom.element('div'), children, skip = 0, item; | |
tmp.setHtml(content); | |
children = tmp.getChildren(); | |
skip = 0; | |
while (children.count() > skip) { |