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
const data = { | |
selected: 2, | |
opts: [ | |
{id: 1, name: `A`}, | |
{id: 2, name: `B`}, | |
{id: 3, name: `C`}, | |
] | |
}; | |
const selected = (a, b) => R.equals(a, b) ? `selected="selected"` : ``; |
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
@mixin decl($props) { | |
// layout | |
display: prop('display', $props); | |
position: prop('position', $props); | |
top: prop('top', $props); | |
right: prop('right', $props); | |
bottom: prop('bottom', $props); | |
left: prop('left', $props); | |
float: prop('float', $props); | |
clear: prop('clear', $props); |
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://codepen.io/anon/pen/LgJPmv | |
// https://codepen.io/anon/pen/qJMaER | |
// https://codepen.io/anon/pen/vQNxaN | |
// https://codepen.io/anon/pen/mQrbQV | |
// https://codepen.io/anon/pen/wLPxOV | |
// Functions | |
// convenience type-checking functions | |
@function is_null( $val ) { @return type-of( $val ) == 'null'; } |
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
@function apply-unit($unit, $val) { | |
@return unquote('#{$val}#{$unit}'); | |
} | |
@function strip-unit($number) { | |
@if type-of($number) == 'number' and not unitless($number) { | |
@return $number / ($number * 0 + 1); | |
} | |
@return $number; | |
} |
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
snippet log "console.log(...)" b | |
console.log($0); | |
endsnippet | |
snippet tg "generic JSX tag" b | |
<$1>$0</$1> | |
endsnippet |
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
const test = require('tape'); | |
const emptyContainer = () => null; | |
const checkWith = el1 => el2 => el1 === el2 ? el2 : null; | |
const inContainer = ( containingFn, el ) => containingFn( el ) === el; | |
const inEither = ( a, b ) => el => inContainer( a, el ) ? el : b( el ); | |
const inAny = ( ...containingFns ) => containingFns.reduce( inEither, checkWith( null ) ); | |
const inBoth = ( a, b ) => el => inContainer( a, el ) && inContainer( b, el ) ? el : null; | |
const inAll = ( ...containingFns ) => containingFns.reduce( inBoth, checkWith ); |
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
;; leiningen profile | |
;; ~.lein/profiles.clj | |
{:user {:plugins [ | |
[cider/cider-nrepl "0.20.0"] | |
[lein-pprint "1.2.0"]] | |
:dependencies [[cider/piggieback "0.3.10"] | |
[cljfmt "0.6.3"]] | |
:repl-options {:nrepl-middleware [cider.piggieback/wrap-cljs-repl]}}} |
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
const dot = (f, g) => (a) => f(g(a)); | |
const cmp = (list) => list.reduce(dot, (a) => a); | |
const pthOr = (fallback, keys, obj) => keys.reduce( | |
(acc, item) => typeof acc === 'undefined' || | |
acc === null || | |
acc === fallback || | |
typeof acc[item] === 'undefined' | |
? fallback | |
: acc[item], | |
obj |
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
const basicSurround = curry((char, text) => `${char}${text}${char}`); | |
const snglQt = basicSurround(`'`); | |
const dblQt = basicSurround(`"`); | |
const OrderPrefixTmplt = jsonKey => `${dblQt(jsonKey)}->>`; | |
const OrderBaseTmplt = (field, dir) => `${field} ${dir}`; |
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
const { | |
compose, | |
concat, | |
cond, | |
curry, | |
flatten, | |
flip, | |
identity, | |
is, | |
isNil, |