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
static char SEGMENT_BITS = 0x7F; // 1111111 | |
static char CONTINUE_BIT = 0x80; // 1000000 | |
static char SIGN_BIT = 0x40; // 0100000 | |
void sleb128(int32_t x) { | |
unsigned char buf; | |
int negative = (x < 0); | |
while(1) { | |
buf = x & SEGMENT_BITS; // get the 7 (LSB?) | |
x >>= 7; |
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 anki(action, params) { | |
return Object.values(await (await fetch("http://127.0.0.1:8765", { | |
method: "POST", | |
body: JSON.stringify({ | |
action, | |
version: 6, | |
params | |
}) | |
})).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
function selectin(str, startstr, endstr) { | |
const starti = str.indexOf(startstr) + startstr.length | |
return str.substring(starti, str.indexOf(endstr, starti)) | |
} | |
function selectinall(str, startstr, endstr) { | |
let result = [] | |
let starti = 0 | |
while (starti < str.length) { |
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 selectin(str, startstr, endstr) { | |
const starti = str.indexOf(startstr) + startstr.length | |
if (starti == -1) return -1 | |
const endi = str.indexOf(endstr, starti) | |
if (endi == -1) return -1 | |
return str.substring(starti, endi) | |
} | |
function selectinall(str, startstr, endstr) { | |
let result = [] |
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
// Inline | |
true && console.log("hello") | |
// Multiple lines | |
true && (() => { | |
console.log("world"); | |
})(); | |