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
'.fuzzy-finder atom-text-editor': | |
'cmd-i': 'custom:fuzzy-finder-import' |
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
atom.commands.add '.fuzzy-finder', 'custom:fuzzy-finder-import', (e) -> | |
# utilities | |
{ relative, basename, dirname } = require 'path' | |
getSelectedFilePathFromFuzzyFinderAndCloseIt = -> | |
# weird hack to acquire space-pen instance — suggestions welcome | |
{ $ } = window.require 'space-pen' |
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
// Conerts the in-song position to in-game position. | |
secondsToPosition(seconds) { | |
return this.beatToPosition(this.secondsToBeat(seconds)) | |
} |
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
// Converts the beat number to in-song position (seconds) | |
beatToSeconds(beat) { | |
return this._timing.beatToSeconds(beat) | |
} | |
// Converts the beat number to in-game position. | |
beatToPosition(beat) { | |
return this._positioning.position(beat) | |
} |
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
on (...args) { | |
return this._events.on(...args) | |
} | |
off (...args) { | |
return this._events.off(...args) | |
} |
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
export function musicalScorePromiseFromGarageBandFile (buffer) { | |
return (doSomeScaryAsynchronousWork(buffer) | |
.then(obtainMusicalScoreNotes) | |
.then(notes => new MusicalScore({ notes })) | |
) | |
} |
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
export class MusicalScore { | |
constructor ({ notes }) { | |
invariant(Array.isArray(notes), 'notes must be an array') | |
this._notes = notes | |
} | |
get notes () { | |
return this._notes | |
} | |
static fromMIDIFile (midiBuffer) { | |
let notes = [ ] |
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 mouseFactory () { | |
return Object.assign(new Animal, { | |
animalType: 'mouse', | |
furColor: 'brown', | |
legs: 4, | |
tail: 'long, skinny' | |
}) | |
} |
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
class Animal { | |
describe () { | |
return `An ${this.animalType} with ${this.furColor} fur, | |
${this.legs} legs, and a ${this.tail} tail.` | |
} | |
static mouse () { | |
return Object.assign(new Animal, { | |
animalType: 'mouse', | |
furColor: 'brown', | |
legs: 4, |