Skip to content

Instantly share code, notes, and snippets.

View billiegoose's full-sized avatar

Billie Hilton billiegoose

View GitHub Profile
@billiegoose
billiegoose / mergelog.py
Created December 9, 2015 17:00 — forked from seanh/mergelog.py
A custom merge driver for git, for automatically merging my 'log.txt' file in a simplistic way.
#!/bin/env python
"""mergelog
This is a custom merge driver for git. It should be called from git
with a stanza in .git.config like this:
[merge "mergelog"]
name = A custom merge driver for my log.txt file.
driver = ~/scripts/mergelog %O %A %B %L
recursive = binary
@billiegoose
billiegoose / util.bash
Created January 14, 2016 23:01
A huge collection of Bash utility functions. Could come in handy!
#!/bin/bash -e
# Author: gdbtek (Nam Nguyen)
# Repo: https://github.com/gdbtek/ubuntu-cookbooks
# License: MIT
###################
# ARRAY UTILITIES #
###################
function arrayToString()
@billiegoose
billiegoose / data-over-http.md
Last active August 22, 2017 03:28
Embedding data in HTTP messages - an exhaustive analysis

Embedding data in HTTP messages - an exhaustive analysis

Hypertext Transport Protocol (HTTP) is the de facto protocol for sending data over the Internet. Today in addition to transporting hypertext documents, it is used to transport images, stylesheets, JavaScript, fonts - nearly everything in a web page. Rarely do developers pause to question why this is. Lately, I've been thinking a lot about HTTP and its relation to APIs and web apps. This document contains my thoughts on the usefulness of HTTP requests as envelopes for sending data.

HTTP requests consist of at least 7 pieces: the path, the query string, the method, the status, the headers, the body, and cookies. (Technically cookies are a subcategory of headers but they have additional behaviors that make them worth examining separately.) This article examines each of them from the perspective of their utility for carrying arbitrary data. Note: This article only looks at HTTP/1.

Least general

REST APIs often make use of HTTP methods and respo

@billiegoose
billiegoose / random_thoughts.txt
Last active February 25, 2016 20:32
Thoughts on a Universal Data schema
// TODO: Clean up thoughts into a nice document.
// Thoughts on Universal Data language / description
// See: https://martin.kleppmann.com/2012/12/05/schema-evolution-in-avro-protocol-buffers-thrift.html#comment-2534873305
/* Preface:
Why do Thrift, Protobuf, and Avro each define their own IDL?
I would think that there could be an implementation-independent "master" IDL
to standardize the syntax (the semantics depends on the feature set of the implementation).
It makes it hard to try out these different libraries when they require rewriting
the message schema each time.
@billiegoose
billiegoose / README.md
Created May 6, 2016 21:46
Mocha users need to watch out for this surprising behavior

Mocha does not reload modules when running multiple tests. This can lead to some curious errors that are difficult to understand at first, but have to do with modules that have an internal state of their own. If you have a folder with two files, test1.js and test2.js (shown in gist below), you will find you get different test results even though they are identical except in name. The first one fails, but the second succeeds.

So some state from previous tests can "pollute" later tests. This makes it difficult to write unit tests in isolation with Mocha, because suddenly when you put both tests together in the same directoy, mocha's behavior can break the tests.

@billiegoose
billiegoose / wmhilton.id
Last active November 14, 2016 06:56
Verifying that "wmhilton.id" is my Blockstack ID. https://onename.com/wmhilton
Verifying that "wmhilton.id" is my Blockstack ID. https://onename.com/wmhilton
@billiegoose
billiegoose / app.html
Created January 20, 2017 02:58
Replace internal links with history.pushState based navigation but leave external links unmodified
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
</head>
<body>
<a href="/app.html">app.html</a>
<br>
@billiegoose
billiegoose / storageQuota.js
Created March 13, 2017 22:04
StorageQuota polyfill
// MIT License, Copyright William Hilton <[email protected]>
// Implement the proposed W3C Quota Management API (circa 2017)
navigator.storageQuota = {
get supportedTypes () {
let types = []
if (navigator.webkitTemporaryStorage) types.push('temporary')
if (navigator.webkitPersistentStorage) types.push('persistent')
return types
},
queryInfo (type) {
@billiegoose
billiegoose / index.js
Created August 20, 2017 04:51
requirebin sketch
var signalhub = require('signalhub')
var hub = signalhub('my-app', [
'https://signalhub-jccqtwhdwc.now.sh/'
])
hub.subscribe('my-channel')
.on('data', function (message) {
console.log('new message received', message)
})
@billiegoose
billiegoose / DatArchive.md
Last active October 26, 2017 22:51
Musings on BeakerBrowser compatibility

Browser must have a global DatArchive object. https://beakerbrowser.com/docs/apis/dat.html

I think these ones could be supported in a client-side script using BrowserFS

  • new DatArchive(url)
  • DatArchive.create(opts?)
  • DatArchive.fork(url, opts?)
  • DatArchive.selectArchive(opts?)
  • DatArchive.resolveName(url)
  • url