Skip to content

Instantly share code, notes, and snippets.

View voidlily's full-sized avatar

voidlily

View GitHub Profile
@voidlily
voidlily / universe.clj
Last active January 30, 2017 03:31
Calculate prereqs for a universe in ITRTG
#!/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)])

Keybase proof

I hereby claim:

  • I am voidlily on github.
  • I am voidlily (https://keybase.io/voidlily) on keybase.
  • I have a public key whose fingerprint is 4B1E A1C7 B11F 4C68 D8C8 BC84 D934 B57D E289 5156

To claim this, I am signing this object:

@voidlily
voidlily / clickerheroes.clj
Last active August 29, 2015 14:24
Clicker Heroes ancient levels calculator
#!/usr/bin/env lein-exec
;;; Ancient calculator based on the following links
;;;
;;; https://www.dropbox.com/s/pu0wem11sn13qki/ClickerHeroes-Ideal.pdf?dl=0
;;; https://www.reddit.com/r/ClickerHeroes/comments/339m3j/thumbs_up_the_rules_of_thumb/
;;;
;;; Usage: clickerheroes.clj <siylatas level> <optimal zone>
;;; optimal zone is the zone where your gilded hero stops one shotting
;;; early game is until atlas
alias tmux-alias="tmux new-session -A -s foo"
# Usage
tmux-alias # Attaches to existing "foo" session or makes a new "foo" session in the current directory
tmux-alias -c /tmp # Attaches to existing "foo" session or makes a new "foo" session in /tmp

Keybase proof

I hereby claim:

  • I am voidlily on github.
  • I am voidlily (https://keybase.io/voidlily) on keybase.
  • I have a public key whose fingerprint is BBF4 6311 39A1 AE78 5DF8 784F 10D8 CF3B 5F7E EB02

To claim this, I am signing this object:

(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" %)))
# 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
# Sinatra
error 404 do
"WHAT THE HELL DID YOU DO [PERSON'S NAME HERE]?? YOU BROKE IT, PEOPLE ARE DYING, WHYY"
end
source 'http://rubygems.org'
gem 'sequel'
gem 'rspec'
gem 'sqlite3'
foo = lambda do |a|
b = a + 5
b
end
b = 2
foo.call(b)
=> 7
b