Skip to content

Instantly share code, notes, and snippets.

View abrkn's full-sized avatar

Andreas Brekken abrkn

View GitHub Profile
@abrkn
abrkn / index.js
Created November 4, 2014 18:51
requirebin sketch
// example using the raf module from npm. try changing some values!
var requestAnimationFrame = require("raf")
var canvas = document.createElement("canvas")
canvas.width = 500
canvas.height = 500
document.body.appendChild(canvas)
var context = canvas.getContext("2d")
CREATE SCHEMA core;
CREATE DOMAIN currency_id AS TEXT
CHECK (LENGTH(VALUE) > 0);
CREATE TABLE currency (
currency currency_id PRIMARY KEY
);
CREATE DOMAIN amount AS NUMERIC(20, 8)
CREATE SCHEMA core;
CREATE DOMAIN currency_id AS TEXT
CHECK (LENGTH(VALUE) > 0);
CREATE TABLE currency (
currency currency_id PRIMARY KEY
);
CREATE DOMAIN amount AS NUMERIC(20, 8)
@abrkn
abrkn / nfs-mount-boot2docker.sh
Last active August 29, 2015 14:17 — forked from sirkkalap/nfs-mount-boot2docker.sh
Use NFS for boot2docker
#!/usr/bin/env bash
############################################################################
#
# Use NFS for boot2docker
#
# See: https://quip.com/EDYLAAfuup5M (no login needed)
# See also: https://github.com/boot2docker/boot2docker/issues/587#issuecomment-66935011
# See also: http://support.apple.com/en-us/HT202243
# See also: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man5/exports.5.html
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
console.log('whoa!');
window.browserifiedCrypto = require('crypto');
console.log('coulda been worse');
},{"crypto":7}],2:[function(require,module,exports){
},{}],3:[function(require,module,exports){
/*!
@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",