Some random notes on the pangs of ember. Will be expanding as they are uncovered.
Say you have a form that maps to a model, something like:
<form>
<fieldset>
<legend>Who are you?</legend>
# Usage: redis-cli publish message.achannel hello | |
require 'sinatra' | |
require 'redis' | |
conns = Hash.new {|h, k| h[k] = [] } | |
Thread.abort_on_exception = true | |
get '/' do |
# Usage: redis-cli publish message hello | |
require 'sinatra' | |
require 'redis' | |
conns = [] | |
get '/' do | |
erb :index | |
end |
// | |
// Example usage: phantomjs screenshot.js http://yahoo.com /tmp/yahoo.png | |
// | |
var system = require('system'); | |
var url = system.args[1]; | |
var filename = system.args[2]; | |
var page = new WebPage(); | |
page.open(url, function (status) { |
def geodist(a, b) | |
rads = Math::PI/180 | |
# 7926.3352 is diameter of earth in miles | |
7926.3352 * Math.asin( | |
Math.sqrt( | |
Math.sin( (b[1] - a[1])*rads / 2 )**2 * | |
Math.cos( a[0] * rads ) * | |
Math.cos( b[0] * rads ) + | |
Math.sin( (b[0] - a[0])*rads / 2 )**2 | |
) |
#!/usr/bin/ruby | |
# Require: | |
# - linux or Mac | |
# - ruby 1.8.7 | |
# - Gem soap4r | |
# - curl | |
# | |
# Usage : | |
# ruby ovhfact.rb 2011 | |
# |
// ==UserScript== | |
// @name Use Markdown, sometimes, in your HTML. | |
// @author Paul Irish <http://paulirish.com/> | |
// @link http://git.io/data-markdown | |
// @match * | |
// ==/UserScript== | |
// If you're not using this as a userscript just delete from this line up. It's cool, homey. |
# Extend jQuery objects with Underscore collection methods. | |
# | |
# Each collection method comes in two flavors: one prefixed | |
# with _, which yields a bare DOM element, and one prefixed | |
# with $, which yields a jQuery-wrapped element. | |
# | |
# So if `this` is a jQuery object, instead of: | |
# | |
# _.max @, (el) -> $(el).height() | |
# |
<?php | |
require_once 'Zend/Mail.php'; | |
require_once 'Zend/Mail/Transport/Smtp.php'; | |
$config = array(); | |
$config['host'] = "localhost"; | |
$config['port'] = 1025; | |
$config['username'] = ""; | |
$config['password'] = ""; |
var detectBackOrForward = function(onBack, onForward) { | |
hashHistory = [window.location.hash]; | |
historyLength = window.history.length; | |
return function() { | |
var hash = window.location.hash, length = window.history.length; | |
if (hashHistory.length && historyLength == length) { | |
if (hashHistory[hashHistory.length - 2] == hash) { | |
hashHistory = hashHistory.slice(0, -1); | |
onBack(); |