Note - reference these slides; good diagrams
##High traffic
- Bound by slowest API
- Potential redundant retrieval (popular search term)
###If I'm just sending JSON back and forth, why do I need Rails?
Rails is a rich HTTP abstraction, handles a lot for you
Read the HTTP spec
##ActionDispatch
###Middleware
Don't block the reactor loop
Use blocks as callbacks
Use async libraries
EM.start_server('0.0.0.0', 1337, ChatClient)
Instance variables keep state on a per Connection basis
fixture_file_upload
is a good way to simulate an uploaded file in tests. In Rspec, make sure to include ActionDispatch::TestSupport
Useful Rspec custom matcher to write: with_layout(layout)
assign(:variable, 'value')
in your specs
Anonymous controllers in tests for testing filters
Testing nested hashes
win = Ti.UI.createWindow() | |
wrapNorth = (y) -> | |
if y is 0 | |
36 | |
else | |
y - 1 | |
wrapSouth = (y) -> | |
if y is 36 |
LoadModule proxy_module | |
LoadModule proxy_balancer_module | |
<Proxy balancer://mycluster> | |
BalancerMember http://www.lessonplanet.com/ loadfactor=10 | |
BalancerMember http://beta.lessonplanet.com/ loadfactor=1 | |
ProxySet stickysession=_session_id | |
</Proxy> | |
ProxyPass / balancer://mycluster |
# Hash for each brand. | |
# Each key is an item of that brand, in a format like 'id:type:name'. | |
# Each value is a json string representing an array of user ids. | |
# For this query we would: | |
# iterate over each brand | |
# pull the the keys that match our type ('*jeans*') and | |
# get the user ids array for each brand of jeans. |