Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Peter Strömberg PEZ

🎯
Focusing
View GitHub Profile
@PEZ
PEZ / rebob - rebase branch on branch
Last active Oct 20, 2021
Zsh functions to help rebasing git branches safely
View rebob - rebase branch on branch
~/Foo(bar|✔) % rebobl
logging to: /var/folders/t5/gqxhj8pd6p9_tnvy6sbtmy480000gn/T/rebob.YJJZirAY
rebob: No branch given, checking REBOBS in /Users/pez/.my-configs/rebob_config.zshrc
rebob: rebob baz on /Users/pez/Foo:bar
rebob: pulling?: false
rebob: Created: .rebobing
Saved working directory and index state WIP on bar: 17fa37c Add baz
rebob: Stashed -u (.rebobing stashed)
Current branch bar is up to date.
rebob: Rebased on: baz
View paste-replaced-examples.js
"paste-replaced.replacers": [
[ // hostname/path -> Markdown url
[".*", "[$&](https://$&)"],
],
[ // Clojure namespace -> file path segment
["\\.", "/", "g"],
["-", "_", "g"],
],
[ // Love bomb, anything -> 💪♥️♥️♥️♥️♥️♥️💪
[".", "♥️", "g"],
View rich4clojure_elementary_problem_005.clj
(ns rich4clojure.elementary.problem-005
(:require [hyperfiddle.rcf :refer [tests]]))
;; = Lists: conj =
;; By 4Clojure user: dbyrne
;; Difficulty: Elementary
;;
;; When operating on a list, the conj function will return
;; a new list with one or more items "added" to the front.
;;
@PEZ
PEZ / rich4clojure_medium_problem_195.clj
Last active Jul 25, 2021
Parentheses... Again – Rich 4Clojure Problem 195 – See: https://github.com/PEZ/rich4clojure
View rich4clojure_medium_problem_195.clj
(ns rich4clojure.medium.problem-195
(:require [hyperfiddle.rcf :refer [tests]]))
;; = Parentheses... Again =
;; By 4Clojure user: djtrack16
;; Difficulty: Medium
;; Tags: [math combinatorics]
;;
;; In a family of languages like Lisp, having balanced
;; parentheses is a defining feature of the language.
@PEZ
PEZ / rich4clojure_medium_problem_177.clj
Last active Jul 25, 2021
Balancing Brackets – Rich 4Clojure Problem 177 – See: https://github.com/PEZ/rich4clojure
View rich4clojure_medium_problem_177.clj
(ns rich4clojure.medium.problem-177
(:require [hyperfiddle.rcf :refer [tests]]))
;; = Balancing Brackets =
;; By 4Clojure user: daowen
;; Difficulty: Medium
;; Tags: [parsing]
;;
;; When parsing a snippet of code it's often a good idea
;; to do a sanity check to see if all the brackets match
@PEZ
PEZ / rich4clojure_easy_problem_173.clj
Last active Jul 25, 2021
Intro to Destructuring 2 – Rich 4Clojure Problem 173 – See: https://github.com/PEZ/rich4clojure
View rich4clojure_easy_problem_173.clj
(ns rich4clojure.easy.problem-173
(:require [hyperfiddle.rcf :refer [tests]]))
;; = Intro to Destructuring 2 =
;; By 4Clojure user: hangkous
;; Difficulty: Easy
;; Tags: [Destructuring]
;;
;; Sequential destructuring allows you to bind symbols to
;; parts of sequential things (vectors, lists, seqs,
@PEZ
PEZ / rich4clojure_medium_problem_171.clj
Last active Jul 25, 2021
Intervals – Rich 4Clojure Problem 171 – See: https://github.com/PEZ/rich4clojure
View rich4clojure_medium_problem_171.clj
(ns rich4clojure.medium.problem-171
(:require [hyperfiddle.rcf :refer [tests]]))
;; = Intervals =
;; By 4Clojure user: aiba
;; Difficulty: Medium
;;
;; Write a function that takes a sequence of integers and
;; returns a sequence of "intervals". Each interval is a a
;; vector of two integers, start and end, such that all
@PEZ
PEZ / rich4clojure_medium_problem_168.clj
Last active Jul 25, 2021
Infinite Matrix – Rich 4Clojure Problem 168 – See: https://github.com/PEZ/rich4clojure
View rich4clojure_medium_problem_168.clj
(ns rich4clojure.medium.problem-168
(:require [hyperfiddle.rcf :refer [tests]]))
;; = Infinite Matrix =
;; By 4Clojure user: maximental
;; Difficulty: Medium
;; Tags: [seqs recursion math]
;;
;; In what follows, m, n, s, t denote nonnegative
;; integers, f denotes a function that accepts two
@PEZ
PEZ / rich4clojure_easy_problem_166.clj
Last active Jul 25, 2021
Comparisons – Rich 4Clojure Problem 166 – See: https://github.com/PEZ/rich4clojure
View rich4clojure_easy_problem_166.clj
(ns rich4clojure.easy.problem-166
(:require [hyperfiddle.rcf :refer [tests]]))
;; = Comparisons =
;; By 4Clojure user: daowen
;; Difficulty: Easy
;;
;; For any orderable data type it's possible to derive all
;; of the basic comparison operations (<, ≤, =, ≠, ≥, and
;; >) from a single operation (any operator but = or ≠
@PEZ
PEZ / rich4clojure_hard_problem_164.clj
Last active Jul 25, 2021
Language of a DFA – Rich 4Clojure Problem 164 – See: https://github.com/PEZ/rich4clojure
View rich4clojure_hard_problem_164.clj
(ns rich4clojure.hard.problem-164
(:require [hyperfiddle.rcf :refer [tests]]))
;; = Language of a DFA =
;; By 4Clojure user: daowen
;; Difficulty: Hard
;; Tags: [automata seqs]
;;
;; A deterministic finite automaton (DFA) is an abstract
;; machine that recognizes a regular language. Usually a