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
}else if(this.options.position.length){ | |
if(typeof(this.options.position[1]) == 'string') { | |
var topFinal = this.options.position[1]; | |
} else { | |
var top = $value(this.options.position[1]) + $value(this.options.offsetTop); | |
var topFinal = (container_dimensions.height <= viewport_dimensions.height) ? (this.options.constrainToViewport ? Math.max(0,Math.min(viewport_dimensions.height - (container_dimensions.height),top)) : top) + 'px' : 0; | |
} | |
if(typeof(this.options.position[0]) == 'string') { | |
var leftFinal = this.options.position[0]; | |
} else { |
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
Model.first.attributes.each{|k,v| puts "\s\s#{k} { #{v} }"}; nil |
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 User < ActiveRecord::Base | |
scope :order, lambda{|params| | |
return if params.nil? | |
order = [] | |
params.split(/\|/).each do |param| | |
order << param.gsub(/_asc/, ' ASC').gsub(/_desc/, ' DESC') | |
end | |
{:order => order.join(' ,')} | |
} | |
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
[0, 4, 3, 2, 1].each do |order| | |
score = scores.fetch(order) |
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 self.noisy(str) | |
pid, stdin, stdout, stderr = Open4.popen4 str | |
puts "running #{str}\n" | |
# puts "Status: #{status.exitstatus}" | |
# puts "#{pid} done" | |
msg =<<-"EOF" |
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
# deploy from sha1 | |
IO.popen("git rev-parse HEAD").read.gsub(/\W/,'') | |
# deploy from branch name | |
IO.popen("git rev-parse --abbrev-ref HEAD").read.gsub(/\s/,'') |
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
group :test do | |
gem 'guard' | |
gem 'guard-rspec' | |
if RUBY_PLATFORM =~ /linux/ | |
gem 'rb-inotify' | |
gem 'libnotify' | |
end | |
if RUBY_PLATFORM =~ /darwin/ |
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_save :remove_erroneous_record | |
def remove_erroneous_record | |
self.destroy if created_in_error? | |
end | |
def created_in_error? | |
referral_outcome == "Created in Error" | |
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
# Run using $ rails new [appname] -JT -m new.rb | |
# GEMS | |
gem 'rails', '3.0.3' | |
gem 'compass', '0.10.6' | |
gem 'devise', '1.1.5' | |
gem 'cancan', '1.4.1' | |
# unversioned gems |
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
# Postgres backup script | |
# mynameisrufus | |
# | |
# Cron tab examples: | |
# | |
# daily keeping the last 5 days (run at 1:00AM, 2 minutes after the hour) | |
# | |
# 02 1 * * * postgres /script/db_backup.sh daily /var/backups/db $DATABASE_OWNER 5 >> /var/backups/db/backup.log 2>&1 | |
# | |
# |
OlderNewer