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
# call-seq: | |
# Webby.site => struct | |
# | |
# Returns a struct containing the configuration parameters for the | |
# Webby site. These defaults should be overridden as needed in the | |
# site specific Rakefile. | |
# | |
def self.site | |
return @site if defined? @site | |
@site = OpenStruct.new( |
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
#-*-ruby-*- | |
SITE.user = 'tobias' | |
SITE.host = 'handbuiltsoftware.com' | |
SITE.remote_dir = '/path/to/site/' | |
task :default => :build | |
desc 'deploy the site to the webserver' | |
task :deploy => [:build, 'deploy:ssh'] | |
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
@namespace url(http://www.w3.org/1999/xhtml); | |
@-moz-document domain("lighthouseapp.com") { | |
#header { | |
height: 72px !important; | |
} | |
#rheader { | |
padding-top: 3px !important; | |
} |
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
#!/opt/local/bin/ruby | |
KEY_PAIRS = %w{`~ 1! 2@ 3# 4$ 5% 6^ 7& 8* 9( 0) -_ [{ ]} \| ;: =+ '" ,< .> /?}.collect { |kp| kp.split('') } | |
KEYS = KEY_PAIRS.flatten | |
counts = { } | |
%w{ app lib test }.each do |dir| | |
Dir.glob("#{dir}/**/*.{rb,sass}").each do |filename| | |
File.open(filename) do |file| |
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
#in controller | |
key = store_params(hash_of_params_to_keep) | |
redirect_to some_path(:params_key => key) | |
----------- | |
def store_params(hash_of_params) | |
key = Time.now.to_s + rand(10000).to_s #or some other unique key | |
session[:stored_params] ||= {} |
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
#!/opt/local/bin/ruby | |
def play_alert() | |
play = 'afplay /System/Library/Sounds/Ping.aiff;' | |
%x{#{play * 2}} | |
end | |
def run_timers(timers) | |
timers.each do |seconds, times| | |
times.to_i.times do |index| |
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/ruby | |
url = ARGV[0] | |
css_file = ARGV[1] | |
strip = ARGV[2] | |
File.open(css_file, 'r') do |f| | |
while line = f.gets do | |
match = line.match(/url\((.*?)\)/) | |
if match |
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
after "deploy", "deploy:notify_campfire" | |
after "deploy:migrations", "deploy:notify_campfire" | |
namespace :deploy do | |
desc 'notifies campfire room of deploy' | |
task :notify_campfire do | |
begin | |
require 'tinder' | |
rails_env = fetch(:rails_env, "production") |
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 'new_relic/recipes' | |
set :rails_env, RUBBER_ENV | |
on :load do | |
set :application, rubber_env.app_name | |
set :runner, rubber_env.app_user | |
set :deploy_to, "/mnt/#{application}-#{RUBBER_ENV}" | |
end |