Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ezmiller
ezmiller / factorial.clj
Created October 2, 2018 14:21
Recursive Factorial
(defn factorial [n]
(if (= n 1)
1
(* n (factorial (- n 1)))))
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ezmiller
ezmiller / checkout-branch-on-fork
Created October 2, 2019 10:24
Checking out a branch from a fork
# See here: https://git.521000.bestmunity/t5/How-to-use-Git-and-GitHub/Checkout-a-branch-from-a-fork/td-p/77
git ls-remote --refs origin -- will list refs for remote `origin`, some will look like `refs/pull/<some-num>/head`
git fetch origin pull/123/head:pr/123 && git checkout pr/123 # fetch and checkout PR #123, eg.
@ezmiller
ezmiller / gist:e642960d4653f0c8a54ca15d2fd5e041
Created December 29, 2020 18:50
Clojure lazy sequence of days from 1970-01-01 using java.time
;; Creates a lazy sequence of days from 1970-01-01
(defn days-from-epoch
([] (days-from-epoch (java.time.LocalDate/parse "1970-01-01")))
([local-date]
(prn local-date)
(lazy-seq (cons local-date (days-from-epoch (.plusDays local-date 1))))))
(take 2 (days-from-epoch))
;; => (#time/date "1970-01-01" #time/date "1970-01-02")
@ezmiller
ezmiller / hours-plot-data.csv
Created June 10, 2021 02:17
#scicloj-phase-transitiion hours data - 2021-06-09
day hour overlaps
monday 0 1
monday 1 1
monday 2 2
monday 3 3
monday 4 3
monday 5 3
monday 6 2
monday 7 1
monday 8 0
[
{
"Promo": 1,
"Sales": 5263
},
{
"Promo": 1,
"Sales": 5020
},
{
@ezmiller
ezmiller / scicloj-workshop-template.md
Last active March 15, 2022 02:09
Scicloj Workshop Template

Work In Progress

Scicloj Workshop: [Add workshop title]

[Add workshop description]

Workshop Length & Structure

[Describe number of workshop meetings, time and length]