This file contains hidden or 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
| str = 'pol' | |
| eval <<-EOS | |
| class Foo | |
| def self.bar | |
| "some inter#{str}ated string" | |
| end | |
| end | |
| EOS |
This file contains hidden or 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
| # if you want to figure out wtf is calling Foo::Bar#baz, just | |
| class Foo::Bar | |
| def baz_with_backtrace *args | |
| begin | |
| raise | |
| rescue => e | |
| puts 'backtrace to who called Foo::Bar#baz:' | |
| puts e.backtrace.join("\n") | |
| end | |
| baz_without_backtrace *args |
This file contains hidden or 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 Selenium::WebDriver::Remote::DefaultHttpClient | |
| def request_with_catch_timeout(*args) | |
| begin | |
| request_without_catch_timeout(*args) | |
| rescue Timeout::Error # Timeout::Error.superclass == Interrupt, so rspec thinks its Ctrl-c and exits | |
| raise Exception.new('request timeout') # Exception isn't a subclass of Interrupt so won't cause the whole test suite to exit | |
| end | |
| end | |
| alias_method_chain :request, :catch_timeout | |
| end |
This file contains hidden or 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 Foo1 | |
| end | |
| Foo1.module_eval do | |
| def self.bar | |
| puts 'in Foo1#bar' | |
| end | |
| bar | |
| end |
This file contains hidden or 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
| // snip | |
| if (!prefs.prefHasUserValue("webdriver_enable_native_events")) { | |
| Utils.dumpn('webdriver_enable_native_events not set; defaulting to true'); | |
| } | |
| this.enableNativeEvents = | |
| prefs.prefHasUserValue("webdriver_enable_native_events") ? | |
| prefs.getBoolPref("webdriver_enable_native_events") : false; | |
| // snip |
This file contains hidden or 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 Mongrel | |
| module Gems | |
| class << self | |
| def require(library, version = nil) | |
| begin | |
| Kernel.require library | |
| rescue LoadError, RuntimeError => e | |
| begin | |
| # ActiveSupport breaks 'require' by making it always return a true value |
This file contains hidden or 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
| eq pSpawn = --- should output 1-10 and 11-20 interleaved | |
| function main() { | |
| spawn(for x = 11 to 20 do write(x);) | |
| for x = 1 to 10 do write(x); | |
| } . | |
| mb configuration < T > | |
| < threads > | |
| < thread > | |
| < k > K </ k > |
This file contains hidden or 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
| $(document).ready(function() { | |
| $('input[type=text]').each(function() { | |
| original_val = $(this).val(); | |
| function replace(el, o, r) { if (el.val() == o) el.val(r); } | |
| $(this).focus(function() { replace($(this), original_val, ''); }); | |
| $(this).blur(function() { replace($(this), '', original_val); }); | |
| }); | |
| }); |
This file contains hidden or 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
| #!/bin/sh | |
| LOCAL_DIRECTORY='/Users/dan/backups/bakineggs.com' | |
| REMOTE='lwweb:/www/bakineggs.com/' | |
| if [ ! -d $LOCAL_DIRECTORY ]; then | |
| mkdir -p $LOCAL_DIRECTORY | |
| fi | |
| cd $LOCAL_DIRECTORY |
This file contains hidden or 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
| pp results | |
| puts '#######################################################' | |
| pp results.group_by(&:instant) | |
| yields (on ruby 1.8.5) | |
| [#<Result instant: "2009-06-07 18:01:06", value: 1.0, group: "Atlanta">, | |
| #<Result instant: "2009-06-05 18:01:06", value: 2.0, group: "Atlanta">, | |
| #<Result instant: "2009-06-08 18:01:06", value: 1.0, group: "Roswell">, | |
| #<Result instant: "2009-06-06 18:01:06", value: 2.0, group: "Roswell">, |