This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
false == false | |
false == 0 | |
false == "" | |
false == " " | |
false == "0" | |
false == " 0 " | |
false == [] | |
false == [0] | |
false == [""] | |
false == [" "] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// myFunc({ a: 1, b: 2, c: 3 }) | |
function myFunc(options) { | |
var default_options = { | |
a: 1, | |
b: 2, | |
c: 3 | |
} | |
options = options || {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rake::Task[:default].clear | |
task :default => :build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ActionController::Integration | |
class Session | |
private | |
def encode_cookies | |
cookies.inject("") do |string, (name, value)| | |
string << "#{'#{name.sub(/^\n/, "")}'}=#{'#{value}'}; " | |
end | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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); | |
}), |