Skip to content

Instantly share code, notes, and snippets.

View pmuellr's full-sized avatar
🌀
Software developer @ Elastic working on Kibana. Previously @ NodeSource, IBM.

Patrick Mueller pmuellr

🌀
Software developer @ Elastic working on Kibana. Previously @ NodeSource, IBM.
View GitHub Profile
@pmuellr
pmuellr / easter-egg.txt
Created May 23, 2014 20:53
npm easter egg
38 38 40 40 37 39 37 39 66 65 13
cu cu cd cd cl cr cl cr b a en
@pmuellr
pmuellr / 2014-07-24 Oneonta Gorge.json
Created July 25, 2014 06:59
2014-07-24 Oneonta Gorge hike
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pmuellr
pmuellr / addServerRoute.js
Last active August 29, 2015 14:05
gists for blog post on Server Sent Events
server.route({
method: "GET",
path: "/events",
handler: onEventsRequest
})
@pmuellr
pmuellr / cfenv-creds-after.js
Last active August 29, 2015 14:06
example server start with cfenv
var creds = appEnv.getServiceCreds(/foo/)
if (creds) {
doSomethingWith(creds.blah)
}
function diskToC(id) {
//for each EML file we find
var file = id + ".eml"
var parser = new MailParser()
parser.on("end", onParserEnd)
fs.createReadStream(file).pipe(parser)
//------------------------------------
@pmuellr
pmuellr / .blog-cf-secrets.md
Last active August 29, 2015 14:06
gists for blog post on cf secrets

gists for a blog post

@pmuellr
pmuellr / node-red-flow-hosty
Created November 21, 2014 16:12
node-red flow for host-name-based web site
[
{
"id": "21109fb8.deef6",
"type": "http in",
"name": "",
"url": "/",
"method": "get",
"x": 124,
"y": 60,
"z": "4552fd9f.baad04",
@pmuellr
pmuellr / example-a.js
Created January 9, 2015 14:41
example of flattening a JavaScript callback pyramid using "named inner functions"; example-a is the typical pyramid of doom; example-b is the named inner function version
var fs = require("fs")
fs.readFile(__filename, {encoding:"utf8"}, function(err, content){
if (err) throw err
removeBraces(content, function(err, fixedContent){
if (err) throw err
writeContent(fixedContent, function(err){
if (err) throw err
@pmuellr
pmuellr / cson-test.js
Last active August 29, 2015 14:13
es6 template string function to expand CoffeeScript object notation to JS objects - run with io.js
var coffee = require("coffee-script")
var x = cson`
a: 1
b: 2
`
console.log(x)
// prints: { a: 1, b: 2 }
console.log(cson`
@pmuellr
pmuellr / apl-template-strings.js
Created January 16, 2015 05:38
es6 template strings for APL
// es6 template strings for APL
// npm install apl
"use strict"
// from: https://github.com/ngn/apl/blob/master/examples/1-mult.apl
// note: http://s.mlkshk-cdn.com/r/97VP
apl`
⍝ Multiplication table