Skip to content

Instantly share code, notes, and snippets.

View dinocarl's full-sized avatar

Carl Albrecht-Buehler dinocarl

View GitHub Profile
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
" call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
html, body {
font-size: calc(44px - (2vw));
}
@dinocarl
dinocarl / lodashcond.js
Last active September 22, 2017 16:15
Uses a curried version of `includes` for a `cond`
var fpIncludes = _.curry( function (val, list) { return _.includes(list, val); } );
// or use lodash/fp's includes instead
var prop = _.curry( function (val, obj) { return _.get(obj, val); } );
var propOr = _.curry( function (def, val, obj) { return _.get(obj, val, def); } );
var checkForAorD = _.cond([
[fpIncludes('a'), _.constant('matches A')],
[fpIncludes('d'), _.constant('matches D')],
[_.stubTrue, _.constant('no match')]
]);
// data
const types = [
'typeA',
'typeB',
'typeC',
'all',
'typeD'
];
const a = ['a', 'b', 'c', 'd'];
const b = ['e', 'f'];
@dinocarl
dinocarl / usingSanctuaryMaybe.js
Last active February 6, 2018 16:28
Extracting a value from a Sanctuary JS Maybe
const words = []
R.compose(
S.toUpper,
S.fromMaybe('x'),
S.head
)(words)
// or
S.toUpper(S.fromMaybe('x', S.head(words)))
// can run in the ramda REPL http://ramdajs.com/repl/
const double = (x) => R.add(x, x)
const clonewithbase = (base) => R.compose(
R.concat([base]),
R.clone
);
const applyFnsToList = (baseCase) => (fn1) => (fn2) => (arr) => {
// can use sassfp instead, but adding these here so they can work in sassmeister
@function applyUnit($unit, $val) {
@return unquote('#{$val}#{$unit}');
}
// shortcut function to apply px unit
@function px($val) {
@return applyUnit('px', $val);
// Utils
const curry = (fn) => (...xs) => {
if (xs.length >= fn.length) {
return fn(...xs);
}
return curry(fn.bind(null, ...xs));
};
https://jsfiddle.net/d3zaech4/
@dinocarl
dinocarl / unicodeBox.txt
Created July 30, 2018 03:46
Unicode Box Drawing code chart
0 1 2 3 4 5 6 7 8 9 A B C D E F
U+250x ─ ━ │ ┃ ┄ ┅ ┆ ┇ ┈ ┉ ┊ ┋ ┌ ┍ ┎ ┏
U+251x ┐ ┑ ┒ ┓ └ ┕ ┖ ┗ ┘ ┙ ┚ ┛ ├ ┝ ┞ ┟
U+252x ┠ ┡ ┢ ┣ ┤ ┥ ┦ ┧ ┨ ┩ ┪ ┫ ┬ ┭ ┮ ┯
U+253x ┰ ┱ ┲ ┳ ┴ ┵ ┶ ┷ ┸ ┹ ┺ ┻ ┼ ┽ ┾ ┿
U+254x ╀ ╁ ╂ ╃ ╄ ╅ ╆ ╇ ╈ ╉ ╊ ╋ ╌ ╍ ╎ ╏