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 / app.js
Created June 15, 2016 07:28
How to use fun-pouchdb
var DB = require('fun-pouchdb').defaults({prefix: __dirname})
// Production app needs:
// 1. Validation functions
// 2. Cloudant credentials
// 3. Design documents
// Optional Cloudant credentials
var cloudant = {account:process.env.cloudant_account,
password:process.env.cloudant_password}
@jhs
jhs / interaction.txt
Created September 15, 2015 11:56
Committing to CouchDB Nano
jhs@book:~/src/couchdb-nano$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
jhs@book:~/src/couchdb-nano$ echo >> lib/nano.js
jhs@book:~/src/couchdb-nano$ git commit -a -m 'Add a blank line'
> [email protected] jshint /Users/jhs/src/couchdb-nano
> jshint tests/*/*/*.js lib/*.js
@jhs
jhs / LICENSE.txt
Created September 9, 2015 02:44
Apple "Start Developing iOS Apps (Swift) license
Sample code project: FoodTracker
Version: 1.0
IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
@jhs
jhs / steps.md
Last active August 29, 2015 14:13
How to shoehorn io.js into nvm

NVM is nice. It sets up your $PATH for you, and it allows simple, isolated, stand-alone Node.js installs.

Until NVM officially supports [io.js][iojs], here is how to shoehorn io.js into your NVM system so that you can access it easily. The trick is just to tell nvm that you've installed "Node" version 1.0.1.

  1. Install NVM [the usual way][nvm-install]. Confirm that you are using v0.22.2: nvm --version # Output: 0.22.2
  2. Make sure it works by installing a Node.js version.
  3. Download io.js. I used the binary build for Linux. You could build your own too.
  4. Extract io.js anywhere: cd ~/Downloads; tar xzvf iojs-v1.0.1-linux-x64.tar.gz # (or wherever your download/build is)
  5. mkdir -p ~/.nvm/versions/node
  6. mv iojs-v1.0.1-linux-x64/ ~/.nvm/versions/node/v1.0.1 # (or whatever your download/build is)
@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')
}
@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 / 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.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

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 / 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]