This file contains hidden or 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 blob_to_buffer(blob, callback) { | |
const file_reader = new FileReader() | |
file_reader.addEventListener("loadend", event => { | |
if (file_reader.error) { | |
callback(file_reader.error) | |
} else { | |
callback(null, new Buffer(file_reader.result)) | |
} | |
}, false) |
This file contains hidden or 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
// first setup our stacks of history states | |
// (const refers to the reference to the arrays, but they arrays themselves are mutable) | |
const undos = []; | |
const redos = []; | |
// undo and redo are symmetrical operations, so they *could* be factored to use an "undoOrRedo" / "stepHistory" function that takes two stacks as arguments, but it might be clearer as two functions | |
const undo = () => { | |
if (undos.length < 1) { return false; } |
This file contains hidden or 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
#!/usr/bin/env node | |
// This script enables all ESLint rules that have the exact comment "// TODO: enable" at the end of the line, | |
// one by one, and commits the changes to git, including eslint auto-fixes. | |
// If it runs into errors, it stashes the changes and continues with the next rule. | |
const fs = require('fs'); | |
const { EOL } = require('os'); | |
const { execSync } = require('child_process'); | |
const run = (cmd, options) => { |
OlderNewer