Skip to content

Instantly share code, notes, and snippets.

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 / atom-styles.less
Created Apr 28, 2017
some personal style settings for Atom that do some fun stuff
View atom-styles.less
/* your personal stylesheet */
atom-text-editor {
/* comments are white on green */
.syntax--definition.syntax--comment,
.syntax--comment.syntax--line,
.syntax--comment.syntax--block {
background-color: green;
color: white;
}
@pmuellr
pmuellr / nsolid-profile-at-startup.js
Created Feb 13, 2017
run an N|Solid profile on your startup code
View nsolid-profile-at-startup.js
'use strict'
// Use this module as in the following command, to profile the startup code:
// nsolid --require ./profile-at-startup nsolid-storage
const path = require('path')
const program = path.basename(__filename).replace(/\.js$/, '')
let nsolid
@pmuellr
pmuellr / nsolid-cpu-profile-graphs.md
Last active Feb 7, 2017
N|Solid CPU profile visualizations
View nsolid-cpu-profile-graphs.md

N|Solid CPU profile visualizations

Just noticed the following blog post from Brendan Gregg:

Flame Graphs vs Tree Maps vs Sunburst

Neat! Since it turns out the NodeSource N|Solid CPU profile displays those three visualizations.

You can find out more about generating CPU profiles for your Node.js apps using N|Solid by reading the documentation. But also read Brendan's blog above for some rationale on the different views.

@pmuellr
pmuellr / test-same-inner-function-listeners.js
Created Feb 2, 2017
test if the function passed to ee.on() and ee.removeListener() can validly be "inner functions"
View test-same-inner-function-listeners.js
'use strict'
// Not sure how valid this test is, but the attempt is to try to see if
// the function passed to ee.on() and ee.removeListener() can validly be
// "inner functions". Specifically, does the ee class consider `onEmitted()`
// functions to be different based on their closure. You would hope yes, and
// I think that's what the test shows.
//
// If they weren't considered different, instead of the listener list shrinking
// from both ends, it would shrink from just one end.
@pmuellr
pmuellr / moar-promises.js
Created Nov 18, 2016
moar playing around with promises and callbacks
View moar-promises.js
'use strict'
const fs = require('fs')
// some tests
class Tests {
// a test
test_1 (testName, done) {
const p1 = getPromiseResolves(1)
@pmuellr
pmuellr / generators-as-streams.js
Last active Aug 26, 2016
pull-stream examples, but using generators
View generators-as-streams.js
'use strict'
// some examples from https://pull-stream.github.io/ , but using generators
// function that generates random numbers forever; a source
function * random () {
while (true) {
yield Math.random()
}
}
View npm3-packages.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View influx-cq-downgrade-tag2field.sh
#!/usr/bin/env bash
DB=cq_tags_2_string_fields
INFLUX="influx -database $DB -execute"
echo "dropping / creating the DB:"
echo ""
$INFLUX "DROP DATABASE IF EXISTS $DB"
$INFLUX "CREATE DATABASE $DB"
@pmuellr
pmuellr / Dillinger.svg
Created Aug 4, 2016
Dillinger.svg file from ns-package-graph
View Dillinger.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pmuellr
pmuellr / package_info2dot.js
Last active May 6, 2016
Generate a diagram of package deps for running N|Solid instances, in graphviz dot notation, using the N|Solid agent `package_info` command. For more info on N|Solid, head over to https://nodesource.com/products/nsolid
View package_info2dot.js
#!/usr/bin/env node
// Generate a graphviz (graphviz.org) .dot file for the package relationships
// of the currently running N|Solid instances, using the N|Solid 1.3
// package_info command.
'use strict'
var fs = require('fs')
var path = require('path')
You can’t perform that action at this time.