Skip to content

Instantly share code, notes, and snippets.

@timaschew
timaschew / gist:9110336
Created February 20, 2014 09:59
docpad stack trace for: TypeError: Cannot call method 'isDirectory' of null
info: Change detected at 10:56:21 delete /Users/awilhelm/dev/berlinjs.org/src/documents/talks/2014-02-20-My-title----.html.md
error: An error occured:
TypeError: Cannot call method 'isDirectory' of null
at _Class.changeHandler (/Users/awilhelm/dev/berlinjs.org/node_modules/docpad/out/lib/docpad.js:3600:61)
at _Class.EventEmitter.emit (events.js:106:17)
at _Class.bubble (/Users/awilhelm/dev/berlinjs.org/node_modules/docpad/node_modules/watchr/out/lib/watchr.js:177:19)
at _Class.bubble (/Users/awilhelm/dev/berlinjs.org/node_modules/docpad/node_modules/watchr/out/lib/watchr.js:4:61)
at _Class.watchr.children.(anonymous function).watch.listeners.change (/Users/awilhelm/dev/berlinjs.org/node_modules/docpad/node_modules/watchr/out/lib/watchr.js:490:36)
at _Class.EventEmitter.emit (events.js:106:17)
at _Class.bubble (/Users/awilhelm/dev/berlinjs.org/node_modules/docpad/node_modules/watchr/out/lib/watchr.js:177:19)
@timaschew
timaschew / js2coffee.org.js
Last active August 29, 2015 13:57
demo snippest of js2coffee talk at Berlin Node.js Meetup #3 - 2014-03-12 - try it out on http://js2coffee.org
// buggy when switch multiple times (js2coffee, coffee2js, js2coffee, ...)
foo = "bar"
// avoid the bug
main.foo = "bar";
// example for variable shadowing
var x = 0;
main.f = function(err, res) {
var x = 1;
};
@timaschew
timaschew / gist:10781665
Created April 15, 2014 22:05
server log of requested files for MIDI.js demo-Basic.html, server via python -m SimpleHTTPServer
ok (cached soundfont)
192.168.178.34 - - [15/Apr/2014 23:59:31] "GET /demo-Basic.html HTTP/1.1" 200 -
192.168.178.34 - - [15/Apr/2014 23:59:31] "GET /js/MIDI/AudioDetect.js HTTP/1.1" 200 -
192.168.178.34 - - [15/Apr/2014 23:59:31] "GET /js/MIDI/LoadPlugin.js HTTP/1.1" 200 -
192.168.178.34 - - [15/Apr/2014 23:59:31] "GET /js/MIDI/Plugin.js HTTP/1.1" 200 -
192.168.178.34 - - [15/Apr/2014 23:59:31] "GET /js/MIDI/Player.js HTTP/1.1" 200 -
192.168.178.34 - - [15/Apr/2014 23:59:31] "GET /js/Window/DOMLoader.XMLHttp.js HTTP/1.1" 200 -
192.168.178.34 - - [15/Apr/2014 23:59:31] "GET /inc/Base64.js HTTP/1.1" 200 -
192.168.178.34 - - [15/Apr/2014 23:59:31] "GET /inc/base64binary.js HTTP/1.1" 200 -
@timaschew
timaschew / test.coffee
Created May 5, 2014 13:29
how to mix $or and $and with QueryEngine? (http://bevry.me/queryengine/guide)
# query blog items and main nav items
# this doesn't work, I only get the blog items
findFullNav: (lang) ->
@getDatabase().findAllLive
$or:
$and:
mainNav: {$exists: true}
relativeOutDirPath:
$startsWith: lang
@timaschew
timaschew / palindrome-check-test.coffee
Created July 3, 2014 12:10
edge case tests for a palindrom checker, can you implement it?
describe 'palindrome checker', ->
it 'should work for unicode characters (chinese)', (done) ->
expect(palindromChecka "楚人楚").to.equal true
done()
# http://apps.timwhitlock.info/emoji/tables/unicode
it 'should work with 3 byte unicode chars (emoji, unicode)', (done) ->
expect(palindromChecka "\u2764").to.equal true
done()
@timaschew
timaschew / test 𝄞
Last active August 29, 2015 14:04
3 bytes unicode character doesn't work in gist comments: 𝄞
𝄞
//from http://de.wikipedia.org/wiki/Utf8#Kodierung
Char Unicode Unicode binary UTF-8 binary UTF-8 hex
Violinschlüssel 𝄞 U+1D11E 00000001 11010001 00011110 11110000 10011101 10000100 10011110 F0 9D 84 9E
var createManifest = require('component-manifest')(this);
debugger;
var manifestGenerator = createManifest();
var tmp = manifestGenerator(localBranch);
while (tmp.done === false) {
tmp = tmp.next();
}
var manifest = tmp.value;
@timaschew
timaschew / locals.js
Last active August 29, 2015 14:15
loop over an array via a mixin
{
externalArray: [
{id: 1, name: "foo"},
{id: 2, name: "bar"},
{id: 3, name: "qux"}
]
}
@timaschew
timaschew / list.txt
Last active August 29, 2015 14:15
npm packages, starting with component-
component-bind function binding utility
component-boilerplat... Boilerplate for Component and Express
component-boilerplat... Boilerplate for Component and Koa
component-build main logic for component's build command
component-builder builder for component
component-builder-ww... Component building middleware
component-builder2 builder for component
component-bundler bundlers and bundling guide for component
component-cdn CDN for Component
component-classes Cross-browser element class list
@timaschew
timaschew / index.js
Last active August 29, 2015 14:25
requirebin sketch
// require() some stuff from npm (like you were using browserify)
// and then hit Run Code to run it on the right
var lunr = require('lunr');
var idx = lunr(function () {
this.field('title', { boost: 10 })
this.field('body')
})
var doc = {
"title": "Twelfth-Night",