Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am nathanhammond on github.
  • I am nathanhammond (https://keybase.io/nathanhammond) on keybase.
  • I have a public key whose fingerprint is DD11 31B1 AF9A 0A66 EC41 CBFF F147 E765 0A00 8BAB

To claim this, I am signing this object:

@nathanhammond
nathanhammond / OutletFocusing.md
Last active August 29, 2015 14:23
Ember Outlet Focusing
@nathanhammond
nathanhammond / components.my-component.js
Created August 20, 2015 23:00
Positional Parameters
import Ember from 'ember';
export default Ember.Component.extend({
positionalParams: ['one','two']
});
@nathanhammond
nathanhammond / jquery.ancestry.js
Created August 13, 2008 15:18
Functionality to add a filter for descendants and ancestors of a jQuery set.
/*
Ancestry - jquery.ancestry.js
As discussed in the jQuery Development Google Group.
Released under the MIT license.
Involved: Michael Geary, Diego Perini, John-David Dalton, John Resig, and Nathan Hammond
Compiled: Nathan Hammond
*/
jQuery.comparePosition = function ( element, context) {
@nathanhammond
nathanhammond / jquery.subsection.js
Created August 13, 2008 15:27
Extension to jQuery to imitate the Form.elements array for any arbitrary descendant of a form.
/*
Serialize Subsection - jquery.subsection.js
Copyright (c) 2008 Nathan Hammond
Released under the MIT license.
With thanks to Michael Geary, Diego Perini, John-David Dalton, John Resig, and Garrett Smith for vetting elements of this idea.
Requires jQuery revision 5826 or later with the change to jQuery.fn.serializeArray() to query this.elements.
Requires Ancestry plugin.
*/
@nathanhammond
nathanhammond / jquery.textchange.js
Created August 27, 2010 15:38 — forked from mkelly12/jquery.textchange.js
Properly setup the event to account for initial content at the time of the first event binding. Reduce the delay to make it fire as quickly as possible. Remove two unused special events. Formatting.
/*!
* jQuery TextChange Plugin
* http://www.zurb.com/playground/jquery-text-change-custom-event
*
* Copyright 2010, ZURB
* Released under the MIT License
*/
(function ($) {
$.event.special.textchange = {
setup: function (data, namespaces) {
@nathanhammond
nathanhammond / wsbenchtest.js
Created October 26, 2010 20:33
Test case for interesting connection limit bug.
/*
To run test...
1. Get wsbench. Update the shebang in wsbench/wsbench if necessary.
> git clone git://github.com/pgriess/wsbench.git
> cd wsbench
2. Add in our test case by saving this file (wsbenchtest.js) into the wsbench directory.
3. Start the socket.io chat example.
@nathanhammond
nathanhammond / node_redis_commands.js
Created March 7, 2011 21:57
Simple script to get all Redis commands in a format that mranney/node_redis can use.
var http = require('http');
var fs = require('fs');
var redisio = http.createClient(80, 'redis.io');
function getCommands() {
var commandrequest = redisio.request('GET', '/commands.json', {'Host': 'redis.io'});
commandrequest.end();
var commandsfile = fs.createWriteStream('commands.json');
commandrequest.on('response', function (response) {
@nathanhammond
nathanhammond / $loader.js
Created April 7, 2011 22:13
$loader (pronounced "money-loader") is a simple script for using either the embedded version of jQuery or loading your own copy but saving a reference in your own scope. The primary use-case for this is in development of code that will be embedded into ot
// Load jQuery.
var $loader = function(callback) {
this.callback = callback;
this.check$();
}
$loader.prototype = {
// Check to see if we have our own copy of jQuery.
check$: function(version) {
// Load event version.
// TODO: Limit to our earliest supported version of jQuery.
@nathanhammond
nathanhammond / testcase.html
Created December 14, 2011 21:26
Simplified testcase for Ember bug.
<!doctype html>
<html lang="en">
<head>
<title>Ember Bug</title>
<script type="text/x-handlebars" data-template-name="president">
The President of the United States is {{name}}.
</script>
</head>
<body>
<script src="http://code.jquery.com/jquery-1.7.1.js"></script>