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
# Sinatra | |
error 404 do | |
"WHAT THE HELL DID YOU DO [PERSON'S NAME HERE]?? YOU BROKE IT, PEOPLE ARE DYING, WHYY" | |
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
# incorrect | |
time = Time.zone.parse('2011-11-06T01:00:00') | |
=> Sun, 06 Nov 2011 01:00:00 PDT -07:00 | |
time.advance(hours: 1).beginning_of_hour | |
=> Sun, 06 Nov 2011 01:00:00 PDT -07:00 | |
# correct usage | |
time.utc.advance(hours: 1).change(min: 0).in_time_zone |
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
(defn rent [initial year] | |
"Calculates the rent for a given year. Assumes 1.9% increase yearly based on SF rent control." | |
(* initial (Math/pow 1.019 year))) | |
(defn rent-seq [price] | |
"Generates a lazy infinite sequence of rent increases based on a given base price." | |
(map #(rent price %) (iterate inc 0))) | |
; Get the projected rent increases for living at a place for 10 years | |
(->> (rent-seq 2000) (take 10) (map #(format "%.2f" %))) |
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
#!/usr/bin/env lein-exec | |
;;; Calculator for manual creations given a CC value | |
;;; Based on numbers from | |
;;; http://www.kongregate.com/forums/2874-idling-to-rule-the-gods/topics/453555-creating-a-universe#posts-9414071 | |
;;; | |
;;; Usage: universe.clj <cc> <number of universes> | |
(require '[clojure.pprint :refer (print-table)]) |
OlderNewer