Get it from the App Store.
In XCode's Preferences > Downloads you can install command line tools.
def update | |
user = User.find(1) | |
if user.update_attributes(params[:user]) | |
respond_with(@user) | |
else | |
respond_with(@user.errors, :status => :unprocessable_entity) | |
end | |
end |
(defn- split-lines | |
"Takes a sequence of content chunks and returns a lazy sequence of individual lines. | |
(\"abc\" \"de\\nabc\") becomes (\"abcde\" \"abc\")" | |
[stream] | |
(let [ | |
chunk (first stream) | |
remainder (rest stream) | |
[line leftover] (string/split chunk #"\n+" 2)] | |
(if leftover | |
(lazy-seq (cons line (split-lines (cons leftover remainder)))) |
# When using this, be careful about your testing transactions. | |
# ActiveRecord after_commit hooks don't play nice with transactional fixtures | |
# consider adding the test_after_commit gem to your test group | |
ActiveRecord::Base.class_eval do | |
DEFERRED_KEY = "deferred" | |
def touch_with_defer(name = nil) | |
raise ActiveRecordError, "cannot touch on a new record object" unless persisted? | |
defer_until_commit([self.class.name, id, name, "touch"].map(&:to_s).join(":")) { touch_without_defer(name) } | |
end |
class Cell<T> { | |
let cell: T[] | |
var value: T { | |
get { return cell[0] } | |
} | |
init (_ value:T) { | |
self.cell = [value] | |
} |
// ==UserScript== | |
// @name Hide Images | |
// @namespace http://fluidapp.com | |
// @description Adds a button to hide images | |
// @include * | |
// @author Someone | |
// ==/UserScript== | |
// originally from: https://gist.github.com/1649063 |
require 'eventmachine' | |
module Blackhole | |
def post_init | |
puts "CONNECT" | |
end | |
def receive_data data | |
puts "RECEIVE: #{data}" | |
end |
queue: ./queue.sh |
# Handle mail delivery in the background. Only the minimum amount of data should go in the job not | |
# the fully rendered email content. | |
# I haven't tested this but some variant should work. | |
ActionMailer::Base.class_eval do | |
def self.create_and_deliver!(message, *parameters) | |
new(message, *parameters).deliver! | |
end | |
def method_missing_with_delay(method_symbol, *parameters)#:nodoc: | |
case method_symbol.id2name |
#!/usr/env ruby | |
base_dir = File.expand_path("../..", __FILE__) | |
NAME="faye" | |
PID="#{base_dir}/tmp/pids/#{NAME}.pid" | |
COMMAND="bundle exec rackup -s thin -E production -p 3001 faye.ru" | |
case ARGV[0] | |
when "start" |