Skip to content

Instantly share code, notes, and snippets.

View ElijahLynn's full-sized avatar
😎
All Your DevOps Belong To Us

Elijah Lynn ElijahLynn

😎
All Your DevOps Belong To Us
View GitHub Profile
function throttle( fn, time ) {
var t = 0;
return function() {
var args = arguments, ctx = this;
clearTimeout(t);
t = setTimeout( function() {
fn.apply( ctx, args );
}, time );
};
#!/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
@ElijahLynn
ElijahLynn / ubuntu-14.04-setup
Last active August 29, 2015 14:04
Stuff I do to a new install of Ubuntu 14.04
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
@ElijahLynn
ElijahLynn / cs-gmaps-directions
Created October 16, 2014 19:04
Google Maps Directions Chrome Search Engine
// 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);
@ElijahLynn
ElijahLynn / gist:1506df053c2677f08301
Last active August 29, 2015 14:11
Scroll up for history on IRCCloud
// http://stackoverflow.com/a/2133217/292408
function scrollToTop() {
$( "div.scroll" ).scrollTop( -10000 )
}
setInterval( scrollToTop, 1000 );
// clearInterval(tid);
// No directories with --follow.
git log -M --follow <filename>
# 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']
@ElijahLynn
ElijahLynn / meetupWaitlistNumber
Created March 10, 2015 18:11
meetupWaitlistNumber
// 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) //:)
@ElijahLynn
ElijahLynn / gist:a848ae3214aba1f22745
Last active February 16, 2021 02:17
Cherry pick range commits from another repo
// 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
@ElijahLynn
ElijahLynn / ckeditor-3.0.js
Last active August 29, 2015 14:18
Line 15-22
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) {