After listening to the latest Magic Read-along episode "You should watch this" (which you should go listen to now) I got
caught up thinking about Brian's idea of an Endomorphism version of Kleisli composition for use with Redux,
it's actually a very similar model to what I'm using in my event
framework for event listeners so I figured I'd try to formalize the pattern and recognize
some of the concepts involved. IIRC Brian
described the idea of a Redux-reducer, which is usually of type s -> Action -> s
, it takes a state and an action and returns
a new state. He then re-arranged
the arguments to Action -> s -> s
. He then recognized this as Action -> Endo s
(an Endo
-morphism is just any function
from one type to itself: a -> a
).
He would take his list of reducers and partially apply them with the Action
, yielding a list of type Endo s
where s
This file contains 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
(:require [re-frame.core :as re-frame] | |
[reagent.core :as reagent] | |
[cljsjs.chartist]) | |
(defn show-chart | |
[] | |
(let [chart-data {:labels ["Mar-2012" "Jun-2012" "Nov-2012" "Oct-2013" "Nov-2014"] | |
:series [[1 1 6 15 25]]} | |
options {:width "700px" | |
:height "380px"}] |
This file contains 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
# content has to be in .config/fish/config.fish | |
# if it does not exist, create the file | |
setenv SSH_ENV $HOME/.ssh/environment | |
function start_agent | |
echo "Initializing new SSH agent ..." | |
ssh-agent -c | sed 's/^echo/#echo/' > $SSH_ENV | |
echo "succeeded" | |
chmod 600 $SSH_ENV | |
. $SSH_ENV > /dev/null |
This file contains 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
#!/bin/sh | |
# | |
# !!! IMPORTANT !!! | |
# As of 2017-12-14, pacaur is unmaintained (https://bbs.archlinux.org/viewtopic.php?pid=1755144#p1755144) | |
# For alternatives see the arch wiki: https://wiki.archlinux.org/index.php/AUR_helpers#Active | |
# pacaur seems to get occasional updates to fix breaking changes due to pacman updates though. | |
# | |
# If you are new to arch, I encourage you to at least read and understand what | |
# this script does befor blindley running it. | |
# That's why I didn't make a one-liner out of it so you have an easier time |
This file contains 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
# Careful with the spaces! | |
thrice = (f) -> (x) -> f(f(f(x))) | |
_3 = thrice((x) -> x + 1) 0 | |
_9 = thrice(thrice((x) -> x + 1)) 0 | |
_27 = (thrice thrice)((x) -> x + 1) 0 |
This file contains 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
#!/bin/bash | |
LINES=$(tput lines) | |
COLUMNS=$(tput cols) | |
declare -A snowflakes | |
declare -A lastflakes | |
clear |