Skip to content

Instantly share code, notes, and snippets.

View chris-jamieson's full-sized avatar

Chris Jamieson chris-jamieson

View GitHub Profile

Keybase proof

I hereby claim:

  • I am chris-jamieson on github.
  • I am jamiesoncj (https://keybase.io/jamiesoncj) on keybase.
  • I have a public key whose fingerprint is 1B2F 5829 5041 AD17 5949 C867 A499 CCD4 E147 3F2F

To claim this, I am signing this object:

@chris-jamieson
chris-jamieson / .gitignore
Created January 28, 2019 11:13
Basic gitignore starter
# Logs
logs
*.log
npm-debug.log*
# Runtime data
pids
*.pid
*.seed
@chris-jamieson
chris-jamieson / gc-webhook.js
Last active June 14, 2019 04:53
GoCardless Node / Express signature verification middleware
const crypto = require('crypto');
/**
* Express middleware to validate incoming webhook request from Gocardless
* @param {*} req Express request
* @param {*} res Express response
* @param {*} next Next middleware function if succeeds
*/
function verifyGocardlessWebhook(req, res, next) {
if (!req.headers['webhook-signature']) {
@chris-jamieson
chris-jamieson / snippet.js
Created November 26, 2017 13:44
Sequelize snippet for sorting (REST api)
// snippet to help feed sort parameters into Sequelize query
// following Vinay Sahni's best practices (http://www.vinaysahni.com/best-practices-for-a-pragmatic-restful-api)
// e.g. https://my-url.com/api/v1/sausages?sort=-createdAt,name
function list (req, res, next) {
const findOptions = {
order: [],
};
// handle sorting / ordering
if (req.query.sort) {
@chris-jamieson
chris-jamieson / keybase.md
Created November 15, 2017 12:02
keybase.md

Keybase proof

I hereby claim:

  • I am jamiesoncj on github.
  • I am jamiesoncj (https://keybase.io/jamiesoncj) on keybase.
  • I have a public key whose fingerprint is 1B2F 5829 5041 AD17 5949 C867 A499 CCD4 E147 3F2F

To claim this, I am signing this object:

@chris-jamieson
chris-jamieson / soap-watcher.js
Created September 26, 2017 17:59
node soap watcher snippet
// Node SOAP client event watcher for https://github.com/vpulim/node-soap
client.on('response', (responseBody, incomingMessage) => {
console.log('response! responseBody: ', responseBody);
});
@chris-jamieson
chris-jamieson / functional-spec.md
Created March 9, 2017 16:06
Writing functional specification guidelines

Once you are ready to hire a developer, what should you do to mitigate execution / build risk?

  1. Writing a good functional specification is key to getting the build phase of this project right. It's not easy to do but it's mostly just about thinking hard and writing out all the boring details of your desired outcome. The best guide for this is Joel Spolsky (recently sold Trello for $425M). He wrote a 4 part series on this, starting here, and also has an example (real) spec on his website here (the PDF link is broken, this is the real one)

  2. Before you start on a spec, trim down your functionality to the absolute bare minimum - and be brutal with it! Imagine you had to complete it in one day, or imagine it was only a single feature... take away everything that isn't fundamental

@chris-jamieson
chris-jamieson / setup-instructions.md
Created August 24, 2016 00:50
Crib sheet: set up a static website on AWS S3

Crib sheet: set up a static website on AWS S3

A useful walkthrough is also available on docs.aws.amazon.com.

Set up S3 buckets and configure them for web hosting

  1. Open the AWS console and choose s3 link
  2. Create a new bucket, naming it exactly as your domain name e.g. mydomain.com
  3. Open the Permissions settings and click "Edit bucket policy", setting the value to a policy as follows (remember to swap in your bucket name):
@chris-jamieson
chris-jamieson / command.md
Last active August 27, 2016 20:40
Baseline meteor setup

Handy packages for quickstart Meteor projects:

meteor add alanning:roles accounts-password aldeed:autoform aldeed:collection2 arillo:flow-router-helpers raix:handlebar-helpers fortawesome:fontawesome kadira:blaze-layout kadira:flow-router kevohagan:sweetalert matb33:collection-hooks momentjs:moment natestrauser:animate-css peppelg:bootstrap-3-modal reactive-var twbs:bootstrap useraccounts:flow-routing useraccounts:bootstrap utilities:avatar yogiben:autoform-modals yogiben:spinkit percolatestudio:segment.io@=2.0.0_1

Eslint setup: meteor npm install --save-dev babel-eslint eslint-config-airbnb eslint-plugin-import eslint-plugin-meteor eslint-plugin-react eslint-plugin-jsx-a11y eslint-import-resolver-meteor eslint

@chris-jamieson
chris-jamieson / setup.md
Created April 19, 2016 15:43
Set up Franz for Ubuntu
  • Download Franz for your distribution from MeetFranz.com
  • change into the same directory as the downloaded file, then sudo tar -xf Franz-linux-x64-0.9.10.tgz -C /opt/franz
  • (optional) wget "https://cdn-images-1.medium.com/max/360/1*v86tTomtFZIdqzMNpvwIZw.png" -O franz-icon.png then sudo cp franz-icon.png /opt/franz
  • (optional) sudo touch /usr/share/applications/franz.desktop then sudo vim /usr/share/applications/franz.desktop

paste the following lines into the file, then save the file:

[Desktop Entry]
Name=Franz
Comment=