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
Ember.Handlebars.helper('html', function(tweet, options) { | |
var replaceUrls = function(text, urlData) { | |
var start = urlData.indices[0]; | |
var end = urlData.indices[1]; | |
return text.slice(0, start) + '<a href="' + urlData.expanded_url + '">' + urlData.display_url + '</a>' + text.slice(end); | |
} | |
// Essentially there is no way to extract urls from RTs from the data Twitter provides | |
// so we might as well go simply matching urls in the text | |
var text = tweet.get('text').replace(/\n/g, '<br />'); |
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
SHELL = /bin/sh | |
# V=0 quiet, V=1 verbose. other values don't work. | |
V = 0 | |
Q1 = $(V:1=) | |
Q = $(Q1:0=@) | |
n=$(NULLCMD) | |
ECHO1 = $(V:1=@$n) | |
ECHO = $(ECHO1:0=@echo) |
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
becameInvalid: -> | |
@get('transaction').remove(this) | |
transaction = App.store.transaction() | |
transaction.add(this) # => Uncaught Error: assertion failed: Once a record has changed, you cannot move it into a different transaction |
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 benchmark-assoc.core | |
(:require [criterium.core :as crit])) | |
(defn no-assoc [items] | |
(apply hash-map (vec (flatten items)))) | |
(defn assoc-all [items] | |
(apply assoc {} (vec (flatten items)))) | |
(defn assoc-each-one [items] |
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 group-by-reducers.core | |
(:require [clojure.core.reducers :as r :only [fold reduce map]]) | |
(:require [criterium.core :as c])) | |
(defn group-by-naive [f coll] | |
(reduce | |
(fn [groups a] | |
(assoc groups (f a) (conj (get groups a []) a))) | |
{} | |
coll)) |