Skip to content

Instantly share code, notes, and snippets.

View minikomi's full-sized avatar
🍕
I like pizza

Adam Moore minikomi

🍕
I like pizza
View GitHub Profile
(ns getlife.core
(:gen-class)
(:require [crouton.html :as html]
[com.rpl.specter :as s]
[clojure.string :as str]
[clojure.data.csv :as csv]
[clojure.java.io :as io]
))
(defn parse-page [n]
@minikomi
minikomi / processing.clj
Last active June 12, 2018 06:41
Async processing for plumatic.plumbing/graph
;; This buffer is for Clojure experiments and evaluation.
;; Press C-j to evaluate the last expression.
(set-env! :dependencies #(into % '[[prismatic/plumbing "0.5.5"]]))
(require '[clojure.core.async :as async :refer [>!! alts! chan close! go-loop timeout]])
(require '[plumbing.core :as p])
(require '[plumbing.graph :as g])
(require '[plumbing.fnk.pfnk :as pfnk])
;; smooth scroll
(def SCROLL_DURATION 550)
(def HEADER_HEIGHT 85)
(defn quad-out [p] (- (* p (- p 2))))
(defonce SMOOTH_SCROLL_ACTIVE (atom false))
(defn cancel-scroll-animation []
(reset! SMOOTH_SCROLL_ACTIVE false)
(goog.events/unlisten js/window event-type/WHEEL cancel-scroll-animation)
/ Daily Programmer #353
/ inputs
i1:("ATCAATATCAA";"ATTAAATAACT";"AATCCTTAAAC";"CTACTTTCTTT";"TCCCATCCTTT";"ACTTCAATATA")
i2:";"\"AACACCCTATA;CTTCATCCACA;TTTCAATTTTC;ACAATCAAACC;ATTCTACAACT;ATTCCTTATTC;ACTTCTCTATT;TAAAACTCACC;CTTTTCCCACC;ACCTTTTCTCA;TACCACTACTT"
i3:";"\"ACAAAATCCTATCAAAAACTACCATACCAAT;ACTATACTTCTAATATCATTCATTACACTTT;TTAACTCCCATTATATATTATTAATTTACCC;CCAACATACTAAACTTATTTTTTAACTACCA;TTCTAAACATTACTCCTACACCTACATACCT;ATCATCAATTACCTAATAATTCCCAATTTAT;TCCCTAATCATACCATTTTACACTCAAAAAC;AATTCAAACTTTACACACCCCTCTCATCATC;CTCCATCTTATCATATAATAAACCAAATTTA;AAAAATCCATCATTTTTTAATTCCATTCCTT;CCACTCCAAACACAAAATTATTACAATAACA;ATATTTACTCACACAAACAATTACCATCACA;TTCAAATACAAATCTCAAAATCACCTTATTT;TCCTTTAACAACTTCCCTTATCTATCTATTC;CATCCATCCCAAAACTCTCACACATAACAAC;ATTACTTATACAAAATAACTACTCCCCAATA;TATATTTTAACCACTTACCAAAATCTCTACT;TCTTTTATATCCATAAATCCAACAACTCCTA;CTCTCAAACATATATTTCTATAACTCTTATC;ACAAATAATAAAACATCCATTTCATTCATAA;CACCACCAAACCTTATAATCCCCAACCACAC"
; macros
(defmacro eval-after-load-all (features form)
"Arrange that if, and only if, all `FEATURES' are loaded, `FORM' is evaluated."
(declare (indent defun))
(if (null (cdr features))
`(eval-after-load ,(car features) ,form)
`(eval-after-load ,(car features) (eval-after-load-all ,(cdr features) ,form))))
(defmacro after (features &rest body)
@minikomi
minikomi / lazy.cljs
Last active July 14, 2018 21:30
Lazy loading image for reagent
(ns frontend.lazy
(:require [reagent.core :as r]
[goog.dom :as gdom]
[goog.events.EventType :as event-type]
[goog.events :as events])
(:import goog.async.Throttle))
(defonce initialized-lazy-load (atom false))
(defonce lazy-els (atom {}))
(defonce lazy-loaded (r/atom #{}))
@minikomi
minikomi / spacemacs.org
Last active January 22, 2018 05:30
spacemacs.org

Version pinning

(push '("melpa-stable" . "stable.melpa.org/packages/") configuration-layer--elpa-archives)
(push '(clj-refactor . "melpa-stable") package-pinned-packages)
(push '(ac-cider . "melpa-stable") package-pinned-packages)
(push '(cljr-helm . "melpa-stable") package-pinned-packages)
(push '(cider . "melpa-stable") package-pinned-packages)
(defn write-image!
([ext buffered-image output-file]
(write-image! ext buffered-image output-file {:quality 1.0}))
([ext buffered-image output-file options]
(let [writer (.next (ImageIO/getImageWritersByFormatName ext))
write-param (.getDefaultWriteParam writer)
iioimage (IIOImage. buffered-image nil nil)
ios (ImageIO/createImageOutputStream output-file)]
(doto write-param
(.setCompressionMode ImageWriteParam/MODE_EXPLICIT)
(progn (deftheme cool-stream "Refreshing summer theme")
(put
(quote cool-stream)
(quote theme-immediate) t)
(custom-theme-set-faces
(quote cool-stream)
(quote (font-lock-string-face ((t (:foreground "#2880c5" :background "#f2f2f2")))))
(quote (font-lock-variable-name-face ((t (:foreground "#8a8a8a")))))
(quote (font-lock-type-face ((t (:foreground "#2880c5")))))
(quote (font-lock-function-name-face ((t (:foreground "#a40000")))))
(defn strongwrap [s] (str "<strong>" s "</strong>"))
(defn strongify-keywords [s]
(s/replace s #":[a-z0-9-]+" strongwrap))
(defn pprinter [v]
[:pre
[:code {:dangerouslySetInnerHTML
{:__html (->> (with-out-str (pp/pprint v))