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>
class X.Example extends X.Object | |
@proxyMethod "attachmentManager.manageAttachment" | |
# Equivalent to: | |
# manageAttachment: -> | |
# @attachmentManager.manageAttachment.apply(@attachmentManager, arguments) | |
@proxyMethod "delegate?.compositionDidChangeDocument" | |
# Equivalent to: | |
# compositionDidChangeDocument: -> | |
# @delegate?.compositionDidChangeDocument?.apply(@delegate, arguments) |
post_process { | |
soffice = '/Applications/LibreOffice.app/Contents/MacOS/soffice' | |
[file, country_report_file, total_report_file].each do |f| | |
system! "#{soffice} --headless --convert-to xlsx #{f}" | |
end | |
} |
#!/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" |
<?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'] = ""; |
# 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() | |
# |
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 | |
) |
require 'faraday_middleware' | |
require 'hashie/mash' | |
# Public: GeoIP service using freegeoip.net | |
# | |
# See https://github.com/fiorix/freegeoip#readme | |
# | |
# Examples | |
# | |
# res = GeoipService.new.call '173.194.64.19' |
# 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 |
require 'rubygems' | |
require 'eventmachine' | |
require 'em-websocket' | |
require 'json' | |
class Connection | |
attr_accessor :socket, :user_id | |
def initialize(socket, user_id) | |
@socket = socket |