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
previous_matches_collection = [{"start_time"=>1597093971.496, "item_id"=>1302, "start_time_range"=>1597093969.996..1597093972.996}, {"start_time"=>1597093971.576, "item_id"=>1302, "start_time_range"=>1597093970.076..1597093973.076}, {"start_time"=>1597093991.856, "item_id"=>1230, "start_time_range"=>1597093990.356..1597093993.356}, {"start_time"=>1597093971.336, "item_id"=>1086, "start_time_range"=>1597093969.836..1597093972.836}, {"start_time"=>1597093971.416, "item_id"=>1086, "start_time_range"=>1597093969.916..1597093972.916}, {"start_time"=>1597093987.616, "item_id"=>926, "start_time_range"=>1597093986.116..1597093989.116}, {"start_time"=>1597093988.096, "item_id"=>926, "start_time_range"=>1597093986.596..1597093989.596}, {"start_time"=>1597093988.576, "item_id"=>926, "start_time_range"=>1597093987.076..1597093990.076}, {"start_time"=>1597093974.016, "item_id"=>893, "start_time_range"=>1597093972.516..1597093975.516}, {"start_time"=>1597093971.256, "item_id"=>527, "start_time_range"=>1597093969.756..15970 |
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
{ | |
"ensure_newline_at_eof_on_save": true, # good for git | |
"folder_exclude_patterns": | |
[ | |
".svn", | |
".git", | |
".hg", | |
"CVS", | |
".sass-cache", | |
"log", |
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
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |
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
exceptions = [] | |
ObjectSpace.each_object(Class) {|k| exceptions << k if k.ancestors.include?(Exception) } | |
puts exceptions.sort { |a,b| a.to_s <=> b.to_s }.join("\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
IOS_DEVICES = { | |
'iPhone1,1' => 'iPhone 1G', | |
'iPhone1,2' => 'iPhone 3G', | |
'iPhone2,1' => 'iPhone 3GS', | |
'iPhone3,1' => 'iPhone 4', | |
'iPhone3,3' => 'iPhone 4 (Verizon)', | |
'iPhone4,1' => 'iPhone 4S', | |
'iPhone5,1' => 'iPhone 5 (GSM)', | |
'iPhone5,2' => 'iPhone 5 (GSM+CDMA)', | |
'iPhone5,3' => 'iPhone 5C (GSM)', |
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
@db = CouchRest.database("http://127.0.0.1:5984/couchrest-test") | |
# setup an new record, missing the key | |
response = @db.save_doc({:key => 'value', 'another key' => 'another value'}) | |
# and retrieve it | |
doc = @db.get(response['id']) | |
# merge new key! | |
doc.merge!({'new key' => 'foo'}) | |
# => {"_id"=>"f5f855649ac666c35a8027f16c21330b", "_rev"=>"2-007fe4639675067edd9a590cf0a170d5", "key"=>"value", "another key"=>"another value", "new key"=>"foo"} | |
doc |
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
Prototype jQuery/Javascript | |
in controller in JS/ERb view (xxxxxx.js.erb) | |
--------- ----------------- | |
page.alert "message" alert('message'); | |
page.hide "id" $('#id').hide(); | |
page.insert_html \ | |
:top, "id", "content" $('#id').prepend('content'); | |
:bottom, "id", "content" $('#id').append('content'); | |
:before, "id", "content" $('#id').before('content'); | |
:after, "id", "content" $('#id').after('content'); |
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
//<![CDATA[ | |
new Ajax.Request('/m/finance/recurring_voucher_payments/user_voucher_info?user_data='+value.id, { | |
method:'get', | |
onComplete: function(transport){ | |
var r = transport.responseText.evalJSON(); | |
element.up().down('user_voucher_id').innerHTML = <%= options_for_select("r.user_vouchers") %>; | |
} | |
}); | |
//]]> |
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
find ./ -name \*.rhtml -type f | sed 's/\(.*\).rhtml$/mv "&" "\1.html.erb"/' | sh |
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 user_resources(compact = false) | |
x = [] | |
x << Resource.all(:conditions => {:resource_for_type => "All"}) | |
x << self.branch.resources | |
x << self.branch.area.resources | |
x << self.branch.zone.resources | |
#we then need the resources to which each of their roles has been assigned | |
for role_assignment in self.current_role_assignments |
NewerOlder