Skip to content

Instantly share code, notes, and snippets.

View zoldar's full-sized avatar

Adrian Gruntkowski zoldar

View GitHub Profile
(ns scratch.hangman
(:gen-class))
;; Game logic
(def game {:mistakes 0 :word [\h \a \n \d] :guess [:_ :_ :_ :_]})
(defn game-lost? [{:keys [mistakes]}]
(>= mistakes 9))
@zoldar
zoldar / gist:6425609
Last active December 22, 2015 05:39
sort vs frequencies
user=> (def word "sadfasdfagrregwfagfregawgfresafafewrf")
#'user/word
user=> (time (dotimes [i 10000] (doall (sort word))))
"Elapsed time: 99.122541 msecs"
nil
user=> (time (dotimes [i 10000] (doall (sort word))))
"Elapsed time: 96.896736 msecs"
nil
user=> (time (dotimes [i 10000] (doall (sort word))))
"Elapsed time: 95.14145 msecs"
;(setq inferior-lisp-program "/home/zoldar/Programy/sbcl/bin/sbcl") ; your Lisp system
;(setq inferior-lisp-program "/home/zoldar/bin/ecl") ; your Lisp system
;(add-to-list 'load-path "/home/zoldar/LISP/clbuild/source/slime/") ; your SLIME directory
;(require 'slime-autoloads)
;(slime-setup '(slime-repl))
(add-to-list 'load-path "~/.emacs.d/plugins")
;; package
(require 'package)
(add-hook 'clojure-mode-hook
(lambda ()
(local-set-key "C-," 'midje-check-fact)
(local-set-key "C-k" 'midje-clear-comments)))
@zoldar
zoldar / core.clj
Created December 16, 2012 02:05
Exploration of compojure and cemerick/friend with an angle towards integration of cemerick/friend with librarian-clojure.
(ns friendtest.core
(:use midje.sweet
ring.mock.request
compojure.core
friendtest.core
[ring.middleware.session store memory]
[ring.middleware.session.memory :only (memory-store)]
[ring.middleware.session :only (wrap-session)]
[cemerick.friend.util :only (gets)])
(:require [compojure [handler :as handler]]
;; WARNING: the code here wasn't tested in REPL
(ns space-age)
(def earth-year-in-seconds 31557600.0)
(def orbital-periods
{:mercury 0.2408467
:venus 0.61519726
:mars 1.8808158

Keybase proof

I hereby claim:

  • I am zoldar on github.
  • I am zoldar (https://keybase.io/zoldar) on keybase.
  • I have a public key ASDVeZ9C9El_-5m9TgkwZI3fOkv30zUoVsEDkxvUKoK6oQo

To claim this, I am signing this object:

defmodule Clubbase.AssertionRunner do
def test_assertion(assertion) do
quote do
test unquote(assertion["description"]) do
unquote(assertion["description"]) |> IO.inspect
end
end
end
defmacro test_assertions(assertions_path) do

Keybase proof

I hereby claim:

  • I am zoldar on github.
  • I am zoldar (https://keybase.io/zoldar) on keybase.
  • I have a public key ASCbqUdiClmUZTaoz82IRTT6ep9vX9JVSod-p_FNIroM2Ao

To claim this, I am signing this object:

// pickaroo: Money
pub type Currency {
USD
EUR
PLN
}
pub type Money {
Money(cents: Int, currency: Currency)