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
#!/bin/env ruby | |
# Logs the number of queued and active connections on the unicorn socket to statsd. | |
# There's a cap on the number of queued connections. If we hit it then nginx will | |
# start serving 504 pages | |
# | |
# There is no visible output, but data is sent to statsd each second | |
# | |
# Props to Tim Lucas for the basic structure: | |
# |
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
$ git branch -r --merged origin/master | | |
grep origin | | |
grep -v '>' | | |
grep -v master | | |
xargs -L1 | | |
cut -d "/" -f 2 | | |
xargs git push origin --delete |
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
urls = Hash.new("jquery-1.4.2.min.js") | |
urls["production"] = "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" | |
ActionView::Helpers::AssetTagHelper.register_javascript_expansion(:jquery => urls[Rails.env]) |
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
irb(main):005:0> n = "James" | |
=> "James" | |
irb(main):006:0> n.strip! | |
=> nil | |
irb(main):007:0> n | |
=> "James" | |
# that's just plain weird | |
>> n = "john " | |
=> "john " |
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
# assume we're passing the values from the file below as arguments to the following: | |
# WTF is name always nil? | |
# I'm not sure off the top of my head, but maybe just avoid regexp's all together? | |
# - jh | |
def filtered_filenames(paths) | |
paths ||= [] | |
paths.collect { |path| | |
File.basename(path) |