This file contains hidden or 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 execute-instruction! [opcode input offset] | |
(let [p1 (nth input (+ 1 offset)) | |
p2 (nth input (+ 2 offset)) | |
p3 (nth input (+ 3 offset)) | |
op (case opcode | |
1 + | |
2 *)] | |
(->> (op (nth input p1) (nth input p2)) | |
(assoc! input p3)))) |
This file contains hidden or 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
(def input | |
(->> (clojure.string/split (slurp "src/day01_input") #"\s") | |
(map read-string))) | |
(defn calc-fuel [m] | |
(-> m (/ 3) int (- 2))) | |
(defn solve-day1-p1 [input] | |
(->> (map calc-fuel input) | |
(reduce +))) |
This file contains hidden or 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 test.core) | |
(defn add [^i32 a ^i32 b] | |
(let [x 1 | |
y 2] | |
(if (= a b) | |
(+ x y) | |
(+ a b)))) | |
(defn main [] |
This file contains hidden or 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
type Thunk = Function; | |
type Result = any; | |
class Adapton { | |
thunk: Thunk; | |
result: Result; | |
sub: Set<Adapton>; | |
sup: Set<Adapton>; | |
isClean: boolean; |
This file contains hidden or 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
[data-testid="sidebarColumn"] { | |
display: none; | |
} | |
[data-testid="primaryColumn"] { | |
max-width: 1000px; | |
} | |
[data-testid="primaryColumn"] > div:first-child > div:nth-child(3) { | |
max-width: 800px; | |
} | |
[aria-label=Primary] > a > div > div:nth-child(2), |
This file contains hidden or 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
createStore({ | |
dropTargetIDToBoxID: { | |
"drop1": "box1" | |
"drop2": "box2" | |
"drop3": null | |
}, | |
boxes: { | |
"box1": {x:0, y: 0}, | |
"box2": {x:100, y: 100}, | |
} |
This file contains hidden or 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
{:share-link-id #uuid "7fe2a3a4-6b2c-442b-ba59-d90abed2d700", | |
:updated-at #inst "2019-05-24T16:04:53.297-00:00", | |
:owned? false, | |
:title "I like trams too", | |
:document-id #uuid "1aa3ef49-e16a-4c1e-b034-3b3ac4d006a3", | |
:preview-slide | |
{:entity-type :slide, | |
:theme | |
{:entity-type :style, | |
:name "Pitch Default", |
This file contains hidden or 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 css.macros | |
(:require [clojure.string :as string])) | |
(defn static? [s] | |
(or (string? s) | |
(keyword? s) | |
(number? s))) | |
(def px-vals | |
#{:font-size :top :left :right :bottom :width :height |
This file contains hidden or 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
(defonce db (atom {})) | |
(defn sub [f] | |
(let [state (uix/state #(f @db))] | |
(uix/layout-effect! | |
(fn [] | |
(let [id (random-uuid)] | |
(add-watch db id (fn [_ _ o n] | |
(let [of (f o) | |
nf (f n)] |
This file contains hidden or 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 use-ratom [r] | |
(let [[state force-update] (js/React.useState @r)] | |
(js/React.useLayoutEffect | |
(fn [] | |
(let [id (random-uuid)] | |
(add-watch r id (fn [_ _ o n] | |
(when (not= o n) | |
(force-update n)))) | |
#(remove-watch r id))) | |
#js [r]) |