Skip to content

Instantly share code, notes, and snippets.

View shock's full-sized avatar

Bill Doughty shock

  • Austin, TX
View GitHub Profile
@shock
shock / gist:183834
Created September 9, 2009 15:52 — forked from techpeace/gist:180579
Surround a heredoc with quotes and you can continue the code on the same line:
render :status => 404, :text => <<-'EOH' and return unless setup
article not found<br/>
I, as a server, have failed<br/>
https?
EOH
Quotes also give you more freedom/creativity with the terminal ID:
@shock
shock / gist:120186
Created May 29, 2009 20:17 — forked from jsierles/gist:29838
Find bloating passengers and kill them gracefully.
#!/usr/bin/env ruby
#
# Find bloating passengers and kill them gracefully. Run from cron every minute.
#
# required for passenger since cron has no environment
ENV['HTTPD'] = 'httpd'
MEM_LIMIT = ARGV[0] || 500
class Spinner
private
@work
@job
def spinner
return(['\\','|','/','-'][@i%4])
end