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
package main | |
import ( | |
"flag" | |
"log" | |
"net/http" | |
"os" | |
) | |
func main() { |
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
/** | |
* @param {string} text | |
*/ | |
export function parseJSON(text) { | |
if (typeof text !== 'string') { | |
return null | |
} | |
text = text.replace(/([^\"]+\"\:\s*)(\d{16,})(\,\s*\"[^\"]+|}$)/g, '$1"$2"$3') | |
return JSON.parse(text, (_, v) => typeof v === 'string' && /^\d{16,}$/.test(v) ? BigInt(v) : v) | |
} |
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
var rxEmail = regexp.MustCompile("^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$") | |
var rxUsername = regexp.MustCompile("^[a-z][a-z0-9_-]{0,17}$") |
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
const rxUpper = /([A-Z])/g | |
const observersMap = /** @type {WeakMap<any, {[x: string]: (function(string=): void)}>} */ (new WeakMap()) | |
/** | |
* Mixin that provides a mechanism to declare properties and render when they change. | |
* It uses type constructors (String, Boolean, Number, Object, Function and Symbol) to check type validity. | |
* Set the type to undefined if you don't care about it. | |
* Properties of type String, Boolean and Number are automatically reflected to attributes. | |
* Make sure to call super.connectedCallback() if you are overriding the method. | |
* |
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
const abortController = new AbortController() | |
fetch('/api/ndjson', { | |
headers: { accept: 'application/x-ndjson' }, | |
signal: abortController.signal, | |
}).then(async res => { | |
const reader = res.body.getReader() | |
const textDecoder = new TextDecoder() | |
try { |
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
package main | |
import ( | |
"log" | |
"net/http" | |
) | |
func main() { | |
h := http.FileServer(spaFileSystem{http.Dir("static")}) |
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
package pubsub | |
import ( | |
"reflect" | |
"sync" | |
) | |
// PubSub system. | |
type PubSub interface { | |
// Pub publishes to the given topic. |
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
:root { | |
box-sizing: border-box; | |
font-family: sans-serif; | |
-ms-overflow-style: -ms-autohiding-scrollbar; | |
} | |
*, | |
::before, | |
::after { | |
box-sizing: inherit; |
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
Verifying my Blockstack ID is secured with the address 1CcXMTDRMcfAYnv2zMxn1dueK2mwrJJgoH https://explorer.blockstack.org/address/1CcXMTDRMcfAYnv2zMxn1dueK2mwrJJgoH |
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
const MONTHS = [ | |
'Jan', | |
'Feb', | |
'Mar', | |
'Apr', | |
'May', | |
'Jun', | |
'Jul', | |
'Aug', | |
'Sep', |