Skip to content

Instantly share code, notes, and snippets.

@coop
coop / view.handlebars
Created July 23, 2012 09:17
Getting access to form properties in Ember.js
<form>
<div>
<label for="name">Name</label>
{{view Ember.TextField valueBinding="view.name"}}
</div>
<div>
<label for="application">Application</label>
{{view Ember.TextField valueBinding="view.file" type="file"}}
</div>
@coop
coop / hosts
Created August 5, 2012 07:35
Everyday Hero hosts file
core: 'http://localhost:3000'
heroix: 'http://localhost:3001'
admin: 'http://localhost:3002'
passport: 'http://localhost:3003'
fundraiser: 'http://localhost:3004'
financials: 'http://localhost:3005'
recruitment: 'http://localhost:3006'
namespace :app do
desc <<-DESC
Change application permissions.
Because the user deploying the application is different to the user
running the application we need to ensure that the permissions on
directories are what we expect.
DESC
task :permissions do
run "chown -R #{user}:www-data #{latest_release}"
client = Client.new RedisWhere.new
client.track event
class RedisWhere
def name
'redis'
end
def track message
$redis.rpush *message
module API
module Private
class IncomingController < ApplicationController
attr_writer :payload
respond_to :json
def receive
key = payload.keys.first
object = {'charity' => Charity}.fetch(key).new payload[key]
[github]
user = coop
[user]
name = Tim Cooper
email = [email protected]
[alias]
c = commit -v
co = checkout
put = push origin HEAD
s = status --short
module Publishers
class HTTP
attr_accessor :key
attr_reader :hosts
def initialize attributes = nil
attributes ||= {}
self.event = attributes[:event]
self.hosts = attributes.fetch(:hosts) do
#! /usr/bin/env ruby
if ARGV.first
File.open(ARGV.first, 'r') do |file|
counter = 0
file.each_line { |line| counter += 1 }
puts "#{counter} lines"
end
else
puts "Pass the path to the file you want to read"
class Page < ActiveRecord::Base
has_attached_file :image
end
class DelayedAttachment
attr_reader :attachment
def initialize attachment
@attachment = attachment
end

When building highly decoupled classes I often run into the problem of how to piece it all together. I have an understanding of how each piece is supposed to interact but I'm not sure how the functionality should co-exist. I have included some sample code below.