Skip to content

Instantly share code, notes, and snippets.

def some_filter
redirect_unauthorized unless current_user.authorized?(@judge)
end
def redirect_unauthorized(where = "#{params[:controller]}_path",
message = "You are not authorized to perform this action.")
flash[:error] = message
redirect_to where
end
def add_new_method
define_method(:params[:method_name].to_s,
lambda { eval(:params[:method_body])})
end
upstream domain1 {
server 127.0.0.1:8000;
}
server {
listen 80;
server_name mysite.com www.mysite.com;
...
;; http://www.emacswiki.org/cgi-bin/wiki/http-post-simple.el
(http-post-simple-multipart "http://www.tumblr.com/api/write"
(list (cons 'caption "foo")
(cons 'type "photo")
(cons 'email "something")
(cons 'password "something")
(cons 'group "testingtumble.tumblr.com"))
(list "data" "avatar.png" "image/png" (file-data "/home/federico/avatar.png")))
require 'test_helper'
class <%= controller_class_name %>ControllerTest < ActionController::TestCase
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:<%= table_name %>)
end
test "should get new" do
$ msr 1.8/core/
ruby 1.8.6 (2008-08-11 patchlevel 287) [i686-darwin9.5.0]
.EEEEEEEEEEEEEEEEEEEEEEEEE..............................................E......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................F.....................................................................
it "returns a tainted string when the format is tainted" do
["abcd", 0x20].pack("A3C".taint).tainted?.should be_true
end
it "returns a tainted string when the format is tainted even if the given format is empty" do
["abcd", 0x20].pack("".taint).tainted?.should be_true
end
@febuiles
febuiles / log
Created December 18, 2008 02:23
ruby 1.8.6 (2008-08-11 patchlevel 287) [i686-darwin9.5.0]
........................................................................E...........................................................................................................................................................................................................................................................................F.........F......................F................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
1)
File::Stat#zero? zero? returns false for a directory FAILED
Expected #<Proc:0x00523064@./1.8//core/file/stat/../../../shared/file/zero.rb:56>
to equal false
./1.8//core/file/stat/../../../shared/file/zero.rb:56
./1.8//core/file/stat/fixtures/classes.rb:3:in `all?'
./1.8//core/file/stat/zero_spec.rb:5
2)
1)
File::Stat#zero? zero? returns false for a directory ERROR
TypeError: can't convert nil into String
./1.8/core//file/stat/fixtures/classes.rb:3:in `lstat'
./1.8/core//file/stat/fixtures/classes.rb:3:in `method_missing'
./1.8/core//file/stat/../../../shared/file/zero.rb:56:in `send'
./1.8/core//file/stat/../../../shared/file/zero.rb:56
./1.8/core//file/stat/fixtures/classes.rb:3:in `all?'
./1.8/core//file/stat/zero_spec.rb:5