Toggles music on/off
/micon "Dance" emote
/bgm
//Hook the splitter to the dosbox process. | |
state("dosbox", "0.74") | |
{ | |
ushort location : 0x74B6B0, 0x267CA0; | |
ushort cinematic : 0x74B6B0, 0x25A90A; | |
} | |
state("dosbox", "0.74.2-1") | |
{ |
const total = 200000 | |
const batch = 32768 | |
const tokens1 = [], tokens2 = [] | |
const one = () => { | |
tokens1.push(0); | |
if (tokens1.length > 0 && tokens2.length > 0) { | |
tokens1.splice(0, 1); | |
tokens2.splice(0, 1); | |
} |
For context on the Unhandled Rejections issue, refer to the (non-exhaustive) list of links below:
const http = require('http'); | |
const server = http.createServer(handle); | |
server.listen(3000); | |
process.on('unhandledRejection', (err) => { | |
throw err; | |
}); | |
function handle (req, res) { |
const http = require('http'); | |
const server = http.createServer(handle); | |
server.listen(3000); | |
function handle (req, res) { | |
doStuff() | |
.then((body) => { | |
res.end(body); | |
}); |
async function foo() { | |
throw new Error(); | |
} | |
foo() // 1. Unhandled at this point | |
.catch(() => console.error("an error occured")); // 2. Now it's handled | |
try { | |
await foo(); | |
} catch(e) { // 3. Handled |
// async function version | |
const { readFile } = require('fs').promises; | |
async function readJsonFile(file) { | |
// Promise is rejected if fails to read or if unexpected JSON input. | |
return JSON.parse(await readFile(file)); | |
} |
// Callback version | |
const { readFile } = require('fs'); | |
function readJsonFile(file, cb) { | |
readFile(file, (err, data) => { | |
if (err) { | |
// If error while reading file, propagate the error via callback | |
return cb(err, null); | |
} | |
// Unexpected invalid JSON input, code will throw |
Promise.reject(new Error()); // This will result in a rejection | |
new Promise((fulfill, reject) => { | |
reject(new Error()); // This will result in a rejection | |
}); | |
new Promise(() => { | |
throw new Error(); // This will result in a rejection | |
}); |