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
# ALARM: production/master RED: stage YELLOW: next CYAN: everybody else | |
export PS1="\D{%H:%M:%S} \[\033[37m\]\u@\h\[\033[32m\]:\w \$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\\033[36m(\1)/' | sed -e 's/(production)/\\033[1;37m\\033[41m(production)\\033[m/' | sed -e 's/(master)/\\033[1;37m\\033[41m(master)\\033[m/' | sed -e 's/(stage)/\\033[31m(stage)/' | sed -e 's/(next)/\\033[33m(next)/')\[\033[37m\]\[\033[0m\] \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
;; Do civilized backup names. Added by dbrady 2003-03-07, taken from | |
;; http://emacswiki.wikiwikiweb.de/cgi-bin/wiki.pl?BackupDirectory | |
;; | |
;; Don't forget to mkdir ~/saves | |
(setq | |
backup-by-copying t ; don't clobber symlinks | |
backup-directory-alist | |
'(("." . "~/saves")) ; don't litter my fs tree | |
delete-old-versions t | |
kept-new-versions 6 |
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 score(dice) | |
(1..6).map {|i| (dice.count(i)/3) * i * 100 }.inject {|a,b| a+b} + (dice.count(1)/3) * 900 + (dice.count(1)%3)*100 + (dice.count(5)%3)*50 | |
end | |
# Wait, what? Back that shit up a minute. | |
# | |
# Reconsider the rules of Greed as follows: | |
# 1. Score each triple of value k as k*100. This gives a correct score for all triples EXCEPT 1's--we're 900 points short. | |
# 2. Add in a 900-point bonus for each triple of 1's | |
# 3. Add 100 points for each 1 NOT in a triple |
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
# Crush your website in 3 easy steps with TourBus! | |
# 1. get tourbus. Latest isn't in rubygems yet. | |
# If you don't have bundler, make sure you have the reqs. | |
git clone https://github.com/dbrady/tourbus.git && | |
cd tourbus && | |
bundle install && | |
gem build tourbus.gemspec && | |
gem install tourbus-2.0.0.gem |
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
source :rubygems | |
gem "rails", "2.2.2" | |
gem "rspec-rails", "1.1.12" | |
gem "rspec", "1.1.12" | |
gem "rspec-rails", "1.1.12" | |
gem "trollop", "1.12" | |
gem "utility_belt", "1.1.0" | |
gem "will_paginate", "2.3.14" | |
gem "wirble", "0.1.3" |
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
class ReportsController < ApplicationController | |
layout 'home' | |
def last_login | |
if current_user.can_view_login_report? | |
@execs = Acl.find(:all, :include => :user, :conditions => ["access_type='Airport' AND access_id=#{current_airport_id}"]).map { |a| a.user } | |
operators = Operator.find_all_by_airport_id(current_airport[:id]) | |
@opers = Acl.find(:all, :include => :user, :conditions => ["access_type='Operator' AND access_id IN (?)", operators]).map { |a| a.user } | |
stores = Store.find_all_by_airport_id(current_airport[:id]) | |
@vendors = Acl.find(:all, :include => :user, :conditions => ["access_type='Store' AND access_id IN (?)", stores]).map { |a| a.user } | |
@users = @execs + @opers + @vendors |
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
# We did a bundle install, and rails seems to install, but weirdness then happens... | |
# Note that it is in the path, but doesn't run, and gem list doesn't show it as installed. | |
# | |
# Halp? | |
12:40:13 dbrady@shinything:~/shiny_systems/1on1/ian ruby-1.9.2-p180@ian | |
∫ which rails | |
/Users/dbrady/.rvm/gems/ruby-1.9.2-p180@ian/bin/rails | |
12:40:36 dbrady@shinything:~/shiny_systems/1on1/ian ruby-1.9.2-p180@ian |
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 FIXED! TL;DR: Sprockets has a bug in betas 3, 4, and 5, roll back to beta 2. | |
# | |
# See: http://umwhatnow.com/rails-fix-your-3-1-beta-1-sprockets-problem/ | |
# | |
# Wots of wuv, Dave and Bwandon | |
∫ rails g devise_install | |
/Users/dbrady/.rvm/gems/ruby-1.9.2-p180@ian/gems/actionpack-3.1.0.beta1/lib/sprockets/railtie.rb:37:in `block (2 levels) in <class:Railtie>': undefined method `context' for #<Sprockets::Environment:0x0000010098f840> (NoMethodError) | |
from /Users/dbrady/.rvm/gems/ruby-1.9.2-p180@ian/gems/activesupport-3.1.0.beta1/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval' | |
from /Users/dbrady/.rvm/gems/ruby-1.9.2-p180@ian/gems/activesupport-3.1.0.beta1/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook' |
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 | |
unless RUBY_VERSION.start_with? "1.9" | |
puts "This test file is for Ruby 1.9.x" | |
exit -1 | |
end | |
require 'csv' | |
require 'test/unit' |
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
Transcript clear. | |
(1 to: 100) do: [ :i | (i \\ 15 = 0) | |
ifTrue: [Transcript show: 'FizzBuzz'] | |
ifFalse: [ | |
(i \\ 3 = 0) | |
ifTrue: [ Transcript show: 'Fizz'] | |
ifFalse: [ | |
(i \\ 5 = 0) | |
ifTrue: [ Transcript show: 'Buzz' ] | |
ifFalse: [Transcript show: i]. |