Skip to content

Instantly share code, notes, and snippets.

View joyrexus's full-sized avatar

J. Voigt joyrexus

View GitHub Profile
joyrexus /
Created August 11, 2018 02:08 — forked from innovia/
Lambda concurrent execution custom metric on CloudWatch
#!/usr/bin/env python
import boto3
import datetime
import time
joyrexus / mocha-guide-to-testing.js
Last active October 6, 2017 02:33 — forked from samwize/mocha-guide-to-testing.js
quick overview of mocha testing
View mocha-guide-to-testing.js
// # Mocha Guide to Testing
// Objective is to explain describe(), it(), and before()/etc hooks
// 1. `describe()` is merely for grouping, which you can nest as deep
// 2. `it()` is a test case
// 3. `before()`, `beforeEach()`, `after()`, `afterEach()` are hooks to run
// before/after first/each it() or describe().
// Which means, `before()` is run before first it()/describe()
joyrexus / test.js
Last active September 17, 2017 23:10 — forked from ericelliott/fancy-without-features.js
just use tape
View test.js
import test from 'tape';
const before = test;
const after = test;
// beforeEach/afterEach rely on shared state.
// That's a big anti-pattern for testing.
// It's also silly to run something before and after
// ever test -- many of your tests won't need it.
joyrexus /
Last active September 26, 2020 05:55
Shopify App Installation URL via AWS Lambda (Python)
scopes = []
joyrexus /
Last active August 16, 2016 01:23
Simple node.js code style tips to improve code quality

Whether you use 2 spaces or 4 spaces, there are a few simple things that can make your node.js code easier to read. We've been using them in all the hapi modules for over 4 years now to great results. This list is by no means complete but it highlights the most useful elements that will give you immediate value in reducing bugs.

Required modules

JavaScript makes it harder than most languages to know where variables are coming from. Variables assigned required modules are particularly important because they represent a singleton object shared with the entire application. There are also globals and module globals, along with function variables and arguments.

Traditionally, variables starting with an uppercase letter represent a class that must be instantiated using new. This was an important semantic in the early days of JavaScript but at this point, if you don't know Date requires new Date() you are probably very new. We have adopted Upper Camel Case variable names for all module global variables

joyrexus / custom-error.js
Created June 7, 2016 15:23 — forked from justmoon/custom-error.js
Creating custom Error classes in Node.js
View custom-error.js
'use strict';
module.exports = function CustomError(message, extra) {
Error.captureStackTrace(this, this.constructor); =;
this.message = message;
this.extra = extra;
require('util').inherits(module.exports, Error);
joyrexus / http-errors.js
Created June 6, 2016 23:30 — forked from moleike/http-errors.js
HTTP Error classes in Node.js
View http-errors.js
'use strict';
const statusCodes = require('http').STATUS_CODES;
function createError(code, name) {
return function(message) {
Error.captureStackTrace(this, this.constructor); = name;
this.message = message;
this.statusCode = code;
joyrexus /
Created January 26, 2016 02:14 — forked from texuf/
fix for "WARNING Property: Unknown Property name." error from cssutils
from cssutils import profile
from cssutils.profiles import Profiles, properties, macros
#patch um up
properties[Profiles.CSS_LEVEL_2]['-ms-interpolation-mode'] = r'none|bicubic|nearest-neighbor'
properties[Profiles.CSS_LEVEL_2]['-ms-text-size-adjust'] = r'none|auto|{percentage}'
properties[Profiles.CSS_LEVEL_2]['mso-table-lspace'] = r'0|{num}(pt)'
properties[Profiles.CSS_LEVEL_2]['mso-table-rspace'] = r'0|{num}(pt)'
properties[Profiles.CSS_LEVEL_2]['-webkit-text-size-adjust'] = r'none|auto|{percentage}'
joyrexus /
Last active January 21, 2024 21:51 — forked from btoone/
curl tutorial

An introduction to curl using GitHub's API.


Makes a basic GET request to the specifed URI


Includes HTTP-Header information in the output

joyrexus /
Last active August 29, 2015 14:12 — forked from tmcw/
javascript iteration options

What kind of iteration to use when in JavaScript?

for (var i = 0; i < array.length; i++) {