Skip to content

Instantly share code, notes, and snippets.

View davidbanham's full-sized avatar

David Banham davidbanham

View GitHub Profile
@davidbanham
davidbanham / keybase.md
Created March 17, 2014 06:48
keybase.md

Keybase proof

I hereby claim:

  • I am davidbanham on github.
  • I am davidbanham (https://keybase.io/davidbanham) on keybase.
  • I have a public key whose fingerprint is 8428 8E68 6C9A DC59 EC48 CBFA 13F6 3D81 CDB8 59E6

To claim this, I am signing this object:

@davidbanham
davidbanham / gist:9757890
Created March 25, 2014 09:14
Test scripts
A common way to write your test script in a package.json is:
"scripts": {
"test": "mocha"
},
But that expects the user to have mocha (or karma, etc) installed globally. A more portable way to do it is call the locally installed runner directly:
"scripts": {
"test": "./node_modules/.bin/mocha"
@davidbanham
davidbanham / gist:0d81359ed4d8c4a784dc
Created September 24, 2014 23:10
You can totally pass functions in a document stream
t2 = require 'through2'
one = t2.obj (doc, enc, cb) ->
doc.speak()
doc.foo = ->
console.log 'foo'
@push doc
cb()
two = t2.obj (doc, enc, cb) ->
@davidbanham
davidbanham / repl.js
Created November 24, 2014 23:32
NodeJS debugger + repl
// To interact with this file, run `node debug repl.js`
// If you type `next` it will step to the next line
// If you type `cont` it will carry on to the
var foo = 'bar'; // You are stopped here. To go to the next line, type `next`
var bar = 'baz'; // Now you're here! Typing `next` was a lot of keystrokes, you can also type `n`
var baz = 'quux'; // This is still going to take a while. To skip all the way to the next debugger statment, type `cont`
var alice = 'bob';
var bob = 'alice';
@davidbanham
davidbanham / gist:d3278a60dfa0f105ecff
Last active August 29, 2015 14:15
Salt role matching issue
Roles as per grains.item
roles:
- field-marshal
Matcher in top.sls:
'role:field-marshal':
- match: grain
- field-marshal
ordermentum:PRIMARY> rs.add("mongod2")
{ "ok" : 1 }
ordermentum:PRIMARY> rs.add("mongod3")
{ "ok" : 1 }
ordermentum:PRIMARY> rs.status()
{
"set" : "ordermentum",
"date" : ISODate("2015-04-20T01:28:47.456Z"),
"myState" : 1,
"members" : [
> rs.status()
{
"info" : "run rs.initiate(...) if not yet done for the set",
"ok" : 0,
"errmsg" : "no replset config has been received",
"code" : 94
}
>
# Welcome to the InfluxDB configuration file.
# If hostname (on the OS) doesn't return a name that can be resolved by the other
# systems in the cluster, you'll have to set the hostname to an IP or something
# that can be resolved here.
# hostname = ""
hostname = "influxdb_internal.[redacted]"
bind-address = "0.0.0.0"
@davidbanham
davidbanham / gist:7e4ab9e54f2706554f01
Created June 25, 2015 01:35
Electron segfault cased by resolveProxy
Process: Electron [45085]
Path: /Users/USER/Downloads/*/Electron.app/./Contents/MacOS/Electron
Identifier: com.github.electron
Version: 0.28.3
Code Type: X86-64 (Native)
Parent Process: zsh [43882]
Responsible: iTerm [294]
User ID: 501
Date/Time: 2015-06-25 11:33:25.927 +1000
@davidbanham
davidbanham / gist:1124941
Created August 4, 2011 10:43
Invalid URL wierdness
level=error,message=Invalid URL requested: /static-classified-data/motor/news-image/Solah1.jpg
level=error,message=Invalid URL requested: /static-classified/images/motoring/nissan.gif
level=error,message=Invalid URL requested: /static-classified/js/searchbar.js
level=error,message=Invalid URL requested: /static-classified/searchprinter.jsp
level=error,message=Invalid URL requested: /static-watchlist/watch_list_malay.html
level=error,message=Invalid URL requested: /static-classified/images/previous-icon.png
level=error,message=Invalid URL requested: /static-classified/images/property/turnberry_villas.gif
level=error,message=Invalid URL requested: /static-classified/searchprinter.jsp
level=error,message=Invalid URL requested: /static-classified/searchprinter.jsp
level=error,message=Invalid URL requested: /static-gtp/gtp_carousel.html