Skip to content

Instantly share code, notes, and snippets.

Avatar

Gavin Joyce GavinJoyce

View GitHub Profile
@GavinJoyce
GavinJoyce / webdis
Created May 28, 2012 — forked from xiangjian/redis-server
redis & webdis init script for ubuntu
View webdis
#! /bin/sh
### BEGIN INIT INFO
# Provides: webdis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: webdis-server - Persistent key-value db
View redis-server
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog $remote_fs
# Required-Stop: $syslog $remote_fs
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
@GavinJoyce
GavinJoyce / Heroku git Commands
Created Nov 27, 2012
My most used heroku and git commands
View Heroku git Commands
heroku apps:create [appname]
heroku open
heroku config
heroku run rake [task]
heroku keys
heroku logs
g='git'
gst='git status'
gl='git pull'
View singleton.js
App.Singleton = Em.Mixin.create({
instance: function() {
if(!this._instance) {
this._instance = this.createInstance();
}
return this._instance;
},
//override this in your class
@GavinJoyce
GavinJoyce / gist:6403776
Created Sep 1, 2013
Run Loop Metrics Bookmarklet
View gist:6403776
javascript:(function(){
var getTimestamp = function() { return new Date().getTime(); };
if (window.performance.now) {
getTimestamp = function() { return window.performance.now(); };
} else if (window.performance.webkitNow) {
getTimestamp = function() { return window.performance.webkitNow(); };
}
var startTime, endTime, loopCount = 0;
View pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

View ember.js
This file has been truncated, but you can view the full file.
alert(1);
/*!
* @overview Ember - JavaScript Application Framework
* @copyright Copyright 2011-2014 Tilde Inc. and contributors
* Portions Copyright 2006-2011 Strobe Inc.
* Portions Copyright 2008-2011 Apple Inc. All rights reserved.
* @license Licensed under MIT license
* See https://raw.github.com/emberjs/ember.js/master/LICENSE
@GavinJoyce
GavinJoyce / gist:54c03bd4048a8f64742e
Last active Aug 29, 2015
Simple spike of an incremental backoff for Ember.js
View gist:54c03bd4048a8f64742e
// **EDIT**: I've created an ember-cli addon for this here:
//
// https://github.com/GavinJoyce/ember-backoff
var delay = function(milliseconds) {
milliseconds = milliseconds || 2000;
return new Em.RSVP.Promise(function(resolve) {
Em.run.later(this, function() {
@GavinJoyce
GavinJoyce / gist:0caa08b3cea7af044cf8
Last active Aug 29, 2015
Ember listener debugging
View gist:0caa08b3cea7af044cf8
if (!String.prototype.startsWith) {
Object.defineProperty(String.prototype, 'startsWith', {
enumerable: false,
configurable: false,
writable: false,
value: function(searchString, position) {
position = position || 0;
return this.lastIndexOf(searchString, position) === position;
}
});
@GavinJoyce
GavinJoyce / gist:4004b6ad7dda427e629f
Last active Feb 15, 2020
jQuery event leak detection
View gist:4004b6ad7dda427e629f
var walk_the_DOM = function walk(node, func) {
func(node);
node = node.firstChild;
while (node) {
walk(node, func);
node = node.nextSibling;
}
};
var totalSubscriptionCount = 0;