Skip to content

Instantly share code, notes, and snippets.

View jhs's full-sized avatar

Jason Smith jhs

  • McKinsey & Company
  • New York, NY
View GitHub Profile
@jhs
jhs / style.js
Created December 14, 2013 08:43
var latest_found = null
for (var ver in doc.versions)
if (!latest_found || semver.gt(ver, latest_found))
latest_found = ver
var bespoke = require('bespoke')
bespoke([
{ couch: "http://couch1", "pull_only":true },
{ couch: "http://couch2" },
{ couch: "http://couch3" "hub":true }
])
# Pop up a message using notify-send or growlnotify. Example: n git push
popup() {
if [ -z "$notifier" ]; then
if which 'notify-send' >/dev/null 2>/dev/null; then
notifier='notify-send'
elif which growlnotify >/dev/null 2>/dev/null; then
notifier="growlnotify"
else
echo "popup error: cannot find notify-send or growlnotify" >&2
return 1
@jhs
jhs / README.md
Last active January 1, 2016 09:59
Next CouchDB changes feed project

Followers - The next-best thing to electroshock therapy.

Followers is a library to follow CouchDB changes feeds. In fact, the API is 100% identical to Follow, with a few differences.

  • Instead of a Feed class, there is a Socialist class
  • Instead of a "change" event, Followers emits a "socialist" event
  • Change objects do not have a .changes field, but rather a .socialists field.
@jhs
jhs / gist:8381575
Created January 12, 2014 06:09
SSH public key
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAuWgWS41PlgjH1usjBOo6NFUoz8/g1HVZC6yBNP43vP2Iyajn8JkSLnLNkq72ndFQ9idZXjbfaJvxMWK8m5kBuiQm6EEws09jq7H5xtMY94nbhb+BCSO3sluuHw9hYlsEIWDHaegou5Y+UoyH1s8jsDggR7Wgv6TUp2RXdJ2ZO4zmLu72EJpYVx45iELxGmdxm9DE1FBNjZ33/i2T/5EpNyiFwVwA8pPfKTT42R2Wkig1aybc+wMoktBrcJ7JPgdu7qI+x8cz9fwm1r+Af2e8bTv+tQebFRukoej2DW+6pwDnTNJHrEz0zNVUVyyVfXTjWciK5T4IQq1Bp256sQcO8w== [email protected]

Keybase proof

I hereby claim:

  • I am jhs on github.
  • I am jhs (https://keybase.io/jhs) on keybase.
  • I have a public key whose fingerprint is 0A96 64D7 83A8 F28A F342 118C 97FC 9E00 74D1 1C16

To claim this, I am signing this object:

@jhs
jhs / test.txt
Created May 14, 2014 02:40
node-replicator test run
$ ./node_modules/.bin/mocha test/test.js
Generating pems for testing secure peers...
․․․
0 passing (4s)
3 failing
1) sanity tests add data to db0 and expect it exists on db1 and db2 after t seconds:
Error: timeout of 2000ms exceeded
@jhs
jhs / slack.com.js
Created May 21, 2014 13:21
Prominent Slack Highlight
$('#msgs_div').bind('DOMSubtreeModified', function () {
var bg = '#bedded'
$('.message .mention').parent().parent().css('background-color', bg)
})
@jhs
jhs / test-failure.ext
Created June 17, 2014 15:08
Test failure
$ npm test
> [email protected] test /home/travis/build/PolicyMic/cms
> npm run bundle-test && node_modules/.bin/mocha-phantomjs TestRunner.html
> [email protected] bundle-test /home/travis/build/PolicyMic/cms
> browserify -t jadeify specs/*.js --fast -o dist/test_bundle.js
TypeError: 'undefined' is not an object (evaluating 'Function.prototype.bind.call')
@jhs
jhs / example.js
Last active August 29, 2015 14:04
Legacy http server with Hapi
// This file demonstrates my desire to hook a "legacy" http server into
// a Hapi route.
var http = require('http')
var legacy_server = http.createServer(legacy_handler)
legacy_server.listen(8081)
function legacy_handler(request, response) {
response.end('I am a standard handler\n')
}