Definitely check out the awesome blog post where this code originated. It's well worth the read!
To run:
$ ghci Solution.hs
*Main> :type solution (nil :: N6)
| mods = { 'ctrl', 'alt', 'cmd' } | |
| units = { | |
| bottom = { x = 0.0, y = 0.5, w = 1.0, h = 0.5 }, | |
| left = { x = 0.0, y = 0.0, w = 0.5, h = 1.0 }, | |
| right = { x = 0.5, y = 0.0, w = 0.5, h = 1.0 }, | |
| top = { x = 0.0, y = 0.0, w = 1.0, h = 0.5 }, | |
| } | |
| animationDuration = 0 |
Definitely check out the awesome blog post where this code originated. It's well worth the read!
To run:
$ ghci Solution.hs
*Main> :type solution (nil :: N6)
| ; This doesn't work yet ;) | |
| (defn sigmoid [x] (/ 1 (- 1 (Math/exp (- x))))) | |
| (defn sigmoid' [x] (let [sigmoidx (sigmoid x)] (* sigmoidx (- 1 sigmoidx)))) | |
| (defn bs [f ^double val ^double delta] | |
| (loop [bottom -100.0 top 100.0 countdown 1000] | |
| (let [middle ^double (+ bottom (/ (- top bottom) 2)) | |
| f-mid ^double (f middle)] |
| ; Add this to your :profile section in your project.clj: | |
| :uberjar {:aot [spark.core] | |
| :injections [(require '[clojure.java.shell :as shell]) | |
| (spit "resources/version.txt" | |
| (clojure.string/trimr | |
| (:out | |
| (shell/sh "git" "rev-parse" "HEAD"))))]} | |
| ; You can read the file during runtime like this: |
I hereby claim:
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| create table foo(id int, text text); | |
| create unique index foo_id_pkey on foo(id); | |
| create sequence foo_id_seq; | |
| delete from foo where id is null; | |
| alter table foo add primary key using index foo_id_pkey; | |
| alter table foo alter id set default nextval('foo_id_seq'); | |
| ;; to hack around potentially already used sequence values | |
| select nextval('foo_id_seq'); | |
| update foo set id = id - <num skipped ids> where id >= <value of id after gap>; |
| ;; based on core.logic 0.8-alpha2 or core.logic master branch | |
| (ns sudoku | |
| (:refer-clojure :exclude [==]) | |
| (:use clojure.core.logic)) | |
| (defn get-square [rows x y] | |
| (for [x (range x (+ x 3)) | |
| y (range y (+ y 3))] | |
| (get-in rows [x y]))) |