Skip to content

Instantly share code, notes, and snippets.

View GavinJoyce's full-sized avatar

Gavin Joyce GavinJoyce

View GitHub Profile
@GavinJoyce
GavinJoyce / webdis
Created May 28, 2012 14:30 — forked from xiangjian/redis-server
redis & webdis init script for ubuntu
#! /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
#! /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 November 27, 2012 10:51
My most used heroku and 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'
@GavinJoyce
GavinJoyce / singleton.js
Created August 27, 2013 14:31
Ember Singleton
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 September 1, 2013 11:06
Run Loop Metrics Bookmarklet
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;
@GavinJoyce
GavinJoyce / pr.md
Created October 5, 2013 08:29 — forked from piscisaureus/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 = [email protected]: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:

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
* @version 1.7.0-beta.1+canary.6555b15a
@GavinJoyce
GavinJoyce / gist:54c03bd4048a8f64742e
Last active August 29, 2015 14:05
Simple spike of an incremental backoff for Ember.js
// **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 August 29, 2015 14:14
Ember listener debugging
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 February 15, 2020 08:12
jQuery event leak detection
var walk_the_DOM = function walk(node, func) {
func(node);
node = node.firstChild;
while (node) {
walk(node, func);
node = node.nextSibling;
}
};
var totalSubscriptionCount = 0;