Skip to content

Instantly share code, notes, and snippets.

View olov's full-sized avatar

Olov Lassus olov

  • Linköping, Sweden
View GitHub Profile
@iamnoah
iamnoah / alpha.js
Created June 4, 2013 18:01
JSShaper script to alphabetize object literals.
/**
* Usage:
* 1. git clone git://github.com/olov/jsshaper.git
* 2. mv alpha.js plugins/
* 3. node run-shaper.js TARGET_FILE plugins/alpha.js --source > ALPHABATIZED_FILE
*/
if (typeof define !== 'function') { var define = require('amdefine')(module); }
define(['../shaper', '../fmt', '../ref', '../tkn'], function(Shaper, Fmt, Ref, tkn) {
"use strict"; "use restrict";
require "benchmark"
N = (ARGV.shift || 40).to_i
def fib(n)
return n if n < 2
fib(n-2) + fib(n-1)
end
Benchmark.bmbm do |x|