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
# To Audit Foo model, create a model called Foo::BarLog with a foreign key of bar_id and include this concern | |
module Auditable | |
extend ActiveSupport::Concern | |
included do | |
after_save :audit | |
has_many :audits, class_name: "#{self}Log" | |
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
# To audit Foo model, create a model called FooLog and include this concern | |
module Auditable | |
extend ActiveSupport::Concern | |
included do | |
after_save :audit | |
end | |
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
Assignments for 9-7-12 (as of Sep 6 17:20 2012 eastern time) | |
Field 1 - 3: Staff name, unique ID, backup ID | |
Field 4 - 6: Assignment name (in quotes), unique ID, backup ID | |
Field 7 - 8: Date and time of assignment (GMTO=-5 1) | |
Field 9 -14: Staff type, Pager, Tel, Email, Messagable, Shift note | |
"Mars Rover",249,2,"Call",251,7,9-7-12,0715,1900,"MD","2244","","[email protected]",1,"" | |
"Venus Moon",257,4,"Backup",252,8,9-7-12,1900,0700,"ML","9999","","[email protected]",1,"" | |
"Doximity Tester",353,20,"Phones",332,9,9-7-12,0745,1800,"Dox","[email protected]","","[email protected]",1,"" |
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
#[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" | |
eval "$(rbenv init -)" | |
alias json='python -mjson.tool | pygmentize -f terminal256 -l javascript -O style=native' | |
export NODE_PATH=/usr/local/lib/node_modules |
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
[28] pry(main)> ::ActiveSupport::TimeZone[-5].name | |
=> "America/New_York" | |
[29] pry(main)> Time.now.in_time_zone("America/New_York") | |
=> Mon, 23 Jul 2012 14:19:39 EDT -04:00 | |
[30] pry(main)> Time.now.in_time_zone(-5) | |
=> Mon, 23 Jul 2012 14:22:37 EDT -04:00 |
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
-if @item.errors.any? | |
#error_explanation | |
%h2= "#{pluralize(@item.errors.count, "error")} prohibited this item from being saved:" | |
%ul | |
- @item.errors.full_messages.each do |msg| | |
%li= msg |
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
/* http://webdesign.tutsplus.com/tutorials/htmlcss-tutorials/quick-tip-encourage-responsive-form-elements-to-play-nice/ */ | |
input[type='text'], | |
textarea { | |
box-sizing: border-box; | |
-moz-box-sizing: border-box; | |
-webkit-box-sizing: border-box; | |
} |
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
response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate" | |
response.headers["Pragma"] = "no-cache" | |
response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT" |
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
ActiveRecord::Base.logger = Logger.new(STDOUT) if defined? Rails::Console |
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 | |
def toggle(i) | |
i == 0 ? 1 :0 | |
end | |
# turn on every bulb | |
bulbs = Array.new 100, 1 | |
# Turn off every x bulb |