View gist:11194485
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 com.thelastcitadel.pipeline | |
(:require [clojure.core.async :refer | |
[chan >!! <!! <! close! go thread go-loop]])) | |
(defn pipeline [things] | |
{:pre [(or (even? (count things)) | |
(every? #(and (vector? %) | |
(= 2 (count %))) things))]} | |
(let [x (->> (if (vector? (first things)) | |
things |
View blink.cljs.hl
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
(defelem blink | |
[{:keys [interval :as attr] :or {interval 1000}} kids] | |
(with-let [container (span (dissoc attr :interval) kids)] | |
(with-init! | |
(with-interval interval | |
(.toggle (js/jQuery container)))))) |
View rhino_template.rb
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
# Set up git repository | |
git :init | |
# Copy database.yml for distribution use | |
run "cp config/database.yml config/database.yml.example" | |
# Set up .gitignore files | |
run %{find . -type d -empty | xargs -I xxx touch xxx/.gitignore} | |
file '.gitignore', <<-END | |
.DS_Store |
View redis_memo.clj
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 redis-memo | |
(:require redis) | |
(:import (java.net URLEncoder))) | |
;; -------------------------------------------------------------------------------- | |
;; Default connection params | |
;; -------------------------------------------------------------------------------- | |
(def memo-server {:host "localhost" :port 6379 :db 14}) |
View hexnum-simple.rb
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
class HexNum < Numeric | |
# Create a new instance from an int or String. | |
def initialize(val) | |
case val | |
when String | |
@i = parse_string(val) | |
@s = val.frozen? ? val : val.dup.freeze | |
when Numeric | |
@i = val.to_i |
View model.js
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
MyApp.MyModel.mixin({ | |
resourcePathFor: function(action, storeKey, item) { | |
var id, path; | |
id = storeKey ? MyApp.store.idFor(storeKey) : null; | |
switch(action) { | |
case 'fetch': | |
case 'create': | |
path = 'items'; |
View peach.rb
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
require 'peach' | |
[1,2,3,4].peach{ |n| n + 1 } #Spawns 4 threads | |
[1,2,3,4].pmap{ |x| f(x) } #Spawns 4 threads, returns => [f(1),f(2),f(3),f(4)] | |
[1,2,3,4].pselect{ |x| x > 2 } #Spawns 4 threads, returns => [3,4] |
View Destructuring Examples.clj
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
;;; All Kinds of Destructuring ;;; | |
(let [foo 1] foo) | |
; => 1 | |
(let [[foo bar] [1 2 3]] [foo bar]) | |
; => [1 2] | |
(let [[foo bar & baz] [1 2 3]] [foo bar baz]) | |
; => [1 2 (3)] |
View app_builder.rb
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
class AppBuilder < Rails::AppBuilder | |
include Thor::Actions | |
include Thor::Shell | |
def test | |
append_test_gems | |
rspec | |
cucumber | |
jasmine | |
end |
View Gemfile
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
source :rubygems | |
gem 'rails' | |
# Or find something else that returns true | |
# locally, but false on heroku | |
if RbConfig::CONFIG['host_os'] =~ /darwin/ | |
group :test do | |
# heroku fails hard on this gem | |
gem 'specjour' |
OlderNewer