Skip to content

Instantly share code, notes, and snippets.

module.exports = function (app, bundle) {
app.get('/multi/:bundle', get(bundle));
};
function get(something){
//Is 'something' the :bundle or the (app, bundle) parameter?
}
@danfinlay
danfinlay / gist:6178063
Created August 7, 2013 20:07
My new approach to fetching README data for requirebin. Is the package.json getting cached?
function fetchReadme(bundleName, preferredVersions){
sandbox.bundle(bundleName, preferredVersions)
.on('bundleEnd', function(html){
//The HTML isn't what I wanted here, I want the full package.json,
//which Browserify CDN is already supplying.
//I'm having trouble tracking down where in browser-module-sandbox or browser-module-cache this is stored, if at all.
//Tips?
})
@danfinlay
danfinlay / gist:6179542
Created August 7, 2013 22:39
When running this function requesting "voxel-hello-world" I'm getting a strange error: ReferenceError: Can't find variable: voxel This is both strange because
function fetchBundle(bundleName, preferredVersions, cb){
var er = sandbox.bundle(bundleName, null)
sandbox.on('bundleEnd', function(html){
//Just to test, this IS returning bundle HTML, so I seem to be calling sandbox.bundle() correctly.
})
@danfinlay
danfinlay / gist:6259778
Created August 18, 2013 03:35
How does one use trumpet to inject a series of individual files into a page? I feel like the asynchronous nature of streams means these extensions may be loaded unreliably, is there a more correct way?
fs.createServer(function(req, res){
var extensionTrumpet = trumpet();
extensionTrumpet.selectAll('#frameInitScript', function(elem){
var writeOutStream = elem.createWriteStream();
for(var i = 0; i < extensions.length; i++){
fs.createReadStream(__dirname + '/../site/blocks/'+extensions[i]+'.js').pipe(writeOutStream);
}
});
@danfinlay
danfinlay / README.md
Last active December 21, 2015 21:48 — forked from domenic/README.md

The scenario:

  • We are writing a digital textbook-reading app.
  • Most of the time you have a "basic" license for your textbook, but one (and only one) of your computers can request an "enhanced" license.
  • You can only print from the computer with the enhanced license.

The problem statement:

@danfinlay
danfinlay / gist:6590678
Created September 17, 2013 06:17
A couple node-warrior tools to be used with a voxel-code gun.
///Wavy cloud generator
for(var x = -20; x < 20; x++){
for(var z = -20; z < 20; z++){
setBlock([x, Math.sin(x*0.1)+Math.cos(z*0.1)+50, z], 3);
}
}
///Wavy cloud generator2
for(var x = -20; x < 20; x++){
for(var z = -20; z < 20; z++){
@danfinlay
danfinlay / How to download streaming video.md
Last active December 21, 2025 20:28
How to download a streaming video with Google Chrome

How to download streaming video

Streaming just means a download that they don't want you to keep. But Chrome's developer tools make it easy to access what's really going on under the hood.

Open Developer Tools

From the page where you want to download some things, go into your chrome menu to open the developer tools. You can either:

1.  (On a mac): Command-option-J
2. (On a PC): Control-alt-J
@danfinlay
danfinlay / index.js
Created January 6, 2014 22:35
Mysterious problem is preventing me from installing this module globally.
var appController = require('./appController');
//#!/usr/bin/env node
@danfinlay
danfinlay / gist:8291455
Created January 6, 2014 22:59
My call stack that is thrown from my error after npm i -g'ing my module.
module.js:340
throw err;
^
Error: Cannot find module 'charm'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/usr/local/lib/node_modules/mrssysadmin/lib/terminal-menu/index.js:1:81)
at Module._compile (module.js:456:26)
@danfinlay
danfinlay / gist:8291517
Last active January 2, 2016 10:39
npm config ls output
; cli configs
registry = "https://registry.npmjs.org/"
; userconfig /Users/danielfinlay/.npmrc
cwd = "/usr/lib"
; node bin location = /usr/local/bin/node
; cwd = /Users/danielfinlay/Documents/Development/mrssysadmin
; HOME = /Users/danielfinlay
; 'npm config ls -l' to show all defaults.