View ddl.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE _table ( | |
pk SERIAL PRIMARY KEY, | |
field1 TEXT, | |
field2 TEXT, | |
date_deleted TIMESTAMPTZ | |
); |
View index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>How to center text</title> | |
<meta charset="utf-8" /> | |
</head> | |
<body> | |
<table style="width: 100%; height: 100%; position:absolute;"> | |
<tr> | |
<td valign="middle" align="center"> |
View game-of-life.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import readline from 'readline' | |
const w = process.stdout.columns | |
const h = process.stdout.rows | |
const init = () => Array.from({ length: w * h }).map(() => Math.round(Math.random())) | |
let state = init() | |
const deindex = (i) => [i % w, Math.floor(i / w)] |
View postgres-policy.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET SESSION app.id TO DEFAULT; | |
SET ROLE postgres; | |
SET search_path = 'public'; | |
DROP TABLE IF EXISTS expenses CASCADE; | |
DROP TABLE IF EXISTS projects CASCADE; | |
DROP TABLE IF EXISTS users CASCADE; | |
CREATE TABLE users ( | |
user_name text PRIMARY KEY NOT NULL, |
View gist:2d1331211b26d54f956af60f19533b63
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am tswaters on github. | |
* I am tswaters (https://keybase.io/tswaters) on keybase. | |
* I have a public key ASAm_89GCHVXoI95zX9hNRCPpZH-qf9RlS2mR4qQBBHWOgo | |
To claim this, I am signing this object: |
View bench.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
const { runMain, show } = require('bench') | |
const express = require('express'); | |
const Seneca = require('seneca'); | |
const SenecaWeb = require('seneca-web'); | |
const adapter = require('..'); | |
const Request = require('request') |
View determinism.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
// error-prone work function | |
const _work = (name, failure_rate) => (thing) => | |
new Promise((resolve, reject) => { | |
setTimeout(() => { | |
if (Math.random() < failure_rate) { | |
console.log(`${name} failed - ${JSON.stringify(thing)}`) | |
reject(new Error(`${name} hit above ${failure_rate}`)) | |
} else { |
View .dockerignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.git | |
node_modules | |
dist | |
public |
View canvas.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<meta charet="utf-8"/> | |
<style> | |
canvas { | |
image-rendering: crisp-edges; | |
margin: 5px; | |
} | |
canvas.horizontal { |
View random.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
const assert = require('assert') | |
const crypto = require('crypto') | |
module.exports = (min, max) => { | |
// borrowed from http://stackoverflow.com/a/33627342 | |
// figure out range and how many bytes required |
NewerOlder