This file contains 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
def application_props | |
{ | |
routes: { user: { new: "/..." } }, | |
special_integer: 42 | |
} | |
end | |
def react_props!(obj) | |
application_props.merge(obj.as_json).to_json | |
end |
This file contains 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
var Hello = React.createClass({ | |
getInitialState: function() { | |
return { | |
message: "hi hi hi", | |
color: "red" | |
} | |
}, | |
updateMessage: function(event) { | |
var newValue = event.target.value; |
This file contains 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
FOLKS = %w( john | |
will | |
devin | |
nizar | |
pat | |
kai | |
sharell | |
hindi | |
chris | |
dave |
This file contains 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
We have a performance problem | |
Around 6 seconds. | |
This number belies two points. The first being that our site is slower than we would like it to be. The second is that it is not exact and gives us no idea of directionality. I’ll talk about each, in turn. | |
Our site is too slow. | |
Why in the age of cheap RAM, fast connections and copious caching is this the case. It should also be noted that while we are transitioning away from a separate mobile-only site, that the “around 6 seconds” number represents only our desktop users. |
This file contains 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 hiManish(fn, calls) { | |
var calls_count = calls; | |
return { | |
completeCall: function() { | |
calls -= 1; | |
if (this.isDone()){ | |
console.log("Begin to execute callback function") | |
fn.call(this) | |
} | |
}, |
This file contains 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
# setup 2 functions | |
def a | |
puts "hi vidal" | |
end | |
def b | |
return "hi vidal" | |
end |
This file contains 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
(def app-state (atom {:board-info {:board-name "My Board" | |
:starred false | |
:private false} | |
:sidebar {:open true} | |
:columns [{:name "To Do" :cards [{:task "Sidebar" | |
:id 0} | |
{:task "Header" | |
:id 1} | |
{:task "Create new board" |
This file contains 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
(def app-state (atom {:board-name "Yo yo yo, get it done!" | |
:columns [{:name "To Do"} | |
{:name "Doing"} | |
{:name "Done"}]})) | |
(defn column-component [data owner] | |
(reify | |
om/IRender | |
(render [_] | |
(dom/div #js {:className "column"} |
This file contains 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
(ns community.location | |
(:require [community.routes :as routes :refer [routes]] | |
[sablono.core :as html :refer-macros [html]])) | |
... | |
... | |
(defn init-location! [app-state] | |
(routes/set-route! app-state) | |
(.addEventListener js/window "popstate" (partial routes/set-route-and-clear! app-state))) |
This file contains 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 addLiTemplate(content) { | |
var template = $("#li-template").clone() // this template is hidden insid the HTML markup with css {display:none;} | |
return template.find("#todo").text(content) | |
}; | |
// or | |
function addLiTemplate(content) { | |
$('<li/>', { | |
id: 'foo', | |
text: content |
NewerOlder