Just install this in your apps like so:
gem 'test-spec-mini', :git => 'git://gist.github.com/1806986.git', :require => 'mini'
a=b=c=(1..100).each do |num| | |
print num, ?\r, | |
("Fizz" unless (a = !a) .. (a = !a)), | |
("Buzz" unless (b = !b) ... !((c = !c) .. (c = !c))), | |
?\n | |
end |
# Terminal Progress Indicators. Four examples are included: percentage, | |
# spinner, progress bar, and combined. This script has been tested on | |
# Mac OS X 10.8 with Ruby 1.8.7, 1.9.1, 1.9.2, and 1.9.3 | |
class Spinner | |
include Enumerable | |
def each | |
loop do | |
yield '|' | |
yield '/' |
my_rack_proc = lambda { |env| [200, {"Content-Type" => "text/plain"}, ["Hello. The time is #{Time.now}"]] } | |
puts my_rack_proc.call({}) | |
require 'rack' | |
Rack::Handler::WEBrick.run(my_rack_proc, :Port => 3000) |
class PostsController < ActionController::Base | |
def create | |
Post.create(post_params) | |
end | |
def update | |
Post.find(params[:id]).update_attributes!(post_params) | |
end | |
private |
# put the file into spec/support | |
shared_examples_for "ActiveModel" do | |
include ActiveModel::Lint::Tests | |
# to_s is to support ruby-1.9 | |
ActiveModel::Lint::Tests.public_instance_methods.map{|m| m.to_s}.grep(/^test/).each do |m| | |
example m.gsub('_',' ') do | |
send m | |
end | |
end |
Just install this in your apps like so:
gem 'test-spec-mini', :git => 'git://gist.github.com/1806986.git', :require => 'mini'
This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.
You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf
using homebrew.
(defun ruby-generate-tags() | |
(interactive) | |
(let ((root (ffip-project-root))) | |
(let ((my-tags-file (concat root "TAGS"))) | |
(message "Regenerating TAGS file: %s" my-tags-file) | |
(if (file-exists-p my-tags-file) | |
(delete-file my-tags-file)) | |
(shell-command | |
(format "find %s -iname '*.rb' | grep -v db | xargs ctags -a -e -f %s" | |
root my-tags-file)) |
❷ > QUEUE=* rake resque:work --trace | |
** Invoke resque:work (first_time) | |
** Invoke resque:preload (first_time) | |
** Invoke resque:setup (first_time) | |
** Execute resque:setup | |
** Execute resque:preload | |
rake aborted! | |
No such file to load -- devise/confirmations_controller | |
/Users/stefan/.rvm/gems/ruby-1.9.2-p290@my-rails-project/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:306:in `rescue in depend_on' | |
/Users/stefan/.rvm/gems/ruby-1.9.2-p290@my-rails-project/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:301:in `depend_on' |