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 ActsAsAbandonable | |
| def abandonable? | |
| true | |
| end | |
| end | |
| class Jose | |
| include ActsAsAbandonable | |
| attr_accessor :name | |
| def initialize |
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 Patrick | |
| def self.should_i_deploy?(*args) | |
| true | |
| end | |
| end | |
| puts Patrick.should_i_deploy?({ :visitors => 1000, :on_signup_page => 500 }) | |
| puts Patrick.should_i_deploy?({ :failed_tests => 30, :total_tests => 35 }) | |
| puts Patrick.should_i_deploy?({ :requires_large_alter_table_migration => true }) | |
| puts Patrick.should_i_deploy?({ :down_time_required => 24.hours, :available_servers => 1 }) |
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
| require 'base64' | |
| clear_code = <<OBF | |
| class Obfuscated | |
| def self.alive? | |
| true | |
| end | |
| 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
| alias optff="cd ~/Library/Application\ Support/Firefox/Profiles/; for f in */*.sqlite; do sqlite3 \$f 'VACUUM;'; done; echo Firefox DBs Optimized;" |
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
| # Yes this actually works. No you shouldn't run it unless you're prepared to reboot. | |
| loop do | |
| fork | |
| 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
| # An extension to the Hash class to inspect what it is made of | |
| class Hash | |
| def whatami | |
| keys.inject({}) do |hash, key| | |
| hash[key] = case self[key].class.to_s | |
| when "Hash" | |
| self[key].whatami | |
| when "Array" | |
| self[key].map do |item| | |
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 | |
| # setup ------------------------------------------------------------------------ | |
| tempDir="/tmp/`whoami`/chrome-nightly/"; | |
| baseURL="http://build.chromium.org/buildbot/snapshots/chromium-rel-mac/"; | |
| baseName="chrome-mac"; | |
| baseExt="zip"; | |
| appName="Chromium.app"; | |
| appDir="/Applications"; | |
| version=~/.CURRENT_CHROME; |
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
| require 'autotest/fsevent' | |
| require 'autotest/growl' | |
| require 'redgreen/autotest' | |
| require 'autotest/restart' | |
| require 'autotest/timestamp' | |
| # require 'autotest/autoupdate' | |
| # =================================================== | |
| # = Monkey patch to make autotest not use unit diff = |
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
| /* | |
| Assuming a page where you have several tabs and maps within those tabs: | |
| Render your map with displayMap() and whatever parameters you need to render it (address, etc) | |
| In you event listener for showing your tab's body div, call redraw_maps(); ex: | |
| $('div.map_cotantainer a').click(function () { | |
| if (is_defined(redraw_maps())) { redraw_maps(); } | |
| return false; | |
| }) | |
| */ |
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
| require 'rubygems' | |
| require 'benchmark' | |
| include Benchmark | |
| test_array = [1,2,3,4,5,6,7,8,9,10] | |
| bm do |bench| | |
| bench.report('null ') { 100000.times { |i| i } } | |
| bench.report('block ') { 100000.times { test_array.map { |num| num.to_s } } } | |
| bench.report('no block') { 100000.times { test_array.map(&:to_s) } } |