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
<<-BUMBLEBEE | |
The bumblebee hovers around an object, | |
looking for a flower with some pollen. | |
It goes from flower to flower, | |
trying each method in order, | |
and when it finds one that isn't empty, | |
it returns it to the hive. | |
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/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 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 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 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 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 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 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 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 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 |