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
[ | |
{ | |
"id":"shfksjh32hrkwefhkj3h", | |
"text":"# Example default note\n\n- [Laconia](https://laconia.dev)\n- [Chip8.js](https://github.com/taniarascia/chip8", | |
"created":"", | |
"lastUpdated":"" | |
}, | |
{ | |
"id":"893hfehfkjshkj233", | |
"text":"# Another something else\n\nEveryone loves notes", |
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
method1 = async () => { | |
const things = await getThings() | |
for (let thing of things) { | |
const stuff = await getStuffFromThing(thing) | |
console.log(stuff) // works | |
} | |
} | |
method2 = async () => { |
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
(this == that || these == those) is (this != that && these != those) | |
!(a && b) == (!a || !b) | |
!(a || b) == (!a && !b) |
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
# open all files named package.json within a directory | |
find . -name package.json -exec code {} + | |
# don't open or jump anywhere | |
<a href="#!"> | |
# get an object from console | |
> store as a global variable | |
JSON.stringify(temp1) |
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 compareProperty(a, b) { | |
return a || b ? (!a ? 1 : !b ? -1 : a.localeCompare(b)) : 0 | |
} | |
function myComparer(a, b) { | |
return compareProperty(a.jewelerName, b.jewelerName) || compareProperty(a.name, b.name) | |
} | |
// Flatten array | |
const flattened = [].concat.apply([], tableAssignmentsLookup) |
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
// 0nnn - SYS addr | |
// 00E0 - CLS | |
// 00EE - RET | |
// 1nnn - JP addr | |
// 2nnn - CALL addr | |
// 3xkk - SE Vx, byte | |
const INSTRUCTION_SET = [ | |
{ | |
name: 'SYS', |
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
class RomBuffer { | |
constructor(filename) { | |
// 16-bit big endian values | |
this.data = [] | |
let buffer = fs.readFileSync(filename) | |
if (buffer.length % 2 !== 0) throw new Error('Epic ROM Fail') | |
for (let i = 0; i < buffer.length; i += 2) { | |
this.data.push((buffer[i] << 8) | (buffer[i + 1] << 0)) |
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
// echo -en "\x01\x02\x03\x04\x05\x06hello world\x07\x08\x09\x10goodbye world\x11\x12\x13\x14\x15" > data | |
let fs = require('fs') | |
let file = process.argv.slice(2)[0] | |
function hexdump(file) { | |
let buffer = fs.readFileSync(file) | |
let lines = [] | |
for (let i = 0; i < buffer.length; i += 16) { |
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 fs = require('fs') | |
const filename = process.argv.slice(2)[0] | |
function hexdump(filename) { | |
let buffer = fs.readFileSync(filename) | |
let lines = [] | |
for (let i = 0; i < buffer.length; i += 16) { | |
let address = i.toString(16).padStart(8, '0') // address | |
let block = buffer.slice(i, i + 16) // cut buffer into blocks of 16 |
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
// echo -en "\x01\x02\x03hello" > data | |
// node read.js data | |
let fs = require('fs') | |
let file = process.argv.slice(2)[0] | |
let buffer = fs.readFileSync(file) | |
for (let value of buffer) { | |
let decimal = value | |
let hex = value.toString(16) |