Skip to content

Instantly share code, notes, and snippets.

@johnkpaul
johnkpaul / gist:5125031
Created March 9, 2013 17:53
IRC can be touching
12:49 guesswho: oh shit
12:49 guesswho: it's there
12:49 guesswho: lol
12:49 guesswho: wow
12:50 johnkpaul: guesswho: it's working?
12:50 guesswho: yeah that's total insanity
12:50 johnkpaul: awesome, congratulations
12:50 pbor has left IRC (Ping timeout: 260 seconds)
12:50 guesswho: so simple but so long for me to do :(
12:50 tallest_red has left IRC (Ping timeout: 256 seconds)
@johnkpaul
johnkpaul / gist:4625005
Created January 24, 2013 16:53
something is up with www.qunitjs.com
➜ /tmp wget http://www.jquery.com
--2013-01-24 11:50:09-- http://www.jquery.com/
Resolving www.jquery.com... 70.32.120.34
Connecting to www.jquery.com|70.32.120.34|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://jquery.com/ [following]
--2013-01-24 11:50:09-- http://jquery.com/
Resolving jquery.com... 70.32.120.34
Reusing existing connection to www.jquery.com:80.
HTTP request sent, awaiting response... 200 OK
@johnkpaul
johnkpaul / answer.js
Created September 21, 2012 21:57
fbAsyncInit using $.Deferred
window.fbAsyncInit = function(){
window.fbAsyncInit.fbLoaded.resolve();
}
window.fbAsyncInit.fbLoaded = $.Deferred();
#on branch with your commit that you need to split up
git checkout -b new_branch_name
git log -n1
#now record the sha hash of the last commit, lets call it SHA
#make sure you're on a new branch and you have no working directory changes
#this next command will wipe out everything and reset you to the previous commit
git reset --hard HEAD^
git cherry-pick SHA --no-commit
git add /filename/you/_want_/to/pull/request
git commit
@johnkpaul
johnkpaul / app.js
Created August 4, 2012 18:45
IE9- and Backbone.history's pushState
//in your application, rather than using window.location to get the current url
App.getLocation = function(){
return window.location.protocol + '//' + window.location.host
+ '/' + Backbone.history.options.root + Backbone.history.getFragment()
}
Backbone.history.start({ pushState: Modernizr.history, silent: true });
if( !Modernizr.history ) {
var rootLength = Backbone.history.options.root.length;
var fragment = window.location.pathname.substr(rootLength);
Backbone.history.navigate(fragment, {trigger: true});
} else {
Backbone.history.loadUrl(Backbone.history.getFragment())
}
Backbone.history.start({ pushState: Modernizr.history });
@johnkpaul
johnkpaul / jsfiddle.changedefault.user.js
Created April 13, 2012 17:14
Change the default Javascript library on jsFiddle to jQuery
// ==UserScript==
// @match http://jsfiddle.net/*
// ==/UserScript==
// @author: John K. Paul @johnkpaul
// @license: http://www.opensource.org/licenses/MIT
// http://johnkpaul.tumblr.com/post/21030300518/changing-jsfiddles-default-library-to-jquery
(function(){
var script = document.createElement('script');
@johnkpaul
johnkpaul / gist:2361303
Created April 11, 2012 18:44
gruntjs Mocha task
/*
* grunt
* https://github.com/cowboy/grunt
*
* Copyright (c) 2012 "Cowboy" Ben Alman
* Copyright (c) 2012 John K. Paul @johnkpaul
* Licensed under the MIT license.
* http://benalman.com/about/license/
*/
Vagrant::Config.run do |config|
config.vm.box = "base"
config.vm.network(:hostonly, "33.33.33.10")
config.vm.network(:bridged)
config.vm.forward_port(80, 4567)
en