For educational reasons I've decided to create my own CA. Here is what I learned.
Lets get some context first.
| // everyone's new favorite closure pattern: | |
| (function(window,document,undefined){ ... })(this,this.document); | |
| // when minified: | |
| (function(w,d,u){ ... })(this,this.document); | |
| // which means all uses of window/document/undefined inside the closure | |
| // will be single-lettered, so big gains in minification. | |
| // it also will speed up scope chain traversal a tiny tiny little bit. |
| function Promise() { | |
| var callbacks = [], | |
| promise = { | |
| resolve: resolve, | |
| reject: reject, | |
| then: then, | |
| safe: { | |
| then: function safeThen(resolve, reject) { | |
| promise.then(resolve, reject); | |
| } |
| # Optimized for writes, sort on read | |
| # LVC | |
| redis.hset("bonds|1", "bid_price", 96.01) | |
| redis.hset("bonds|1", "ask_price", 97.53) | |
| redis.hset("bonds|2", "bid_price", 95.50) | |
| redis.hset("bonds|2", "ask_price", 98.25) | |
| redis.sadd("bond_ids", 1) | |
| redis.sadd("bond_ids", 2) |
| # MOTIVATION: As rails apps are growing, people are noticing the drawbacks | |
| # of the ActiveRecord pattern. Several apps I have seen, and several | |
| # developers I have spoken to are looking towards other patterns for object | |
| # persistence. The major drawback with ActiveRecord is that the notion | |
| # of the domain object is conflated with what it means to store/retrieve | |
| # it in any given format (like sql, json, key/value, etc). | |
| # | |
| # This is an attempt to codify the Repository pattern in a way that would | |
| # feel comfortable to beginner and seasoned Ruby developers alike. | |
| # |
| upstream backend { | |
| server 127.0.0.1:3000; | |
| } | |
| server { | |
| listen 80; | |
| access_log /var/log/nginx/yoursite.access.log; | |
| error_log /var/log/nginx/yoursite.error.log; |
| #!/bin/bash | |
| contents=`ls` | |
| module_names=() | |
| module_folders=() | |
| npm_root=$(npm root -g) | |
| do_pull=1 | |
| do_npm_install=1 | |
| do_npm_link=1 |
| module.exports = function(connection){ | |
| return { | |
| thumb: function(doc){ | |
| if(doc.thumbnails) return; | |
| var Thumbnal = connection.model('Thumbnail'); | |
| Thumbnail.generate(doc.url, function(err, thumb){ | |
| doc.thumbnails = thumb; | |
| doc.save() | |
| }); |