Skip to content

Instantly share code, notes, and snippets.

@zevaverbach
zevaverbach / coworking_spaces_speed.json
Last active April 9, 2019 07:57
Internet Speed Tests at Coworking Spaces in Geneva, Switzerland
[
{
"date": "9 Apr 2019",
"location": "Spaces Genève, Quai de l'île",
"ping": 4,
"down": 222.29,
"up": 213.07
}
]
@zevaverbach
zevaverbach / universal_transcript.md
Last active March 8, 2019 03:50
Spec for Universal Transcript

Universal Transcript Format

This is my first crack at spec'ing out the fields in the wordObjects contained in a "universal transcript" as produced by a machine, a human, or both, from human speech.

Fields in a wordObject

word

This is the word that the transcriber thinks is spoken.

@zevaverbach
zevaverbach / braces.py
Created December 17, 2018 19:17
braces.py
MATCHED_LOOKUP = {k: v for k, v in ["()", "[]", "{}"]}
def is_valid(string):
open_braces = []
for char in string:
if char in MATCHED_LOOKUP:
open_braces.append(char)
@zevaverbach
zevaverbach / index.html
Created October 23, 2018 18:13
Basic React app with the beginnings of undo functionality
<!doctype html>
<head>
<script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<script crossorigin src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.js"></script>
</head>
<body>
@zevaverbach
zevaverbach / gist:e36fbe1c7ec81e66834f3c4f84e8b62d
Last active October 1, 2018 01:54
Conway's Game of Life implemented in a single file using React.js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title></head>
<body>
<script src="https://unpkg.com/react@16.5.2/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16.5.2/umd/react-dom.development.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.js"></script>
<script type="text/babel">
@zevaverbach
zevaverbach / gist:46a4c417d74fac65844d479e52d61803
Created September 27, 2018 20:15
Generate Game of Life Board with arbitrary dimensions
generateGoL = (numRows, numCols) => {
return Array.from({length: numRows}, () =>
Array.from({length: numCols}, () =>
Math.round(Math.random())))
}
@zevaverbach
zevaverbach / gist:d8dfcb7b586ad7dec930657137af6ca2
Created September 27, 2018 04:06
get_neighbors function for Conway's Game of Life
const getNeighbors = (rowNum, colNum, board) => {
const neighbors = [];
for (let r of [rowNum - 1, rowNum, rowNum + 1]) {
if (board[r] === undefined) {
continue;
}
for (let c of [colNum - 1, colNum, colNum + 1]) {
if (board[r][c] === undefined) {
continue;
}
@zevaverbach
zevaverbach / tic.py
Last active August 17, 2018 11:44
Tic Tac Toe!
from time import sleep
BOARD_WIDTH = 17
LEFT_PAD_30 = " " * 30
LEFT_PAD_10 = " " * 10
WIN_BOXES = [(0, 1, 2),
(3, 4, 5),
(6, 7, 8),
(0, 3, 6),
(1, 4, 7),
@zevaverbach
zevaverbach / get_square_tenders.py
Last active July 16, 2018 13:27
Get tenders from Square, optionally from a specific location and/or time.
"""
The star of this show is get_tenders, which will return all tenders
if there are no keyword arguments supplied, or tenders from a specific location,
and/or before/after datetimes.
For convenience, here are the fields of a Tender:
'id'
'location_id'
'transaction_id'
@zevaverbach
zevaverbach / gist:0c33d4bccf413e2debdf8cd4ffc76a8f
Last active September 26, 2017 02:02
Area code to gmt mapping
# http://greatdata.com/areacodetimezone
area_code_gmt_dict = {
201: -5,
202: -5,
203: -5,
205: -6,
206: -8,
207: -5,
208: -7,