Skip to content

Instantly share code, notes, and snippets.

View adambutler's full-sized avatar

Adam Butler adambutler

View GitHub Profile
// State
const initialState = {
counter: 0,
user: undefined,
token: undefined
}

Design

You can download the Sketup file from here

Materials

Name Quantity Dimensions Unit Price Total
A 6 22 x 150 x 3000 mm (link) £8.40 £50.40
B 4 22 x 100 x 3000 mm (link) £6.45 £25.80
frames = [
[
"R.....WWWW.....WWW...WWW....WWW....WWWWWWW.....R",
"R.....WWWWWW...WWW...WWW....WWW...WWW..........R",
"R.....WWW.WWW..WWW...WWWWWWWWWW....WWWWW.......R",
"R.....WWW..WWW.WWW...WWWWWWWWWW........WWW.....R",
"R.....WWW...WWWWWW...WWW....WWW........WWW.....R",
"R.....WWW....WWWWW...WWW....WWW...WWWWWWW......R"
],
[
openapi: "3.0.0"
info:
version: 1.0.0
title: Swagger Todos
license:
name: MIT
servers:
- url: http://todostore.swagger.io/v1
paths:
/:
// Step One: Generate a verifier
function base64URLEncode(str) {
return str.toString('base64')
.replace(/\+/g, '-')
.replace(/\//g, '_')
.replace(/=/g, '')
}
var verifier = base64URLEncode(crypto.randomBytes(32))
@adambutler
adambutler / Atom - Regex.md
Last active July 17, 2018 12:00
Atom Regex

Replace fat arrows in a HAML file:

Find:

:(\w+?)\s\=>\s(.+?)(\,|\})

Replace:

var ble = require("ble_eddystone");
const urls = [
{ url: "https://goo.gl/j9dDcH", led: LED2 },
{ url: "https://goo.gl/kkpdbq", led: LED3 },
];
let currentUrl = undefined;
let downTime = undefined;
let allowPush = true;
@adambutler
adambutler / enumerable.rb
Created April 18, 2017 14:14
Adds position helper to Enumerable
module Enumerable
def each_with_position(&block)
each_with_index do |element, index|
first = index == 0
last = index.equal?(size - 1)
block.call(element, first, last)
end
end
end
@adambutler
adambutler / index.js
Created December 21, 2016 12:45
Web Midi - Hello World
// Source: https://jsfiddle.net/KeithMcMillenInstruments/zma6pzt9
var midi, data;
// request MIDI access
if (navigator.requestMIDIAccess) {
navigator.requestMIDIAccess({
sysex: false
}).then(onMIDISuccess, onMIDIFailure);
} else {
alert("No MIDI support in your browser.");
[
{
"action": "talk",
"voiceName": "Emma",
"text": "Welcome to Nexmo. Please enter any digit."
}
]