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
module ConstantInstance where | |
import Data.Monoid as M | |
newtype Constant a b = Constant | |
{ getConstant :: a | |
} deriving (Eq, Ord, Show) | |
instance Functor (Constant a) where | |
fmap f (Constant a) = Constant a |
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
data Two a b = | |
Two a | |
b | |
deriving (Eq, Show) | |
instance (Semigroup a, Semigroup b) => | |
Semigroup (Two a b) where | |
(Two x1 y1) <> (Two x2 y2) = Two (x1 M.<> x2) (y1 M.<> y2) | |
instance (Monoid a, Semigroup a, Monoid b, Semigroup b) => |
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
" I work on both Linux and macOS, so some settings differ on those system | |
function! g:IsMacOS() | |
if has('unix') | |
let s:uname = system('uname') | |
if s:uname ==? "Darwin\n" | |
return 1 | |
else | |
return 0 | |
endif | |
endif |
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
////// | |
// -- basic react linting with prettier | |
// install the following | |
yarn add -D babel-eslint eslint eslint-config-prettier eslint-plugin-prettier eslint-plugin-react prettier eslint-plugin-import | |
//.eslintrc |
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
# https://superuser.com/questions/270214/how-can-i-change-the-colors-of-my-xterm-using-ansi-escape-sequences | |
colortest() { | |
text='•‿•' | |
printf "base "; | |
for base in 00 01 02 03 04 05 06 07 08 09 '0A' '0B' '0C' '0D' '0E' '0F'; do | |
printf " ${base} "; | |
done | |
printf "\n"; | |
for FG in 00 18 19 08 20 07 21 15 01 16 03 02 06 04 05 17; do | |
printf "\e[38;5;${FG}mcolor${FG}\e[0m "; |
NewerOlder