+---------+
| Pusher |
+---------+
|
v
+---------+ +----------------+
| Queue |------------------------------------------->| ConnectionPool |
// Works but is pretty verbose | |
App.Router.map(function() { | |
this.route("users.index", { path: "/users" }); | |
this.route("users.new", { path: "/users/new" }); | |
this.route("user.index", { path: "/users/:user_nickname" }); | |
this.route("user.edit", { path: "/users/:user_nickname/edit" }); | |
}); | |
// Seems to be the best way to use the DSL but the `:user_nickname` param is incorrectly replaced |
require 'formula' | |
class Phantomjs < Formula | |
homepage 'http://www.phantomjs.org/' | |
head 'https://github.com/ariya/phantomjs.git' | |
depends_on :macos => :snow_leopard | |
def install | |
system 'yes | ./build.sh' |
defmodule Test do | |
def falsify_var(contents) do | |
IO.puts(inspect(contents)) | |
case contents do | |
{ :^, _, [_] } -> | |
contents | |
{ var, meta, scope } when is_atom(var) and is_atom(scope) -> | |
{ var, meta, false } | |
{ left, meta, right } -> |
fn -> | |
do_some_stuff_that_spans_multiple_lines | |
end.() |
User.all.select("users.*, count(*) OVER()").limit(10).first.count |
defmodule GenFsm.Behaviour do | |
defmacro __using__(_) do | |
quote location: :keep do | |
@behavior :gen_fsm | |
def init(args) do | |
{ :ok, args } | |
end | |
def handle_event(_event, state_name, state_data) do |
for file in $(find . -type f -name "*.rb"); do cat $file | git stripspace | sponge $file; done |
class Item | |
def does_something | |
PublishingHouse.new(@document).publish | |
end | |
end | |
it 'publishes the document' do | |
publishing_house = stub('PublishingHouse') | |
publishing_house.should_receive(:publish).once | |
PublishingHouse.should_receive(:new).with(document) { publishing_house } |