Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am jasonhewison on github.
  • I am jasonhewison (https://keybase.io/jasonhewison) on keybase.
  • I have a public key ASBBt8B0VsI352KyZwR_hA1Til-LGzeQRZTW74MtK4PLbwo

To claim this, I am signing this object:

@JasonHewison
JasonHewison / _color.sh
Last active May 18, 2021 00:42
_color.sh | A Bash Color Function library
#!/usr/bin/env bash
__ansi_set_bold='1'
__ansi_set_dim='2'
__ansi_set_underlined='4'
__ansi_set_blink='5'
__ansi_set_inverted='7'
__ansi_set_hidden='8'
__ansi_reset_all='0'
@JasonHewison
JasonHewison / .makefilehelp
Last active February 28, 2018 20:00
./.makefilehelp
#!/usr/bin/env bash
BOLD_RED='\033[1;31m'
BOLD_GREEN='\033[1;32m'
COLOR_NC='\033[0m'
BOLD='\033[1m'
current_dir=`pwd`
makefile=${1:-"${current_dir}/Makefile"}
target=$2
@JasonHewison
JasonHewison / wait-for-containers.sh
Last active June 2, 2022 21:34
wait-for-containers.sh
#!/usr/bin/env bash
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
COLOR_NC='\033[0m'
timeout=${1:-600}
@JasonHewison
JasonHewison / curry.js
Created June 5, 2017 08:32
TDD'd Currying
export default function curry(func, ...args) {
function inner(currentArgs, ...newArgs) {
const currentLength = currentArgs.length + newArgs.length;
if (currentLength >= func.length) {
return func(...currentArgs, ...newArgs);
} else {
return (...furtherArgs) =>
inner([...currentArgs, ...newArgs], ...furtherArgs);
}
@JasonHewison
JasonHewison / Controller.js
Created April 27, 2017 08:58
nodejs stuff
const users = require('users');
const emails = require('emails');
module.exports = {
async login(req) {
const id = req.param('id');
let user;
if(user = users.find(id)){
const token = users.createResetToken();
await emails.send(user, token);
@JasonHewison
JasonHewison / ngInput.dir.js
Created July 2, 2015 14:16
Fix angularjs model binding issue in IE10 when clicking on the clear (X) button in an <input type="text">
angular.module('mymodule')
.directive('input', function () {
'use strict';
return {
restrict: 'E',
link: function (scope, element, attrs) {
if ((attrs.type + '').toLowerCase() !== 'text') {
return;
}
element[0].oninput = function () {
@JasonHewison
JasonHewison / badRequest_example.js
Created March 18, 2015 12:26
Examples of how you could use DeferredHTTPStatuses in a more ES6 Promise style way
var deferred = require('deferred-http-statuses');
return deferred(function (resolve, reject) {
reject.badRequest(new Error('The request was bad.'));
});