Skip to content

Instantly share code, notes, and snippets.

@wmhilton
wmhilton / NFT.sol
Last active Apr 8, 2021
NFTs 4 All - v1
View NFT.sol
// SPDX-License-Identifier: MIT
// by William Hilton (https://github.com/wmhilton)
// written using remix.ethereum.org
pragma solidity >=0.8.3 <0.9.0;
/**
* @dev ERC-721 interface for accepting safe transfers.
* See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md.
*/
interface ERC721TokenReceiver {
@wmhilton
wmhilton / index.html
Last active Jan 30, 2020
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