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
define [ | |
'zepto', | |
'backbone' | |
], ($, Backbone) -> | |
# a singleton backbone.model whose | |
# attributes represent keyboard state | |
new class extends Backbone.Model | |
# bind keyboard events to model state |
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
Backbone.Layout = Backbone.View.extend({ | |
initialize: function() { | |
// a map of selector -> view references | |
this.view_references = {}; | |
// the promises for the data | |
// required before rendering the view | |
this.promises = this.data? _.map(this.data(), function(model) { |
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
require [ | |
'zepto', | |
'osc/client', | |
'gui/range' | |
], ($, OscClient, RangeView) -> | |
osc_client = new OscClient | |
bar_view = new RangeView | |
model: osc_client |
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
# event emitter is an object which is | |
# responsible for triggering events, and binding | |
# functions to those events. | |
class EventEmitter | |
# events map event names | |
# to functions which are bound | |
# to that event. calling model.on evt, fn | |
# will add that function to the events hash. | |
events: null |
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
define([ | |
'backbone' | |
], function(Backbone) { | |
return Backbone.Collection.extend({ | |
url: '/boops' | |
}, { | |
byUserId: function(user_id) { |
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
define [ | |
'backbone', | |
'resources/user' | |
], (Backbone, User) -> | |
class extends Backbone.Model | |
idAttribute: '_id' | |
urlRoot: '/sessions' | |
defaults: |
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
Backbone.Layout = Backbone.View.extend({ | |
initialize: function() { | |
this.viewReferences = {}; | |
Backbone.View.prototype.initialize.apply(this, arguments); | |
}, | |
setView: function(selector, view) { | |
var $foundViewNode = $(selector, this.$el), | |
previousView = this.viewReferences[selector]; |
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
Backbone.CollectionLayout = Backbone.Layout.extend({ | |
initialize: function() { | |
Backbone.Layout.prototype.initialize.apply(this, arguments); | |
this.listenTo(this.collection, 'add', _.bind(this.modelAdded, this)); | |
}, | |
ItemView: Backbone.Layout, | |
modelAdded: function(model) { |
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
define([ | |
'Audiolet' | |
], ( | |
Audiolet | |
) => { | |
class Mixer extends AudioletGroup { | |
constructor(audiolet) { | |
super(audiolet, 1, 1); |
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
import random | |
import urllib | |
import urllib2 | |
import soundcloud | |
import subprocess | |
from pydub import AudioSegment | |
def get_track(client_id, sc_url): | |
client = soundcloud.Client(client_id=client_id) | |
track = client.get('/resolve', url=sc_url) |