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 CoolingOffManager < Disposable::Twin | |
property :cooled_off_at | |
def skip | |
set_timestamp(Time.at 0) | |
end | |
def finish | |
set_timestamp(Time.current) | |
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
~/work/peerstreet $ ll app/ | |
total 4.0K | |
drwxr-xr-x+ 6 jk admin 204 Apr 18 10:11 assets/ | |
drwxr-xr-x+ 5 jk admin 170 Aug 13 16:43 attributes/ | |
drwxr-xr-x+ 3 jk admin 102 Jul 9 16:50 caches/ | |
drwxr-xr-x+ 11 jk admin 374 Sep 23 16:38 cells/ | |
drwxr-xr-x+ 7 jk admin 238 Sep 14 16:41 clients/ | |
drwxr-xr-x+ 27 jk admin 918 Sep 29 10:55 controllers/ | |
drwxr-xr-x+ 3 jk admin 102 Feb 16 2015 datatables/ | |
drwxr-xr-x+ 4 jk admin 136 Sep 23 16:38 decorators/ |
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
function RM() { | |
killall -m "spring .* \| $(basename $1) \|"; | |
rm -rf $1; | |
} |
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
09:30:19 ~/work/r30 $ rails c | |
Loading development environment (Rails 3.0.20) | |
irb(main):001:0> nil.try :foo | |
=> 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 Car | |
has_many :cross_sections, as: :collectible | |
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
# in seeds/foo.rb | |
class Seeds | |
class Foo | |
def self.call | |
::Foo.create! NAMES.map{|n| { name: n } } | |
end | |
end | |
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
class HandshakeOrderItem < ActiveRecord::Base | |
establish_connection 'production_hs' | |
require 'open-uri' | |
def self.parameter_for_query_string | |
today_start_of_day = DateTime.now.in_time_zone("Eastern Time (US & Canada)").beginning_of_day# - 86400 | |
parameter = today_start_of_day.strftime("%Y%m%dT%H:%M:%S") | |
puts "started for #{today_start_of_day}" | |
puts "parameter prepared for query string - #{parameter}" | |
parameter |
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
[14] pry(main)> def foo; "ACK!"; end | |
=> :foo | |
[15] pry(main)> "".foo | |
=> "ACK!" | |
[16] pry(main)> nil.foo | |
=> "ACK!" | |
[17] pry(main)> |
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
= simple_form_for model do |f| | |
= f.error_notification | |
.form-inputs | |
= f.input :name | |
.form-actions | |
= f.button :submit |
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 MyThing < ActiveRecord::Migration | |
def create_table table_name, options={} | |
super table_name, options.merge(primary_key: :not_id) | |
end | |
end | |