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
RSpec::Matchers.define :allow do |*values| | |
match do |record| | |
values.collect {|value| | |
record.send("#{@attribute}=", value) | |
record.valid? | |
record.errors[@attribute].empty? | |
}.all? | |
end | |
chain :as do |attribute| |
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
RSpec::Matchers.define :allow do |*values| | |
match do |record| | |
values.collect {|value| | |
record.send("#{@attribute}=", value) | |
record.valid? | |
record.errors[@attribute].empty? | |
}.all? | |
end | |
chain :as do |attribute| |
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
upstream tunnel { | |
server 127.0.0.1:3000; | |
} | |
server { | |
listen 80; | |
server_name dev.codeplane.com br.dev.codeplane.com; | |
location / { | |
proxy_set_header X-Real-IP $remote_addr; |
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
# execute o bloco no contexto da variável number, passando a | |
# variável other_number como parâmetro para o bloco. | |
# o output deve exibir `true` | |
block = proc {|n| | |
puts n == self | |
} | |
number = 1 | |
other_number = 1 |
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" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> | |
<script type="text/javascript"> | |
if (typeof jQuery === "undefined") { | |
document.write(unescape("%3Cscript src='#{local_path}' type='text/javascript'%3E%3C/script%3E")); | |
}; | |
</script> |
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 Foo | |
end | |
#=> funciona antes do 1.9.3 | |
#=> exceção no 1.9.3 | |
Foo.new(1,2,3,4,5,6,7) |
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
;(function(document){ | |
var ua = navigator.userAgent | |
, meta = ["non-ie"] | |
, version | |
; | |
if (ua.match(/firefox/i)) { | |
meta.push("firefox"); | |
} else if (ua.match(/chrome/i)) { | |
meta = meta.concat(["chrome", "webkit"]); |
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
tell application "Safari" | |
set theTabs to tabs of the first window | |
set theUrls to {} | |
repeat with theIndex from (count of theTabs) to 1 by -1 | |
try | |
set theTab to item theIndex of theTabs | |
set theUrl to URL of theTab | |
if theUrl is not in theUrls then |
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 Thing | |
def name | |
puts "thing" | |
end | |
end | |
thing = Thing.new | |
def thing.name | |
super |
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
require "set" | |
require "yaml" | |
s = Set.new | |
s << 4 | |
s << 5 | |
s << 4 | |
s = YAML.load(s.to_yaml) | |
p s.entries |