Setup:
$ mongo
> use pubsub
> db.createCollection('messages', { capped: true, size: 100000 })
> db.messages.insert({})
# Redis configuration file example | |
# Note on units: when memory size is needed, it is possible to specifiy | |
# it in the usual form of 1k 5GB 4M and so forth: | |
# | |
# 1k => 1000 bytes | |
# 1kb => 1024 bytes | |
# 1m => 1000000 bytes | |
# 1mb => 1024*1024 bytes | |
# 1g => 1000000000 bytes |
return View.extend({ | |
initialize: function () { | |
this.el.attr("draggable", "true") | |
this.el.bind("dragstart", _.bind(this._dragStartEvent, this)) | |
}, | |
_dragStartEvent: function (e) { | |
var data | |
if (e.originalEvent) e = e.originalEvent | |
e.dataTransfer.effectAllowed = "copy" // default to copy |
// Server-side | |
app.get('/keyword/search', | |
function (req, res, next) { | |
var query = new RegExp('^' + req.query.q + '.*$', 'i'); | |
var result = []; | |
mongodb.keywords.find( | |
{ word: query }, [ 'word' ], { limit: 5 }, | |
function (err, keywords) { | |
keywords.forEach(function (k) { | |
result.push(k.word); |
// node: | |
var moment = require('moment'); | |
moment().add('days', 2).fromNow(); | |
// 'in 2 days' | |
moment().subtract('days', 2).fromNow(); | |
// '2 days ago' | |
moment('November 1977').fromNow() |
function scoreboardProjection(frame_offset) { | |
if (frame_offset == null) frame_offset = 0; | |
var canvas, proj; | |
var score_img_1, | |
score_img_2, | |
overlay, | |
board_canvas, | |
score_canvas_1, | |
score_canvas_2; |
var cluster = require('cluster'); | |
var http = require('http'); | |
var numCPUs = require('os').cpus().length; | |
if (cluster.isMaster) { | |
// Fork workers. | |
for (var i = 0; i < numCPUs; i++) { | |
cluster.fork(); | |
} | |
cluster.on('exit', function(worker, code, signal) { |
http { | |
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:8m max_size=3000m inactive=600m; | |
proxy_temp_path /var/tmp; | |
include mime.types; | |
default_type application/octet-stream; | |
sendfile on; | |
keepalive_timeout 65; | |
gzip on; | |
gzip_comp_level 6; |
Recent releases have been pre-built using cross-compilers and this script and are downloadable below.
If you have found these packages useful, give me a shout out on twitter: @adammw
// This code is modified from the working version to remove coupling with the original | |
// application, and hasn't been tested in its new form. So, it's enough to give you | |
// the basic idea, but may not entirely work ;) | |
// | |
// It assumes the src image is in HSV and the dst image is grayscale. | |
// | |
// CvScalar red = cvScalar(179, 255, 255); | |
// CvScalar lowOffset = cvScalar(-20, -150, -150); // find colors down to h = 159, s = 105, v = 105 | |
// CvScalar highOffset = cvScalar(20, 0, 0); // find colors up to h = 19, s = 255, v = 255 (h wraps/is mod 179) | |
// colorThreshold(img, thresholded, red, lowOffset, highOffset); |