Skip to content

Instantly share code, notes, and snippets.

View Will-Sommers's full-sized avatar

Will Sommers Will-Sommers

View GitHub Profile

Server response

(defn generate-response [data & [status]]
  {:status (or status 200)
   :headers {"Content-Type" "application/edn"}
   :body (pr-str {:1 "hi"})})
   
(om/build-all columns/columns-view (:columns data) {:init-state {:test "test"}})
(defn columns-view [data owner]
(reify
om/IRenderState
(render-state [this {:keys [edit-header? show-input? test]}]
(println (om/get-state owner))
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
@Will-Sommers
Will-Sommers / gist:9949efd7c3901ccf8b8d
Created June 13, 2014 21:31
Flash of last state text
(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)))
@Will-Sommers
Will-Sommers / ABoardName
Last active August 29, 2015 14:03
y-om-one
(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"}
(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"
# setup 2 functions
def a
puts "hi vidal"
end
def b
return "hi vidal"
end
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)
}
},
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.
@Will-Sommers
Will-Sommers / gist:4fe13e7a9383318f4bcd
Last active August 29, 2015 14:18
a terrible way to interleave names
FOLKS = %w( john
will
devin
nizar
pat
kai
sharell
hindi
chris
dave