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
development: | |
repositories: | |
default: &balls_defaults | |
adapter: mysql | |
host: localhost | |
database: balls | |
username: root | |
password: "" | |
dongs: &dongs_defaults | |
adapter: mysql |
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
{ | |
"~f" = "moveWordForward:"; | |
"~b" = "moveWordBackward:"; | |
"~<" = "moveToBeginningOfDocument:"; | |
"~>" = "moveToEndOfDocument:"; | |
"~v" = "pageUp:"; | |
"^v" = "pageDown:"; | |
"~d" = "deleteWordForward:"; | |
"~^h" = "deleteWordBackward:"; | |
"~\Uf728" = "deleteWordForward:"; |
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 'digest/sha1' | |
class RefCode < ::DataMapper::Property::String | |
required true | |
unique_index true | |
default proc { |_, prop| prop.class.generate(prop.length) } | |
# Setting :format before passing on the initialization chain will cause | |
# dm-validations (if present) to auto-add a format validation for us. | |
# For some reason setting :length is not doing the same, so our format |
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
2010-09-20 15:29:33 INFO [127.0.0.1] >> "GET /newrelic/threads HTTP/1.0" | |
2010-09-20 15:29:33 FATAL /!\ FAILSAFE /!\ Mon Sep 20 15:29:33 -0700 2010 | |
Status: 500 Internal Server Error | |
compile error | |
(erb):17: syntax error, unexpected ';' | |
...with_index do | thread, i | -; frobnitz.concat "\n<tr class=... | |
^ | |
(erb):27: syntax error, unexpected ';' | |
; end -; frobnitz.concat "\n" | |
^ |
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
# The last one is the important lesson -- if *any* component of the path has a | |
# symlink in it (not just the *last* component), Pathname#relative_path_from can | |
# still produce the wrong outcome. | |
# | |
# Admittedly, the example here would actually work because both the real dir and | |
# symlinked dir are both at the same level of path nesting. This example is just | |
# to demonstrate that Pathname#symlink? is an insufficient test in determining | |
# whether or not to call Pathname#realpath. | |
irb(main):001:0> require 'pathname' |
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
#!/usr/bin/ruby | |
s = "I really think this regexp engine sucks, why don't they just use PCRE?" | |
re = /((\w+\s*)+ regexp)$/ | |
re.match(s) | |
puts "NIH, muthafuckaz, NIH!!!!!!!!" # p.s you'll never see this line |
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
# With Enum | |
creating 20 models took: 0.830000 0.010000 0.840000 ( 0.833432) | |
user system total real | |
Enum: 0.080000 0.000000 0.080000 ( 0.082003) | |
Decimal: 0.050000 0.000000 0.050000 ( 0.050160) | |
DateTime: 0.040000 0.000000 0.040000 ( 0.046490) | |
String: 0.080000 0.000000 0.080000 ( 0.077332) | |
Integer: 0.030000 0.000000 0.030000 ( 0.033848) | |
Boolean: 0.060000 0.000000 0.060000 ( 0.052100) |
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
# The default DM property doesn't support serials, so we add it in here | |
module DataMapper | |
class Property | |
class String | |
accept_options :serial | |
end | |
end | |
end | |
module DataMapper::Salesforce |
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
# dm-core 0.10.2 <- our current point | |
creating 20 models took: 0.890000 0.250000 1.140000 ( 1.147287) | |
# dm-core v1.0.0 | |
creating 20 models took: 1.350000 0.440000 1.790000 ( 1.791719) | |
# dm-core e7b5f186 <- somewhere after 1.0.0, time is climbing | |
creating 20 models took: 1.540000 0.520000 2.060000 ( 2.061627) | |
# dm-core ad298724 <- git bisect tells me this is the bad one |
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 'thread' | |
m = Mutex.new | |
m.lock | |
wt2 = Thread.new do | |
m.lock | |
sleep 2 | |
m.unlock | |
end |