Skip to content

Instantly share code, notes, and snippets.

View featheredtoast's full-sized avatar
🏠
Working from home

Jeff Wong featheredtoast

🏠
Working from home
View GitHub Profile
@featheredtoast
featheredtoast / index.html
Created April 18, 2021 22:34
animation logo
<html>
<head>
<style>
:root {
--base-color: #f06721;
--highlight-color: #e8976f;
}
#luz-logo{
fill: var(--base-color);
}
### Keybase proof
I hereby claim:
* I am featheredtoast on github.
* I am featheredtoast (https://keybase.io/featheredtoast) on keybase.
* I have a public key ASDiV6MKV5qwcZfez_0NAyKJaK4_VpNBvw7o66kqG96oUwo
To claim this, I am signing this object:
@featheredtoast
featheredtoast / mastermind-macro-2.clj
Last active June 10, 2018 00:30
logic solving the mastermind thing.
(ns logic-foo.core
(:use [clojure.core.logic]
[clojure.core.logic.pldb]
[clojure.tools.macro]))
(defmacro mastermind
[spaces possibles unknown-pos known-pos]
(let [q (gensym)
arg (gensym)
syms (mapv (fn [_] (gensym)) (range spaces))]
@featheredtoast
featheredtoast / index.html
Created March 8, 2018 23:42
promise vs await tests
<html>
<head>
<script>
var args = {
headers: new Headers({
'Content-Type': 'text/plain'
})};
async function useAwaits() {
try {
let resp = await fetch("https://en.wikipedia.org/w/api.php?action=opensearch&format=json&origin=*&search=stack&limit=10", args);
@featheredtoast
featheredtoast / css-grid.css
Created February 22, 2018 16:03
css grid demo
body {
margin: 0;
height: 100vh;
background-color: white;
display: grid;
grid-template-columns: 1fr 1fr 120;
grid-template-rows: 50px auto 20px;
grid-template-areas:
"header header header"
"secondary main sidebar"
@featheredtoast
featheredtoast / reduce-tests.clj
Created January 19, 2018 17:20
reduce and reduced tinkering...
(if (reduce (fn [a v] (if (< 2 v) (reduced v) v)) [1 2 3 4 5])
"reduced"
"no") ;; reduced
(let [res (reduce (fn [a v] (if (< 2 v) (reduced v) v)) [1 2 3 4 5])]
(if (reduced? res)
"reduced"
"no")) ;; no
@featheredtoast
featheredtoast / advent-day-3.clj
Last active December 19, 2017 20:37
advent day 3
(defn find-adjacent-coordinate [[x y] direction]
(condp = direction
:right [(inc x) y]
:up [x (inc y)]
:left [(dec x) y]
:down [x (dec y)]))
(defn find-turn [direction]
(direction {:right :up
:up :left
(defn parse-input [str]
(->> (clojure.string/split-lines str)
(mapv #(clojure.string/split % #"\s"))))
(defn convert-to-nums [row]
(mapv #(Integer/parseInt %) row))
(defn find-row-diff [row]
(println "finding max of " row)
(- (apply max row) (apply min row)))
@featheredtoast
featheredtoast / advent-day-1-part-2.clj
Created December 15, 2017 06:13
advent 2017 day 1
(defn double-up [coll]
(->> (repeat coll)
(take 2)
(apply concat)))
(defn split-out-by-parts [length coll]
(->> (partition (inc (/ (count coll) 4)) 1 coll )
(take length)
(map (juxt first last))))
@featheredtoast
featheredtoast / knots-part2.clj
Last active December 12, 2017 07:31
advent day 10
(defn tie-knot-round
[current-list knot-lengths skip-size offset]
(if (empty? knot-lengths)
{:result current-list :skip-size skip-size :offset offset}
(let [cycle-list (cycle current-list)
knot-length (first knot-lengths)
non-knot-length (- (count current-list) knot-length)
new-offset (mod (+ knot-length skip-size offset) (count current-list))
reversed-list (reverse (take knot-length cycle-list))
rest-of-list (take non-knot-length (drop knot-length cycle-list))