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 re-com.dropdown-fetching | |
(:require-macros [re-com.core :refer [handler-fn]]) | |
(:require [re-com.util :refer [deref-or-value position-for-id item-for-id]] | |
[re-com.box :refer [align-style flex-child-style]] | |
[re-com.validate :refer [vector-of-maps? css-style? html-attr? number-or-string?] :refer-macros [validate-args-macro]] | |
[clojure.string :as string] | |
[reagent.core :as reagent] | |
[re-frame.core :as re-frame])) | |
;; Inspiration: http://alxlit.name/bootstrap-chosen |
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 thread-dump | |
(:require [clojure.stacktrace :as st]) | |
(:import [java.lang.management ManagementFactory])) | |
(defn jstack [n] | |
(let [threadMXBean (ManagementFactory/getThreadMXBean) | |
info (.getThreadInfo threadMXBean (.getAllThreadIds threadMXBean) 100)] | |
(for [threadInfo info] | |
(str |
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
#!/usr/bin/env bash | |
; brew install imagemagick if you haven't already | |
convert -resize 167x167 $ ic_launcher-19.png; | |
convert -resize 152x152 $ ic_launcher-18.png; | |
convert -resize 76x76 $ ic_launcher-17.png; | |
convert -resize 144x144 $ ic_launcher-16.png | |
convert -resize 72x72 $ ic_launcher-15.png; | |
convert -resize 100x100 $ ic_launcher-14.png; |
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
;; handy when working at repl. something in a let statement is not working and so you want to def the variables so you can try | |
bits one by one | |
(defmacro deflet [bindings & body] | |
`(let ~bindings | |
~@(for [v (map first (partition 2 (destructure bindings)))] | |
(list 'def v v)))) |
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
; stack dump | |
(require '[clojure.stacktrace :as stck]) | |
(defn jstack [n] | |
(let [threadMXBean (java.lang.management.ManagementFactory/getThreadMXBean) | |
info (.getThreadInfo threadMXBean (.getAllThreadIds threadMXBean) 100)] | |
(for [threadInfo info] | |
(str |
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-tick.weekdays | |
(:require [tick.alpha.api :as t])) | |
; calculate weekdays between 2 local dates with tick | |
; 2 methods, one is quite readable, the other is probably more environmentally friendly | |
; https://www.timeanddate.com/date/workdays.html | |
; java.time weekday ordinals | |
; 1 2 3 4 5 6 7 | |
; M T W T F S S |
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
alias commit='git commit -a -m ' | |
alias glog='git log --pretty=oneline' | |
alias glog='git log --pretty=format:"%h%x09%an%x09%ad%x09%s"' | |
alias gsoft='git reset --soft HEAD~1' | |
alias gshowf='git show --name-only' | |
alias gshow='git diff-tree --no-commit-id --name-only -r ' | |
alias gint='git rebase --interactive ' | |
alias ginto='git rebase --interactive origin/master' | |
alias rgc='git rebase --continue' | |
alias rga='git rebase --abort' |
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 deps | |
"use https://github.com/alexander-yakushev/ns-graph | |
to create a function that returns all transitive dependencies of a namespace. | |
handy if you're trying to pull a ns out of a project | |
" | |
(:require [ns-graph.core :as nsg] | |
[clojure.java.io :as io])) |
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 transducers) | |
;;;;; simplified traditional impls | |
(defn mymap [f coll] | |
(reduce | |
(fn [acc n] | |
(conj acc (f n))) | |
[] | |
coll)) |
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
;local date to native date (js/Date or java.util.Date.) | |
(-> d | |
(cljc.java-time.local-date/at-start-of-day (t/zone "UTC")) | |
(t/inst)) | |
; native date (js/Date or java.util.Date.) to local date | |
(-> (java.util.Date.) | |
t/instant | |
(cljc.java-time.zoned-date-time/of-instant (t/zone "UTC")) | |
t/date) |
OlderNewer