Skip to content

Instantly share code, notes, and snippets.

View escherize's full-sized avatar

bryan escherize

View GitHub Profile
(ns escherize.kenning
(:require [selmer.parser :as parser]))
(defmacro ^:private env-map []
`(apply zipmap [(mapv keyword (quote ~(keys &env))) (vector ~@(keys &env))]))
(defn ^:private resolve-kw [env kw]
(when-let [found-sym (or
(get env kw nil)
(try (eval (symbol kw))
;; Middleware is a way to define a stack of operations applied to a function
;; call. It's a common pattern for parsing and handling http requests. A
;; handler function is wrapped by a middleware function. Let's narrow in on
;; http handling, then:
;; Let's call a 'handler function' a function that accepts as its input a
;; request, and returns a response.
(defn my-handler-fn [request]
{:status 200 :body "42"})
{:nov-21
[["9:00AM - 9:10AM" {:speaker "Welcome"}]
["9:10AM - 9:50AM"
[{:speaker "Derek Troy-West",
:title "Follow the Data: Product Development in Clojure",
:link "http://2019.clojure-conj.org/speaker-derek-troy-west/"}]]
["10:00AM - 10:40AM"
[{:speaker "Ariel Ortiz",
:title "The Hitchhikers Guide to Multiparadigm Programming",
:link "http://2019.clojure-conj.org/speaker-ariel-ortiz/"}]]
(ns super-sratch.minstack)
(defprotocol Stack (push [this x]) (peek [this]) (pop [this]))
(defprotocol FindMin (find-min [this]))
(defprotocol FindMax (find-max [this]))
(defrecord fmm-stack [stack minstack maxstack]
Stack
(push [this x]
(merge this {:stack (vec (conj stack x))}
import CoreGraphics
var display_id = CGMainDisplayID();
// "BGRA"
print(display_id);
import CoreGraphics
var display_id = CGMainDisplayID();
print(display_id);
import CoreGraphics
var id = CGMainDisplayID();
print(id);
import CoreGraphics
Any id = CGMainDisplayID();
print(id)
import numpy as np
a = np.array([[6, 0, 0], # 6 shoes
[2, 2, 2], # 2 shoes, 2 boys, 2 whistles
[0, 1, 3]]) # 1 boy, 3 whistles
b = np.array([30, 20, 13])
[shoe, boy, whistle] = np.linalg.solve(a,b)
print("\nshoe=", shoe, "\nboy=", boy, "\nwhistle=", whistle)
# shoe= 5.0
import numpy as np
a = np.array([[6, 0, 0], [2, 2, 2], [0, 1, 3]])
b = np.array([30, 20, 13])
[shoe, boy, whistle] = np.linalg.solve(a,b)
print("\nshoe=", shoe, "\nboy=", boy, "\nwhistle=", whistle)
print("shoe + boy * whistle = ", shoe + boy * whistle)