View this code at http://livecoding.io/5814072
This file contains hidden or 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
| SELECT d.day, s.description, SUM(1) AS count | |
| FROM (SELECT current_date - days.day AS day FROM generate_series(0, | |
| (SELECT CAST(EXTRACT(epoch FROM NOW() - DATE(MIN(start_date))) / 86400 AS integer) FROM pivotal_tracker_story_histories) | |
| ,1) AS days(day)) d INNER JOIN pivotal_tracker_story_histories h ON d.day BETWEEN h.start_date AND COALESCE(h.end_date, current_date) | |
| INNER JOIN pivotal_tracker_story_statuses s ON s.id = h.status_id | |
| GROUP BY d.day, s.description | |
| ORDER BY d.day, s.description |
This file contains hidden or 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 default-students ["Alice" "Bob" "Charlie" "David" "Eve" "Fred" "Ginny" | |
| "Harriet" "Ileana" "Joseph" "Kincaid" "Larry"]) | |
| (def seeds { "G" :grass "C" :clover "R" :radishes "V" :violets }) | |
| (defn row-to-seeds [row-string] | |
| (map seeds (rest (clojure.string/split row-string #"")))) | |
| (defn garden-to-rows [garden] | |
| (clojure.string/split-lines garden)) |
This file contains hidden or 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
| (defn pack [coll] | |
| "pack duplicates into sublists" | |
| (loop [acc '(()) | |
| fst (first coll) | |
| rst (rest coll)] | |
| (let [current (first (first acc)) | |
| added-to-current (cons (cons fst (first acc)) (rest acc)) | |
| added-new-sublist (cons (list fst) acc)] | |
| (if (seq rst) | |
| (if (or (nil? current) (= current fst)) |
This file contains hidden or 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
| (#(map (fn [i] (take i %1)) (range 1 (inc (count %1)))) '(1 2 3)) | |
| # => ((1) (1 2) (1 2 3)) | |
| (#(map (fn [i] (take i %1)) (range 1 (inc (count %1)))) [:a :b :c]) | |
| # => ((:a) (:a :b) (:a :b :c)) |
This file contains hidden or 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
| casper = require('casper').create | |
| logLevel: 'debug' | |
| fs = require('fs') | |
| username = casper.cli.args[0] | |
| password = casper.cli.args[1] | |
| currentProblem = 1 | |
| problemCount = 173 | |
| getProblem = (number) -> |
This file contains hidden or 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
| # prerequisites: Ruby 1.9.3, Rails 3.2.something recent | |
| ### | |
| ### Setup rails app w/haml and opal | |
| ### | |
| # create app | |
| rails new opal_test | |
| # add to Gemfile below rails |
This file contains hidden or 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
| /* | |
| Newtonian collision checking (draft) | |
| based on the paper: http://www.vobarian.com/collisions/2dcollisions2.pdf | |
| [email protected] | |
| */ | |
| if (typeof d3.z != "object") d3.z = {}; | |
| (function() { |
This file contains hidden or 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
| <html> | |
| <body> | |
| <script type="text/javascript" src="http://raw.github.com/mbostock/d3/v2.10.3/d3.v2.min.js"></script> | |
| <script type="text/javascript"> | |
| var svg = d3.select('body').append('svg') | |
| .attr('width', '100%') | |
| .attr('height', '100%') | |
| .attr('viewBox', '0 0 280 200'); | |
| var data = [[5, 15], |
This file contains hidden or 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
| /* see http://joshmcarthur.com/2012/05/14/bootstrap-tablesorter-styles.html */ | |
| table .header { | |
| cursor: pointer; | |
| } | |
| table .header:after { | |
| content: ""; | |
| float: right; | |
| margin-top: 7px; | |
| border-width: 0 4px 4px; | |
| border-style: solid; |