Skip to content

Instantly share code, notes, and snippets.

View bcomnes's full-sized avatar
👽

Bret Comnes bcomnes

👽
View GitHub Profile
@bcomnes
bcomnes / bookmarks.sql
Last active December 14, 2020 16:37
bookmark pg schema v2
CREATE EXTENSION IF NOT EXISTS citext;
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
CREATE TABLE users (
id UUID PRIMARY KEY DEFAULT uuid_generate_v1mc(),
username citext UNIQUE NOT NULL,
email citext UNIQUE NOT NULL,
email_confirmed BOOLEAN NOT NULL DEFAULT false,
password text
);
CREATE EXTENSION citext;
CREATE DOMAIN email_address AS citext
CHECK (
value ~ '^[a-zA-Z0-9.!#$%&''*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$'
);
CREATE TABLE users (
id INT GENERATED ALWAYS AS IDENTITY primary key,
@bcomnes
bcomnes / package.json
Created October 31, 2020 15:37
react 16
{
"name": "react-16",
"version": "0.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Bret Comnes <bcomnes@gmail.com> (https://bret.io/)",
"license": "MIT",
@bcomnes
bcomnes / foo_test.js
Created January 15, 2020 00:55
deno test error
import {
assertEquals,
runTests,
test
} from "https://deno.land/std/testing/mod.ts";
test({
name: "testing example",
fn() {
assertEquals("world", "world");
@bcomnes
bcomnes / .gitignore
Last active January 1, 2020 00:52
noise-peer-example
node_modules
function getFormValues (formEl) {
return Array.from(new window.FormData(formEl).entries())
.reduce(function (obj, [key, value]) {
obj[key] = value
return obj
}, {})
}
@bcomnes
bcomnes / Tron Legacy.terminal
Last active May 28, 2019 15:05
Tron Legacy Terminal Profile
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ANSIBlackColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPECcw
LjEwOTA5NTk4MjEgMC4xMDkwOTU5ODIxIDAuMTA5MDk1OTgyMQAQAYAC0hAREhNaJGNs
YXNzbmFtZVgkY2xhc3Nlc1dOU0NvbG9yohIUWE5TT2JqZWN0XxAPTlNLZXllZEFyY2hp
@bcomnes
bcomnes / README.md
Last active February 28, 2019 23:23
go-swagger bug

A possible go-swagger bug

The request object that github.com/go-openapi/runtime implements has a .GetBody method. When you run the .GetBody method, it writes the ClientRequestWriterFunc to the req.Body again.

usage

With Go 1.12 installed:

var pause = (duration) => new Promise(res => setTimeout(res, duration));
var exponentialBackoff = (func, attempts = 1, delay = 50) => {
console.log('attempts', attempts)
return func().catch(err => {
console.log('error', err)
if (attempts > 1) {
console.log(`Retries left ${attempts - 1}`)
console.log(`Next delay ${delay * 2}`)
return pause(delay).then(() => exponentialBackoff(func, attempts - 1, delay * 2))