Skip to content

Instantly share code, notes, and snippets.

William Hilton wmhilton

Block or report user

Report or block wmhilton

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@wmhilton
wmhilton / index.html
Last active Nov 27, 2018
magic portal (isomorphic-git)
View index.html
<div>
<input id="repository" type="text" style="width: 50em" title="Tip: enter a private repo URL to see the credentialManager plugin prompt for a password.">
<button type="button" id="cloneButton">Clone</button>
</div>
<output id="log" style="white-space: pre; font-family: monospace;"></output>
<script src="https://unpkg.com/magic-portal"></script>
<script>
let worker = new Worker("./worker.js")
@wmhilton
wmhilton / index.html
Created Nov 25, 2018
worker-gist (isomorphic-git)
View index.html
<div>
<input id="repository" type="text" style="width: 50em" title="Tip: enter a private repo URL to see the credentialManager plugin prompt for a password.">
<button type="button" onClick="clone()" id="cloneButton">Clone</button>
</div>
<output id="log" style="white-space: pre; font-family: monospace;"></output>
<script src="./proxyReceiver.js"></script>
<script src="./proxySender.js"></script>
<script>
let worker = new Worker("./worker.js")
@wmhilton
wmhilton / AutoHotkey.ahk
Last active Jun 6, 2018
Hotkey to Toggle Screen Resolution
View AutoHotkey.ahk
#b::
Width := QueryScreenWidth()
if (Width = 3840) {
ChangeResolution(1920, 1080)
} else {
ChangeResolution(3840, 2160)
}
QueryScreenWidth()
{
@wmhilton
wmhilton / DatArchive.md
Last active Oct 26, 2017
Musings on BeakerBrowser compatibility
View DatArchive.md

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
@wmhilton
wmhilton / index.js
Created Aug 20, 2017
requirebin sketch
View index.js
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)
})
@wmhilton
wmhilton / storageQuota.js
Created Mar 13, 2017
StorageQuota polyfill
View storageQuota.js
// MIT License, Copyright William Hilton <wmhilton@gmail.com>
// 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) {
@wmhilton
wmhilton / app.html
Created Jan 20, 2017
Replace internal links with history.pushState based navigation but leave external links unmodified
View app.html
<!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>
@wmhilton
wmhilton / wmhilton.id
Last active Nov 14, 2016
Verifying that "wmhilton.id" is my Blockstack ID. https://onename.com/wmhilton
View wmhilton.id
Verifying that "wmhilton.id" is my Blockstack ID. https://onename.com/wmhilton
@wmhilton
wmhilton / README.md
Created May 6, 2016
Mocha users need to watch out for this surprising behavior
View README.md

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.

@wmhilton
wmhilton / random_thoughts.txt
Last active Feb 25, 2016
Thoughts on a Universal Data schema
View random_thoughts.txt
// 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.
You can’t perform that action at this time.