Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
=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') |
Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
AUTHORIZATION : Bearer QkEAARgyi3MPFsmP8St6L2Yc07DkYKQRt5MNo/7caN75haGqDTFDNH/meyYIpKa19Qt1rw== | |
X_XC_MESSAGE_GUID : f72b7e90-f7ee-4964-901b-6e2427a7c680 | |
X_XC_PUBLISHER : TUQAAXOrYY3iyGbbL6IvNPGWJMaw4CrLBE7QTXIUFuJgo6gBIWPrCwOkXfhMLTbOJXAepw== | |
X_XC_SCHEMA_URI : https://ocl.xcommercecloud.com/marketplace/profile/deleted/1.0.0 | |
X_XC_SCHEMA_VERSION : 1.0.0 | |
X_XC_TENANT_ID : VEkAAalGt+ye8hDbMXeh8BAquNa72oifsoQNEtjQ9mTzZ8czA7M0+AcJQvDVVsN51DUgNw== |
class String | |
def to_bool | |
return true if self == true || self =~ (/(true|t|yes|y|1)$/i) | |
return false if self == false || self.blank? || self =~ (/(false|f|no|n|0)$/i) | |
raise ArgumentError.new("invalid value for Boolean: \"#{self}\"") | |
end | |
end |
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
I'm hunting for the best solution on how to handle keeping large sets of DB records "sorted" in a performant manner.
Most of us have work on projects at some point where we have needed to have ordered lists of objects. Whether it be a to-do list sorted by priority, or a list of documents that a user can sort in whatever order they want.
A traditional approach for this on a Rails project is to use something like the acts_as_list
gem, or something similar. These systems typically add some sort of "postion" or "sort order" column to each record, which is then used when querying out the records in a traditional order by position
SQL query.
This approach seems to work fine for smaller datasets, but can be hard to manage on large data sets with hundreds (or thousands) of records needing to be sorted. Changing the sort position of even a single object will require updating every single record in the database that is in the same sort group. This requires potentially thousands of wri
Makre sure your home directory does not have a space in it or gcc will crap itself
$ brew install git
{ | |
"IAB1": "Arts & Entertainment", | |
"IAB1-1": "Books & Literature", | |
"IAB1-2": "Celebrity Fan/Gossip", | |
"IAB1-3": "Fine Art", | |
"IAB1-4": "Humor", | |
"IAB1-5": "Movies", | |
"IAB1-6": "Music", | |
"IAB1-7": "Television", | |
"IAB2": "Automotive", |
What this guide will cover: the code you will need in order to include Redis and Resque in your Rails app, and the process of creating a background job with Resque.
What this guide will not cover: installing Ruby, Rails, or Redis.
Note: As of this writing I am still using Ruby 1.9.3p374, Rails 3.2.13, Redis 2.6.11, and Resque 1.24.1. I use SQLite in development and Postgres in production.
Background jobs are frustrating if you've never dealt with them before. Over the past few weeks I've had to incorporate Redis and Resque into my projects in various ways and every bit of progress I made was very painful. There are many 'gotchas' when it comes to background workers, and documentation tends to be outdated or scattered at best.