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 | |
# | |
# Find bloating passengers and kill them gracefully. Run from cron every minute. | |
# | |
MEM_LIMIT = ARGV[0] || 500 | |
module Process | |
def self.running?(pid) | |
begin |
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 | |
# | |
# fetch hosts from amazon EC2 meta-data | |
# | |
# Based on http://dysinger.net/2008/10/13/using-amazon-ec2-metadata-as-a-simple-dns | |
# | |
%w(logger optparse rubygems right_aws resolv pp).each { |l| require l } | |
LOGGER = Logger.new("/var/log/fetch_hosts.log") |
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 | |
command = '/usr/bin/passenger-memory-stats' | |
memory_limit = 200 # megabytes | |
def running?(pid) | |
begin | |
return Process.getpgid(pid) != -1 | |
rescue Errno::ESRCH | |
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
RELEASE_OUTPUT_PATH = File.expand_path("~/Projects/releases/Squeemote") | |
TARGET_NAME = "Squeemote" | |
CONFIGURATION = ENV['CONFIGURATION'] || "Distribution" | |
SDK_VERSION = ENV['SDK'] || 'iphoneos2.2' | |
task :release do | |
puts "* Bumping build version." | |
`agvtool bump -all` | |
puts "* Building #{CONFIGURATION} release." |
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
# by Giles Bowkett | |
# http://gilesbowkett.blogspot.com/2009/04/unshiftfiledirnamefile.html | |
# >> File.here("README.textile") | |
# => "/Users/dancroak/dev/ecology/README.textile" | |
class File | |
def self.here(string) | |
join(expand_path(dirname(__FILE__), string)) | |
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
/* | |
* a smart poller for jquery. | |
* (by github) | |
* | |
* simple example: | |
* | |
* $.smartPoller(function(retry) { | |
* $.getJSON(url, function(data) { | |
* if (data) { | |
* doSomething(data) |
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
# Load config/paperclip.yml settings | |
if paperclip_cfg = YAML.load_file("#{Rails.root}/config/paperclip.yml")[Rails.env] | |
paperclip_cfg.symbolize_keys! | |
command_path = paperclip_cfg.delete(:command_path) | |
# Replace Attachment defaults with configuration ones | |
Paperclip::Attachment.default_options.merge!(paperclip_cfg) | |
# Adjust ImageMagick path to work with Passenger | |
Paperclip.options[:command_path] = command_path |
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
# Overload Clearance's `deny_access` methods to allow authentication with HTTP-Auth for eg. API access | |
# Modeled after technoweenie's restful_authentication | |
# http://github.com/technoweenie/restful-authentication/blob/7235d9150e8beb80a819923a4c871ef4069c6759/generators/authenticated/templates/authenticated_system.rb#L74-76 | |
# | |
# In lib/clearance_http_auth.rb | |
module Clearance | |
module Authentication | |
module InstanceMethods | |
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
Factory.define :application do |factory| | |
factory.attachment(:sample, "public/samples/sample.doc", "application/msword") | |
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
// replaced this | |
$(document).ready(function() { | |
if ($.fn.corner) $('.corner').corner() | |
}) | |
// with this | |
.corner { | |
-moz-border-radius: 8px; | |
-webkit-border-radius: 8px; | |
padding: 3px; |
OlderNewer