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
export class Reader { | |
private view: DataView; | |
private offset: number; | |
private littleEndian: boolean; | |
constructor(buffer: ArrayBuffer, offset = 0, littleEndian = false) { | |
this.view = new DataView(buffer); | |
this.offset = offset; | |
this.littleEndian = littleEndian; | |
} | |
getOffset(): number { |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/matter-js/0.19.0/matter.min.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/build/decomp.min.js"></script> | |
</head> | |
<body> | |
<div style="display: flex; gap: 10px"> | |
<div id="world"></div> |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/matter-js/0.19.0/matter.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/tone/14.8.49/Tone.min.js"></script> | |
</head> | |
<body> | |
<script> | |
document.onclick = () => { |
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
#!/bin/bash -euo pipefail | |
export GREP_OPTIONS='--color=always' | |
go test "$@" \ | |
| GREP_COLOR='1;31' grep -E '.*FAIL.*|$' \ | |
| GREP_COLOR='1;32' grep -E '.*PASS.*|$' |
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
export async function rpc(name: string, ...args: any[]): Promise<any> { | |
const formData = new FormData(); | |
for (const [index, arg] of args.entries()) { | |
const name = String(index); | |
if (arg instanceof Blob) { | |
formData.append(name, arg); | |
} else if (arg instanceof ArrayBuffer) { | |
formData.append(name, new Blob([arg])); | |
} else { | |
formData.append(name, JSON.stringify(arg)); |
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
async function exec(name, ...args) { | |
const res = await fetch(`/rpc/${name}`, { | |
method: "POST", | |
headers: { | |
"content-type": "application/json" | |
}, | |
body: JSON.stringify(args) | |
}); | |
const json = await res.json(); | |
return json; |
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
module.exports.mergeCoverageByUrl = function(coverage) { | |
const merged = {}; | |
for (const entry of coverage) { | |
if (!merged[entry.url]) { | |
merged[entry.url] = entry; | |
} | |
merged[entry.url].ranges.push(...entry.ranges); | |
} | |
Object.values(merged).forEach(entry => { | |
entry.range = convertToDisjointRanges(entry.ranges); |
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
interface State { | |
index: number; | |
name: string; | |
createdAt: number; | |
startedAt: number; | |
stoppedAt: number; | |
connectedAt: number; | |
disconnectedAt: number; | |
} |
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
function dragFrom( | |
el: Element, | |
callbacks: { | |
start?: (x: number, y: number) => void; | |
move?: (x: number, y: number) => void; | |
end?: (x: number, y: number) => void; | |
} | |
): () => void { | |
function handleMove(e: MouseEvent) { | |
callbacks.move && callbacks.move(e.clientX, e.clientY); |
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
{-| | |
import Json.Decode exposing (..) | |
import Json.Decode.Pipeline exposing (..) | |
type FooOrBar | |
= Foo String | |
| Bar Int |
NewerOlder