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
| #!/usr/bin/env ruby | |
| require "rubygems" | |
| gem "beanstalk-client" | |
| require "beanstalk-client" | |
| port = ARGV.last or raise "GIVE ME A PORT NEXT TIME!" | |
| beanstalk = Beanstalk::Pool.new(["0.0.0.0:#{port}"]) | |
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
| { scopeName = 'source'; | |
| patterns = ( | |
| { name = 'source.invalid.trailing-whitespace'; | |
| match = '\S(\s{1,})$'; | |
| captures = { 1 = { name = 'invalid.trailing-whitespace'; }; }; | |
| }, | |
| { name = 'source.invalid.just-whitespace'; | |
| match = '^(\s{1,})$'; | |
| captures = { 1 = { name = 'invalid.trailing-whitespace'; }; }; |
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
| { scopeName = 'source'; | |
| comment = ' | |
| You will need to add a { include = "source"; } within the patterns = (...) segment of each of your languages. | |
| Eugh! | |
| '; | |
| patterns = ( | |
| { name = 'source.invalid.trailing-whitespace'; | |
| match = '\S(\s{1,})$'; | |
| captures = { 1 = { name = 'invalid.trailing-whitespace'; }; }; | |
| }, |
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
| set :deploy_via, :copy | |
| set :copy_cache, true | |
| set :copy_exclude, [".git/*", ".svn/*"] | |
| set :copy_strategy, :export | |
| set :repository, Dir.pwd |
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
| function mateforce(){ | |
| `which mate` $* | |
| } | |
| function mate(){ | |
| if find $* -type f | ~/line_count_less_than 1000 | |
| then | |
| mateforce $* | |
| else | |
| echo "Too many files!" |
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
| # The data setup inside the block may take upto a second to be ready to pass the test. But probably much less. | |
| def retrying_for(secconds = 1) | |
| limit = Time.now + secconds | |
| begin | |
| yield | |
| rescue | |
| if Time.now < limit | |
| sleep 0.05 | |
| retry | |
| else |
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" | |
| gem "twitter4r" | |
| require "twitter" | |
| require "active_support" | |
| Twitter::Client.configure do |conf| | |
| conf.application_name = "Twitter Echo" | |
| end | |
| username, password = ARGV.shift, ARGV.shift |
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
| # Example: | |
| # # Fish has a has_been_caught_by_someone_called(...) scope that is too complex (several joins, and group bys) | |
| # Fish.count # => 999,999,999 | |
| # my_fish = Fish.has_been_caught_by_someone_called("bubba") | |
| # | |
| # my_fish.count # => 999,999 | |
| # my_fish.update_all(:color => "green") # Too complex, too many joins, group by etc... mysql will not play ball. | |
| # my_fish.all... # => OUT OF MEMORY!!!!!! | |
| # my_fish.each_in_batches{|f| f.update_attribute(:color => "green") } # => Takes more than a decade. | |
| # my_fish.complex_update_all(:color => "green") # => 999,999 |
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
| ## Tom's Magical "Don't Mate Your Root" Script | |
| # Prevents "mate /" from crashing your Mac. | |
| function mateforce(){ | |
| `which mate` $* | |
| } | |
| function line_count_less_than(){ | |
| ruby -e " | |
| max_count = ARGV.first.to_i |
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
| # Example Usage: | |
| # | |
| # FactoryWithCallbacks.define :product do |p| | |
| # p.on_create do |prod| | |
| # Factory(:product_alias, :product => prod) | |
| # end | |
| # end | |
| class FactoryWithCallbacks < Factory |