$ boot repl
boot.user=> (require :reload '[pipeline :refer [engine]]
'[mount.core :as mount])
"|| mounting... #'pipeline/engine"
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
(page "index.html" | |
(:require [tailrecursion.hoplon.reload :refer [reload-all]] | |
[clojure.set :refer [intersection]])) | |
(reload-all 0) | |
(defn random-mines [size n] | |
(loop [mines #{}] | |
(if (< (count mines) n) | |
(recur (conj mines [(rand-int size) (rand-int size)])) |
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
(ns neural-net.core) ; Copyright Eric Schulte, GPL V3 | |
(defprotocol Neural | |
"Protocol implemented by any element of a neural network." | |
(run [this x] "Evaluates the net") | |
(train [this x y d] "Trains the net returning the updated net and deltas") | |
(collect [this key] "Collect key from the network") | |
(inputs [this] "Number of inputs") | |
(outputs [this] "Number of outputs") | |
(check [this] "Ensure that the number of inputs matches the outputs")) |
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 fight-one-round [[a b :as fighters]] | |
(let [ticks (apply min (map :cooldown-remaining fighters)) | |
damage-dealt (fn [fighter] | |
(if (= ticks (:cooldown-remaining fighter)) | |
(:dmg fighter) | |
0)) | |
tick (fn [fighter] | |
(update-in fighter [:cooldown-remaining] | |
(fn [cdr] | |
(if (= cdr ticks) |
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
Every request is an endpoint to start some computation. | |
The input is the request, the output is the response. | |
Typical stages between those are: | |
Parsing, validation, storage, retrieving stored data and rendering an output. | |
Based on Ring and Compojure, we do the following to integrate routes with | |
Prismatic Graph: | |
Compojure matches the request against routes, calling the route handlers, | |
until a non nil result is returned. | |
Routes for integration with the Graph return route-keys, |
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
(page "index.html" | |
(:require [tailrecursion.hoplon.reload :refer [reload-all]] | |
[inputs :refer [slider]]) | |
(:refer-hoplon :exclude [center])) | |
(reload-all) | |
(defn px [x] (str (.floor js/Math x) "px")) | |
(defn xp [x] (int (.slice x 0 -2))) |
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
(ns racehub.om.facebook | |
(:require [cljs.core.async :as a] | |
[racehub.schema :as rs] | |
[schema.core :as s :include-macros true])) | |
;; ## Utilities | |
(defn prune | |
"Takes a mapping of keys -> new key names and a map and returns a | |
map with nils removed and keys swapped where they're present in the |
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
(ns workflow.form | |
(:require | |
[castra.core :as castra] | |
[clojure.walk :as walk] | |
[clojure.data :as data])) | |
;; Form data manager ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(defn- reset-vals! | |
[map-of-cells default] |
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
(ns inc-sandbox.corr-demo | |
(:require [clojure.set :as set]) | |
(:use (incanter core stats charts io)) | |
(:require [clj-time.core :as time]) | |
(:use (clj-time [format :only (formatter formatters parse)] | |
[coerce :only (to-long)]))) | |
(defn sym-to-dataset | |
"returns a dataset read from a local CSV in './data/' given a Yahoo Finance symbol name" | |
[yf-symbol] |
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
;;; This is my first pass at setting up virtual hosts; it works, but there is room for improvement. | |
;;; dependencies | |
;;[ring "1.1.5"] | |
;;[javax.servlet/servlet-api "2.5"] | |
;;[org.eclipse.jetty/jetty-server "7.6.1.v20120215"] | |
;;[org.eclipse.jetty/jetty-servlet "7.6.1.v20120215"] | |
(ns app.core | |
(:require [ring.util.servlet :refer (servlet)] |
OlderNewer