Skip to content

Instantly share code, notes, and snippets.

class Page
def self.from(path, method)
env = Rack::MockRequest.env_for(path, method: method)
request = ActionDispatch::Request.new(env)
router = Journey::Router.new(Rails.application.routes.set, {
parameters_key: ActionDispatch::Routing::RouteSet::PARAMETERS_KEY,
request_class: ActionDispatch::Request
})
klass = nil
false == false
false == 0
false == ""
false == " "
false == "0"
false == " 0 "
false == []
false == [0]
false == [""]
false == [" "]
// myFunc({ a: 1, b: 2, c: 3 })
function myFunc(options) {
var default_options = {
a: 1,
b: 2,
c: 3
}
options = options || {}
Rake::Task[:default].clear
task :default => :build
module ActionController::Integration
class Session
private
def encode_cookies
cookies.inject("") do |string, (name, value)|
string << "#{'#{name.sub(/^\n/, "")}'}=#{'#{value}'}; "
end
end
end
end
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<title>isObjectLiteral</title>
<style>
li { background: green; } li.FAIL { background: red; }
iframe { display: none; }
</style>
</head>
class Array
def sum
inject(0) do |memo, i|
memo += i
end
end
end
sum_method = Array.instance_method(:sum)
Array.send(:remove_method, :sum)
<script type="text/javascript">
jShoulda.useStyle('describe');
describe('jRspec', {},
describe('"should"', {},
it('should be defined should on object', function() {
var obj = {};
obj.should.should(this).equal(jRspec.should);
}),