This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require.paths.unshift __dirname + '/lib' | |
task 'test', 'Run tests', -> | |
{testrunner} = require 'nodeunit' | |
process.chdir __dirname | |
testrunner.run ['test'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export trim = (str) -> | |
str.match(/^\s*(.*)\s*$/)[1] | |
export {action, before} = require 'helpers' | |
export class Controller extends Base | |
constructor: (@env) -> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# aquamacs-editor: my $EDITOR for Aquamacs. Starts Aquamacs, waits | |
# for emacs-server to load, then runs emacsclient with the given | |
# arguments. If data is piped to stdin, it's buffered to a temporary | |
# file and passed to emacsclient instead. Waits for 'C-x #' unless | |
# invoked with -n. | |
# | |
# sstephenson 2010-09-12 | |
require "tempfile" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(global-set-key (kbd "M-s") 'save-buffer) | |
(global-set-key (kbd "M-z") 'undo) | |
(global-set-key (kbd "<escape>") 'hippie-expand) | |
(set-face-font 'default "-apple-inconsolata-medium-r-normal--13-0-72-72-m-0-iso10646-1") | |
(add-to-list 'default-frame-alist '(width . 100)) | |
(add-to-list 'default-frame-alist '(height . 45)) | |
(setq-default tab-width 2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A reference counter that invokes a callback when it reaches zero. | |
# Use it to implement after-finished callbacks in asynchronous code. | |
(exports ? this).Finalizer = class Finalizer | |
@from: (finalizerOrCallback) -> | |
if finalizerOrCallback instanceof Finalizer | |
finalizerOrCallback | |
else | |
new Finalizer(finalizerOrCallback ? ->) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# js1k packer | |
if ARGV[0] == "-n" | |
ARGV.shift | |
wrap = false | |
else | |
wrap = true | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Mobile Safari doesn't fire touchstart or touchend events for | |
// input[type=text], input[type=password], input[type=search], | |
// and textarea elements. | |
(function() { | |
if (!("createTouch" in document)) return; | |
var selector = "input[type=text], input[type=password], input[type=search], textarea"; | |
function fire(element, type, identifier) { | |
var touch = document.createTouch(window, element, identifier, 0, 0, 0, 0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Using Sprockets in Rails 3 | |
MyApp::Application.routes.draw do | |
match 'application.js', :to => Sprockets::Server.new(YAML.load_file(Rails.root.join("config/sprockets/application.yml"))) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Provides a device_scale class on iOS devices for scaling user | |
// interface elements relative to the current zoom factor. | |
// | |
// http://37signals.com/svn/posts/2407-device-scale-user-interface-elements-in-ios-mobile-safari | |
// Copyright (c) 2010 37signals. | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
function resolve_symlink() { | |
local result=`readlink $1` | |
[ -z $result ] && echo $1 || $0 $result | |
} | |
function expand_path() { | |
cd -qP $1 | |
pwd |