Skip to content

Instantly share code, notes, and snippets.

View abrkn's full-sized avatar

Andreas Brekken abrkn

View GitHub Profile
@abrkn
abrkn / gist:1869253
Created February 20, 2012 13:43
Ray tracer?
internal void RenderParallel(Scene scene, CancellationToken cancellationToken)
{
int[] rgb = new int[screenWidth * screenHeight];
var pixelsQuery =
from y in
Enumerable.Range(0, screenHeight).AsParallel()
.WithCancellation(cancellationToken)
let recenterY = -(y - (screenHeight / 2.0)) / (2.0 * screenHeight)
select from x in Enumerable.Range(0, screenWidth)
PS C:\users\andy\git\striim> ls
Directory: C:\users\andy\git\striim
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 11.05.2012 14:54 docs
d---- 13.05.2012 13:56 lib
var process = require('process');
module.exports = function(capacity) {
var semaphore = {
capacity: capacity,
current: 0,
queue: [],
acquire: function(task) {
if (semaphore.current == semaphore.capacity) {
return queue.push(task);
Error: Cannot find module 'html'
at Function._resolveFilename (module.js:332:11)
at Function._load (module.js:279:25)
at Module.require (module.js:354:17)
at require (module.js:370:17)
at View.templateEngine (C:\users\andy\git\striim\lib\escaped-server\node_modules\phantom\node_modules\express\li
ew\view.js:134:38)
at Function.compile (C:\users\andy\git\striim\lib\escaped-server\node_modules\phantom\node_modules\express\lib\v
js:68:17)
at ServerResponse._render (C:\users\andy\git\striim\lib\escaped-server\node_modules\phantom\node_modules\express
Shows:
{
"_id" : "tt0108778",
"airDate" : "1996-01-07",
"cover" : "0a78f3d53bb9124930b677c6f3a522cc",
"crawledAt" : ISODate("2012-05-07T11:31:16.133Z"),
"episodesCrawledAt" : ISODate("2012-05-07T11:31:23.411Z"),
"imdb" : "tt0108778",
"keywords" : [
"friends",
var async = require('async');
module.exports = function(config) {
var group = {
name: 'Search Indexer',
tasks: []
};
group.tasks.push(task = {
group: group.name,
describe('post /impressions/add', function() {
it('succeeds', function() {
var inputs = {
link: 'link' + Math.floor(Math.random() * 1000),
user: 'user' + Math.floor(Math.random() * 1000),
seconds: Math.floor(Math.random() * 1000)
};
var impressionsStub = sinon.stub(impressions, 'add', function(db, user, link, facts, callback) {
debug('stub add called');
@abrkn
abrkn / gist:2864350
Created June 3, 2012 17:49
Mocha + Sinon + Expect.js
describe('addHandler', function() {
it('parses request and calls api', function() {
var values = {
link: 'link' + Math.floor(Math.random() * 1000),
user: 'user' + Math.floor(Math.random() * 1000),
seconds: Math.floor(Math.random() * 1000)
};
// setup
var impressionsMock = sinon.mock(impressions);
[root@vidlink ~/apps/striim]# npm install -g forever
npm http GET https://registry.npmjs.org/forever
npm http 304 https://registry.npmjs.org/forever
npm http GET https://registry.npmjs.org/broadway
npm http GET https://registry.npmjs.org/cliff
npm http GET https://github.com/AvianFlu/daemon.node/tarball/master
npm http GET https://registry.npmjs.org/flatiron
npm http GET https://registry.npmjs.org/microtime
npm http GET https://registry.npmjs.org/nconf
npm http GET https://registry.npmjs.org/nssocket
info it worked if it ends with ok
verbose cli [ 'node', '/usr/bin/npm', 'install', '-g', 'daemon' ]
info using [email protected]
info using [email protected]
verbose /usr/local/bin/node node symlink
verbose config file /root/.npmrc
verbose config file /usr/local/etc/npmrc
verbose config file /usr/share/npm/npmrc
silly exec /usr/local/bin/node "/usr/share/npm/bin/npm-get-uid-gid.js" "nobody" 0
silly spawning [ '/usr/local/bin/node',