Skip to content

Instantly share code, notes, and snippets.

View laurakelly's full-sized avatar

Laura Kelly laurakelly

View GitHub Profile
@GEverding
GEverding / d3-fun.cljs
Created July 13, 2014 04:34
d3.js + reactjs/om + clojurescript
(defn graph [app owner opts]
(reify
om/IInitState
(init-state [_]
(let [data (:data app)
width (:width opts)
height (:height opts)
x (-> d3 .-time (.scale) (.range [0 width]))
y (-> d3 .-scale (.linear) (.range [height 0])) ]
{:width width
@tiagoa
tiagoa / Backbone.websocket.js
Created October 13, 2012 23:34
Overwrite Backbone.sync method to persist model via WebSocket
// Inspired by https://github.com/logicalparadox/backbone.iobind/blob/master/lib/sync.js
// Overwrite Backbone.sync method
Backbone.sync = function(method, model, options){
// create a connection to the server
var ws = new WebSocket('ws://127.0.0.1:1234');
// send the command in url only if the connection is opened
// command attribute is used in server-side.
ws.onopen = function(){
@mbostock
mbostock / .block
Last active November 22, 2022 23:32
Line Transition
license: gpl-3.0
@mxriverlynn
mxriverlynn / 1-referencing.js
Created July 19, 2011 13:57
using an event aggregator with backbone
MedicationView = Backbone.View.extend({
events: {
"click #edit": "editMedication"
},
editMedication: function(){
var editView = new AddEditView({model: this.model});
editView.render();
}
});