Skip to content

Instantly share code, notes, and snippets.

View davidwaterston's full-sized avatar

David Waterston davidwaterston

View GitHub Profile
Verifying my Blockstack ID is secured with the address 1G1XEEcyDTpB9xTsH7AW9p8duUhDEXb33 https://explorer.blockstack.org/address/1G1XEEcyDTpB9xTsH7AW9p8duUhDEXb33
@davidwaterston
davidwaterston / cuidgen.xml
Last active June 10, 2017 12:27
Test of storing a draw.io diagram in Gist to see if it can be shared publicly using the raw URL.
<?xml version="1.0" encoding="UTF-8"?>
<mxfile userAgent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36" version="6.7.8" editor="www.draw.io" type="google"><diagram id="c90c8005-b0ba-652e-bdff-c7c083828973" name="Page-1">5Vptd6I4FP41fiwHCG9+rFo7e8687bhzOvvJgxAx20hYCNX2128SEgWCitbudM70g8JNuMBzn9z75NoBGK+393mYrT6RGOKBbcbbAZgMbHsIfPbJDc+VwR0GlSHJUVyZrL1hhl6gNJrSWqIYFo2JlBBMUdY0RiRNYUQbtjDPyaY5bUlw865ZmEDNMItCrFsfUExX0mp5w/3AB4iSlbx1YHvVwCKMHpOclKm838AGS/FXDa9D5Uu+aLEKY7KpmcDdAIxzQmh1tN6OIebQKtiq66YHRuVzP4W4lG9yt6UwT0OsnjuHKe3jydY8TeATxCSDuXxy+qzQisNiBfl15gCMVnSN2aHFDtnLZXzKeptwlhjhpgBGWTAPYLREGI8JJrlwASb2BEwAs7OZMWLPqMZSkkI+naRU0sQK2HmIUZKyk4hNFf5wuID4KykQRaQx8ARzilhkP7YmLAilZF2bcCtdUpIxq46XwpZNh9uaSeJ3D8ka0vyZTVGrYChBlIvAU+ze7CnluJVpVSOTBySRJYmTned9vNiBDJk4/c5A/bL4hy8F2xRQVJfeI/qhXDDbN5iRyitG6WM1uKKUL6db7tSeJoiuyoURMUzsaRw+oXgTMgQLytCypxFbkAlMKxeKI27t9SV9aqxQ0UdrsdjqxOiG/GSkxIuNdiusRh+5xsBI3Oy2yKqkwPkYqpMl2nKSjuTzTJqvH8WpZSCWT5YojWG+w4GG
@davidwaterston
davidwaterston / keybase.md
Last active November 10, 2019 10:40
My Keybase proof

Keybase proof

I hereby claim:

  • I am davidwaterston on github.
  • I am davidwaterston (https://keybase.io/davidwaterston) on keybase.
  • I have a public key ASCOyyRe-PvHjGxtrNHIyjmtcwa-BTORNuLnis12meiufAo

To claim this, I am signing this object:

@davidwaterston
davidwaterston / no-multi-vars.js
Created April 6, 2015 10:47
ESLint custom rule: Disallow multiple variables per var declaration (no-multi-vars)
/* global module */
"use strict";
module.exports = function(context) {
function checkVarDeclarations(node) {
var hasMultipleVars = (node.declarations.length > 1);
@davidwaterston
davidwaterston / no-multi-object-properties-one-line.js
Created April 6, 2015 10:46
ESLint custom rule: Disallow multiple object properties to be declared on one line (no-multi-object-properties-one-line)
/* global module */
"use strict";
module.exports = function (context) {
function checkObjectExpression(node) {
var multiplePropertiesOnOneLine;
var numberOfLines;
@davidwaterston
davidwaterston / no-multi-object-properties-first-line.js
Created April 6, 2015 10:45
ESLint custom rule: Disallow first property of a multiple property object to be declared on first line (no-multi-object-properties-first-line)
/* global module */
"use strict";
module.exports = function (context) {
function checkObjectExpression(node) {
var numberOfProperties = node.properties.length;
var objHasMultipleProperties = (numberOfProperties > 1);
@davidwaterston
davidwaterston / no-multi-object-properties-last-line.js
Last active August 29, 2015 14:18
ESLint custom rule: Disallow last property of a multiple property object to be declared on last line (no-multi-object-properties-last-line)
/* global module */
"use strict";
module.exports = function (context) {
function checkObjectExpression(node) {
var numberOfProperties = node.properties.length;
var objHasMultipleProperties = (numberOfProperties > 1);
@davidwaterston
davidwaterston / no-object-prop-key-value-split.js
Last active August 29, 2015 14:18
ESLint custom rule: Disallow object property values from appearing on a different line from their key
/* global module */
"use strict";
module.exports = function (context) {
function checkObjectExpression(node) {
var props = node.properties;
var numberOfProperties = props.length;
@davidwaterston
davidwaterston / Increment number part of string
Created April 20, 2014 10:22
Javascript: increment the number part of a text field e.g. take a text field containing "abc15" and increment it by 1 to return "abc16", "xyz99" will become "xyz100", etc. Really shouldn't be doing this but if you have to then this will do it. See it in action: http://jsfiddle.net/davidwaterston/a8yXH/
var myString = "abc99";
newString = myString.replace(/\d+$/, function(n) { return ++n });
@davidwaterston
davidwaterston / toISOString
Created January 13, 2013 09:16
Javascript: converts a Date object into an ISO 8601 formatted string.
if (typeof Date.prototype.toISOString !== 'function') {
(function () {
'use strict';
// Function which takes a 1 or 2-digit number and returns it as a two-character string,
// padded with an extra leading zero, if necessary.
function pad(number) {
var r = String(number);