Skip to content

Instantly share code, notes, and snippets.

@nathanhammond
nathanhammond / Emscripten OS X.md
Created March 4, 2012 21:48
How to get Emscripten running on OS X.

Running emscripten on OS X

There are a number of additional dependencies required for getting things installed on OS X. Starting with a blank slate OS X machine, this is the process it takes:

# Install Xcode Command Line Tools

# Install Homebrew
ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
@nathanhammond
nathanhammond / index.html
Created March 10, 2012 04:36
D3 "Magnets"
<!DOCTYPE html>
<html>
<head>
<title>Force-Directed Layout (Dynamic)</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.min.js"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.geom.min.js"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.min.js"></script>
<style type="text/css">
html, body {
@nathanhammond
nathanhammond / qunit-fizzbuzz.html
Created March 15, 2013 16:06
Simple qunit for sharing.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>QUnit FizzBuzz</title>
<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-1.11.0.css">
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
@nathanhammond
nathanhammond / Assetfile
Last active December 20, 2015 23:29
Comparison of an Assetfile that *does* work and a Rakefile invocation of the "same" thing that doesn't work.
output "js"
puts Dir.pwd
input "js" do
match "*.js" do
# concatenate all JS files into a single file
filter Rake::Pipeline::ConcatFilter, "application.js"
end
end
// ==UserScript==
// @name 11-13 TDI SportWagen
// @namespace com.nathanhammond.tdi
// @include http://www.foobert.com/carhunt.html
// @grant none
// @version 1
// ==/UserScript==
Array.prototype.rotate = function( n ) {
this.unshift.apply( this, this.splice( n, this.length ) )
@nathanhammond
nathanhammond / HandlebarsPrecompileFilter.rb
Last active December 22, 2015 07:38
Ember Handlebars precompilation rake-pipeline filter.
class HandlebarsPrecompileFilter < Rake::Pipeline::Filter
include Rake::Pipeline::Web::Filters::FilterWithDependencies
attr_reader :options
def initialize(options={},&block)
block ||= proc { |input| input.sub(/\.handlebars|\.hbs$/, '.hbs.js') }
super(&block)

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 / index.html
Created November 16, 2015 16:27
Service Worker fetch intercept timing.
<script>
function insertScript(src) {
var scripts = document.getElementsByTagName('script');
var newScript = document.createElement('script');
newScript.src = src;
scripts[0].parentNode.insertBefore(newScript, scripts[0]);
}
// This is contrived.