Skip to content

Instantly share code, notes, and snippets.

[2011-05-16 15:31:00] ERROR ArgumentError: wrong number of arguments (0 for 1)
/home/sbeam/.rvm/gems/ree-1.8.7-2010.02@chp99/gems/railties-3.0.7/lib/rails/application.rb:77:in `call'
/home/sbeam/.rvm/gems/ree-1.8.7-2010.02@chp99/gems/railties-3.0.7/lib/rails/application.rb:77:in `send'
/home/sbeam/.rvm/gems/ree-1.8.7-2010.02@chp99/gems/railties-3.0.7/lib/rails/application.rb:77:in `method_missing'
(eval):3:in `send'
(eval):3:in `method_missing'
/home/sbeam/.rvm/gems/ree-1.8.7-2010.02@chp99/gems/railties-3.0.7/lib/rails/rack/log_tailer.rb:14:in `call'
/home/sbeam/.rvm/gems/ree-1.8.7-2010.02@chp99/gems/rack-1.2.2/lib/rack/content_length.rb:13:in `call'
/home/sbeam/.rvm/gems/ree-1.8.7-2010.02@chp99/gems/rack-1.2.2/lib/rack/handler/webrick.rb:52:in `service'
/home/sbeam/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
@sbeam
sbeam / gist:1171906
Created August 25, 2011 20:55
functional testing against authentication - example
class AbstractControllerTest < ActionController::TestCase
context "handle :index" do
context "logged as user"
setup do
logged_as(:user)
get :index
end
should_redirect_to("Root page"){root_path()}
end
context "logged as admin"
@sbeam
sbeam / gist:1189411
Created September 2, 2011 18:32
cyclethrough() jquery plugin
/**
* loops through the collection given by 'selector' within the called node, and
* when the elem is moused-over (is that a word?) adjusts * the z-index at the
* given interval for each. Like an animated GIF for any set of DOM nodes!
* Meant to work with a set of images, like thumbnails, YMMV
*
* $('#video-thumbnails').cyclethrough('img', 800);
*
* author sbeam
* license MIT
@sbeam
sbeam / gist:1200891
Created September 7, 2011 15:34
create postgres DBs for Rails proj, OSX
sbeam@pris ~/Sites/parallaxp]$ psql -U postgres -c "CREATE DATABASE parallaxp_dev"
Password for user postgres:
CREATE DATABASE
sbeam@pris ~/Sites/parallaxp]$ psql -U postgres -c "CREATE USER parallaxp WITH PASSWORD 'xxxxxxxxxx'"
Password for user postgres:
CREATE ROLE
sbeam@pris ~/Sites/parallaxp]$ psql -U postgres -c "CREATE DATABASE parallaxp_test OWNER parallaxp"
Password for user postgres:
CREATE DATABASE
sbeam@pris ~/Sites/parallaxp]$ psql -U postgres -c "ALTER USER parallaxp CREATEDB"
@sbeam
sbeam / test_helper.rb
Created September 30, 2011 01:19
Access Paperclip matchers in your Shoulda tests
# In test_helper.rb add (inside Spork.prefork block)
require "paperclip/matchers"
# ...
class Test::Unit::TestCase
extend Paperclip::Shoulda::Matchers
end
@sbeam
sbeam / gist:1571992
Created January 6, 2012 19:22
Y U NO WORK CONTROLLER SPEC
class SubscriptionsController < ApplicationController
def create
@subscription = Subscription.new params[:subscription]
@subscription.save
respond_to do |wants|
wants.js
wants.html
end
/home/sbeam/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/fileutils.rb:506:in `rename': Not a directory - /home/sbeam/public_html/alpinehausct/tmp/cache/00020120110-11026-hr2o4s-0 or /home/sbeam/public_html/alpinehausct/tmp/cache/001/000/ (Errno::ENOTDIR)
from /home/sbeam/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/fileutils.rb:506:in `mv'
from /home/sbeam/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/fileutils.rb:1402:in `fu_each_src_dest'
from /home/sbeam/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/fileutils.rb:1418:in `fu_each_src_dest0'
from /home/sbeam/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/fileutils.rb:1400:in `fu_each_src_dest'
from /home/sbeam/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/fileutils.rb:495:in `mv'
from /home/sbeam/.rvm/gems/ruby-1.8.7-p352@alpinehaus/gems/activesupport-3.1.3/lib/active_support/core_ext/file/atomic.rb:35:in `atomic_write'
from /home/sbeam/.rvm/gems/ruby-1.8.7-p352@alpinehaus/gems/activesupport-3.1.3/lib/active_support/cache/file_store.rb:102:in `write_entry'
from /home/sbeam/.rvm/
@sbeam
sbeam / randpw.pl
Created March 15, 2012 02:03
password/passphrase hybrid generator
#!/usr/bin/perl -w
# Usage: randpw.pl <len>
# optional <len> truncate to so many chars
# using my copy of /usr/dict/words, n = 53970, so with default settings, r=2 and
# ((n+1)! / (r * (n-1)!) = 1456407435 (because its a duplicative combination at this stage)
# so there are
# (1456407435 * 1000 * 68)^3 = 9.7134 x 10^41
# possible passwords here,
@sbeam
sbeam / deploy.rb
Created August 23, 2012 18:55
Ruby version management on Debian
require "bundler/capistrano" # runs bundle:install on remote for us
# give cap the correct path to our custom installed rubies
default_environment['PATH'] = "/usr/local/ruby/bin:/usr/bin:/bin"
# ... rest of normal cap config
@sbeam
sbeam / thin.sh
Created August 24, 2012 19:08
/etc/init.d/thin - replacement that runs bundle exec thin within each site
#!/bin/bash
### BEGIN INIT INFO
# Provides: thin
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: S 0 1 6
# Short-Description: thin initscript
# Description: thin
### END INIT INFO