Skip to content

Instantly share code, notes, and snippets.

View dtinth's full-sized avatar
🎶
𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪

Thai Pangsakulyanont dtinth

🎶
𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪
  • @bemusic                 @creatorsgarten                 @eventpop                 @showdownspace                 @spacetme                @wonderfulsoftware                
  • Krungthepmahanakhonamonrattanakosinmahintharayutthayamahadilokphopnoppharatratchathaniburiromudomratchaniwetmahasathanamonphimanawatansathitsakkathattiyawitsanukamprasit (Bangkok), Thailand
  • YouTube @dtinth
View GitHub Profile
@dtinth
dtinth / ใครคือโจร.md
Created October 29, 2015 16:16
ใครคือโจร? (แก้ด้วยภาษา Ruby)

'.fuzzy-finder atom-text-editor':
'cmd-i': 'custom:fuzzy-finder-import'
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'
// Conerts the in-song position to in-game position.
secondsToPosition(seconds) {
return this.beatToPosition(this.secondsToBeat(seconds))
}
// 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)
}
on (...args) {
return this._events.on(...args)
}
off (...args) {
return this._events.off(...args)
}
export function musicalScorePromiseFromGarageBandFile (buffer) {
return (doSomeScaryAsynchronousWork(buffer)
.then(obtainMusicalScoreNotes)
.then(notes => new MusicalScore({ notes }))
)
}
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 = [ ]
function mouseFactory () {
return Object.assign(new Animal, {
animalType: 'mouse',
furColor: 'brown',
legs: 4,
tail: 'long, skinny'
})
}
@dtinth
dtinth / animal.js
Last active October 20, 2015 15:12
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,