Skip to content

Instantly share code, notes, and snippets.

View johnwalker's full-sized avatar
💭
what is this status for

John Walker johnwalker

💭
what is this status for
View GitHub Profile
(let [day->index (into {} (map-indexed (fn [k v] [v k]) "MTWRFSN"))
;; So M (Monday) maps to 0, S (Saturday) maps to 5
initial-state (into [] (repeat 7 0))]
;; Create an empty vector of seven zeroes
(reduce (fn [x i] (assoc x i 1)) initial-state (map day->index "MWF")))
;; Map each day to an index.
;; (day->index \M) is 0
;; so (map day->index "MWF)
;; is (0 2 4)
;; But we want [1 0 1 0 1 0 0]
@johnwalker
johnwalker / abbreviatons.edn
Created August 13, 2014 20:48
abbreviatons.edn
`{:org.clojure/clojurescript #{"clojurescript" "cljs"}
:org.clojure/core.async #{"core.async" "async"}
:org.clojure/core.cache #{"core.cache" "cache"}
:org.clojure/core.logic #{"core.logic" "logic"}
:org.clojure/core.match #{"core.match" "match"}
:org.clojure/core.memoize #{"core.memoize" "memoize"}
:org.clojure/core.typed #{"core.typed" "typed"}
:org.clojure/data.json #{"data.json" "json"}
:org.clojure/data.xml #{"data.xml" "xml"}
:org.clojure/java.jdbc #{"java.jdbc" "jdbc"}
{:+ {:editor.keys.hinting.active {"tab" [:auto-complete]
"esc" [:auto-complete.remove]
"down" [(:filter-list.input.move-selection 1)]
"up" [(:filter-list.input.move-selection -1)]
"ctrl-n" [(:filter-list.input.move-selection 1)]
"ctrl-p" [(:filter-list.input.move-selection -1)]}
:app {"alt-x" [:show-commandbar-transient]
"ctrl-x o" [:tabs.next]
"ctrl-x ctrl-f" [:navigate-workspace-transient]
"ctrl-x ctrl-s" [:save]
;; User keymap
;; -----------------------------
;; Keymaps are stored as a set of diffs that are merged together together
;; to create the final set of keys. You can modify these diffs to either add
;; or subtract bindings.
;;
;; Like behaviors, keys are bound by tag. When objects with those tags are active
;; the key bindings are live. Keys can be bound to any number of Light Table commands,
;; allowing you the flexibility to execute multiple operations together. To see a list
;; of all the commands you can execute, start typing a word related to the thing you
{:+ {:app {"pmeta-r" [:refresh-connected-browser]
"pmeta-shift-n" [:window.new]
"pmeta-o" [:navigate-workspace-transient]
"pmeta-shift-o" [:open-file]
"pmeta-shift-f" [:searcher.show]
"ctrl-shift-d" [:docs.search.show]
"pmeta-n" [:new-file]
"ctrl-space" [:show-commandbar-transient]}
:editor {"pmeta-enter" [:eval-editor-form]
"pmeta-shift-enter" [:eval-editor]
(ns coogle.core
(use [clojure.core.typed]
[clojure.core.typed.base-env]
[compojure.core])
(require [compojure.route :as route]
[hiccup.core :refer [html]])
(:gen-class))
(cf +)
(defmacro get-sigs [symbols]
`(zipmap ~symbols
(defun backward-whitespace-line ()
(interactive)
(let ((n (current-column)))
(beginning-of-line)
(backward-word)
(move-to-column n)))
(defun forward-whitespace-line ()
(interactive)
(let ((n (current-column)))
(ns nested-vector-ops)
(def nested-vector [[:salt 0 5 :deviation 5 10]
[:milk 5 4 :deviation 1 2]
[:cream 0 0 :deviation 0 0]])
(->>
nested-vector
(remove (fn [[_ _ _ _ a]] (= "N/A" a)))
(sort-by (fn [[_ _ _ _ a]] a))
(ns peg-game.core
(:require
[cljs.core.async :as async
:refer [<! >! chan close! sliding-buffer put! alts! timeout]]
[jayq.core :refer [$ append ajax inner css $deferred
when done resolve pipe on bind attr
offset] :as jq]
[goog.dom :as dom]
[goog.events :as events]
[monet.canvas :as monet])
(ns doesthisactuallywork)
(defprotocol foobar
(foo [x y])
(bar [{x :x} {y :y z :z}] [x y z]))
(defrecord foobarrec [a]
foobar
(foo [x {y :y z :z}] [(:a x) y z])
(bar [{x :a} {y :y z :z}] [x y z]))