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
before "deploy", "db:dump" | |
before "deploy:migrations", "db:dump" | |
namespace :db do | |
task :backup_name, :roles => :db, :only => { :primary => true } do | |
now = Time.now | |
run "mkdir -p #{shared_path}/db_backups" | |
backup_time = [now.year,now.month,now.day,now.hour,now.min,now.sec].join('-') | |
set :backup_file, "#{shared_path}/db_backups/kotter-snapshot-#{backup_time}.sql" | |
end |
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
# authorization controller... the other controllers inherit from this | |
class TeachController < ApplicationController | |
before_filter :find_section | |
before_filter :instructor_required # don't forget to fill out more controller tests if this changes | |
layout "admin" | |
private | |
def instructor_required | |
(logged_in? && (current_user.admin? || @section.taught_by?(current_user))) || access_denied | |
end |
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
parse_git_dirty() { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
} | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e "/^[^*]/d" -e "s/* \(.*\)/(\1$(parse_git_dirty))/" | |
} | |
parse_svn_branch() { | |
svn info 2> /dev/null | grep URL | sed -e "s/.*\/\(.*\)$/(\1)/" | |
} | |
PS1="\n\ |
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' | |
require 'redis' | |
require 'base62' | |
r = Redis.new | |
start_time = Time.now | |
10.times do |i| | |
r.incr('url_count') | |
url_count = r['url_count'].to_i |
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 | |
# use this to install the same gems you have installed under one ruby in another | |
# run "gem list > ~/Desktop/gems.txt" | |
# run "ruby install_gems.rb ~/Desktop/gems.txt" | |
# You may have to change which ruby you use to run this so the gems get installed | |
# in the right place, for instance, using the REE ruby specifically while your server | |
# is running on another version... basically, think about what you're doing. | |
gems = IO.readlines(ARGV.first) | |
gems.map! do |g| |
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
# this is for multistage deployments... to deploy to staging, do "cap staging deploy" | |
# this is also set up for passenger deployments | |
# change stuff where it says CHANGEME | |
# set stage-specific stuff in the task named after the stage below | |
set :domain, "CHANGME" | |
role :web, domain | |
role :app, domain | |
role :db, domain, :primary => true |
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
def add_organizer(user) | |
raise ArgumentError unless user.is_a?(User) | |
part = participations.new | |
part.user = user | |
part.organizer = true | |
part.save! | |
end | |
def add_speaker(user) | |
raise ArgumentError unless user.is_a?(User) |
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
RULES | |
* Contest starts at exactly 1PM EST on Friday, February 27, 2009 | |
* Contest ends at exactly 5PM EST on Friday, February 27, 2009 | |
* THREE winners will receieve an unpurchase-able Tikaro Gearxel Nerd Merit Badge | |
* ONE winner will receive a QRCode patch from http://p8tch.com (John's other project) | |
You can see pictures here: | |
http://www.flickr.com/photos/tikaro/3181563185/ | |
HOW TO PLAY | |
* Take a picture that contains a Nerd Merit Badge somewhere in it, and post it |
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
parse_git_dirty() { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
} | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e "/^[^*]/d" -e "s/* \(.*\)/(\1$(parse_git_dirty))/" | |
} | |
parse_svn_branch() { | |
svn info 2> /dev/null | grep URL | sed -e "s/.*\/\(.*\)$/(\1)/" | |
} | |
PS1="\n\ |
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
$ rm -rf / | |
Permission Denied | |
$ sudo rm -rf / |