Skip to content

Instantly share code, notes, and snippets.

View DeLaGuardo's full-sized avatar
🎯
Focusing

Kirill Chernyshov DeLaGuardo

🎯
Focusing
View GitHub Profile
@DeLaGuardo
DeLaGuardo / d11.clj
Created December 11, 2024 13:14
aoc24_d11
(require '[clojure.string :as string])
(def blink
(memoize
(fn [times n]
(if (zero? times)
1
(let [l (count n)
l-half (bit-shift-right l 1)
even? (= (+ l-half l-half) l)]
(ns omnitech.shims)
(defn- closest [selector]
(this-as node
(let [node-list (.querySelectorAll js/document selector)
all (mapv #(aget node-list %) (range 0 (.-length node-list)))]
(loop [node node]
(let [parent (.-parentNode node)]
(if (some #(= parent %) all)
parent
(ns user
(:require [clojure.core.async :as async]))
(defn now-millis []
(System/currentTimeMillis))
(defn throttled-chan
"Returns a channel that will throttle attempts to take items according to the rate-limits.
rate-limits should be a sequence of pairs of integers. The first item in each pair
is describing how many items is possible to take, at most, from the input for the interval
(defmulti foo (fn [x & _] x))
(defmethod foo :sum [_ & args] (apply + args))
(apply foo (list* :sum (range 10))) ;; => ok
(apply foo (list* :sum (range 25))) ;; => Invalid arity exception
@DeLaGuardo
DeLaGuardo / deps.edn
Created October 22, 2019 12:26
Lambda analyze
{:paths ["."]}
@DeLaGuardo
DeLaGuardo / deps.edn
Last active September 13, 2019 12:05
{:deps {org.clojure/clojure {:mvn/version "1.10.1"}}
:paths ["."]}
# clj -Sdeps '{:deps {amazonica {:mvn/version "0.3.142" :exclusions [com.amazonaws/aws-java-sdk com.amazonaws/amazon-kinesis-client]} com.amazonaws/aws-java-sdk-s3 {:mvn/version "1.11.475"} com.amazonaws/aws-java-sdk-core {:mvn/version "1.11.475"}}}' -Stree
org.clojure/clojure 1.10.0
org.clojure/core.specs.alpha 0.2.44
org.clojure/spec.alpha 0.2.176
org.clojure/tools.trace 0.7.10
com.amazonaws/aws-java-sdk-core 1.11.475
com.fasterxml.jackson.core/jackson-databind 2.6.7.2
com.fasterxml.jackson.core/jackson-core 2.6.7
com.fasterxml.jackson.core/jackson-annotations 2.6.0
### Keybase proof
I hereby claim:
* I am delaguardo on github.
* I am delaguardo (https://keybase.io/delaguardo) on keybase.
* I have a public key ASCuGGRAQF2wfy-ooyMNloSDB33IEfsyI68GpEhU7tIpZAo
To claim this, I am signing this object:
@DeLaGuardo
DeLaGuardo / pragmatapro-font-lock-symbols-v2.el
Last active February 28, 2024 01:27
Snippet for support ligatures from PragmataPro font in Emacs
;; Enable ligatures without prettify-symbols
(provide 'add-pragmatapro-symbol-keywords)
(defconst pragmatapro-fontlock-keywords-alist
(mapcar (lambda (regex-char-pair)
`(,(car regex-char-pair)
(0 (prog1 ()
(compose-region (match-beginning 1)
(match-end 1)