Skip to content

Instantly share code, notes, and snippets.

Avatar

Andreas Brekken abrkn

View GitHub Profile
View gist:1869253
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)
View gist:2688059
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
View gist:2688939
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);
View gist:2692366
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
View gist:2694037
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",
View gist:2711252
var async = require('async');
module.exports = function(config) {
var group = {
name: 'Search Indexer',
tasks: []
};
group.tasks.push(task = {
group: group.name,
View gist:2864160
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 Jun 3, 2012
Mocha + Sinon + Expect.js
View gist:2864350
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);
View gist:2880693
[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
View gist:2880697
info it worked if it ends with ok
verbose cli [ 'node', '/usr/bin/npm', 'install', '-g', 'daemon' ]
info using npm@1.1.4
info using node@v0.6.17
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',