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
// Example 1 or 2-arity function f | |
const f = (...args) => | |
[ | |
(x) => console.log("One param"), | |
(x, y) => console.log("Two params") | |
][args.length-1](...args); | |
f(1) // "One param" | |
f(1, 2) // "Two param" |
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 values = { | |
I: 1, | |
V: 5, | |
X: 10, | |
L: 50, | |
C: 100, | |
D: 500, | |
M: 1000 | |
}; |
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 add(x, y) { | |
const apiUrl = `https://api.mathjs.org/v4/?expr=${x}%2B${y}`; | |
try { | |
let xhr = new XMLHttpRequest(apiUrl); | |
xhr.open('GET', apiUrl, false); | |
xhr.send(); | |
return Number(xhr.responseText); | |
} catch (ex) { | |
console.log("Ya'll numbers fucky"); | |
return NaN; |
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
returnedUsers = { | |
"users": [ | |
{ | |
"name": "dusan", | |
"id": 1, | |
"skill": "node.js", | |
"skill_id": 1 | |
}, | |
{ | |
"name": "dusan", |
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
// As a function: | |
const groupBy = (array, key) => | |
array.reduce((a, c) => ( | |
{ | |
...a, | |
[ c[key]]: [ ...a[c[key]] || [], c ] | |
} | |
), {}); | |
// As a method: |
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
cons = a => b => f => f(a)(b) | |
car = a => b => a | |
cdr = a => b => b | |
reduce = f => i => l => | |
l | |
? reduce (f) (f(i)(l(car))) (l(cdr)) | |
: i | |
l = cons(1)(cons(2)(cons(3)(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
const foo = () => "foo"; | |
const bar = () => "bar"; | |
const baz = () => "baz"; | |
const cycle = (...fns) => | |
() => { | |
const [f, ...fs] = fns; | |
fns = [...fs, f]; | |
return f(); | |
}; |
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 logged = logF => f => | |
(...args) => { | |
const output = f(...args); | |
console.log(logF(args, output)); | |
return output; | |
}; | |
function writeFile(filename) { | |
console.log(`[ACTUALLY DOING STUFF WITH ${filename}]`); | |
} |
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
// Slack | |
#2F3136,#2A2C30,#4F545C,#F6F6F7,#36393F,#DCDDDE,#43B581,#F04747 | |
// Mattermost | |
{"sidebarBg":"#2f3136","sidebarText":"#9ca0a4","sidebarUnreadText":"#ffffff","sidebarTextHoverBg":"#42464d","sidebarTextActiveBorder":"#42464d","sidebarTextActiveColor":"#ffffff","sidebarHeaderBg":"#282b30","sidebarHeaderTextColor":"#ffffff","onlineIndicator":"#43b581","awayIndicator":"#faa61a","dndIndicator":"#f74343","mentionBj":"#f04747","mentionColor":"#ffffff","centerChannelBg":"#36393e","centerChannelColor":"#c0c1c2","newMessageSeparator":"#cb4445","linkColor":"#7289da","buttonBg":"#7289da","buttonColor":"#ffffff","errorTextColor":"#fd5960","mentionHighlightBg":"#3d414e","mentionHighlightLink":"#7289da","codeTheme":"monokai","mentionBg":"#f04747"} |
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
<!DOCTYPE html> | |
<meta charset=utf-8> | |
<meta name=viewport content="width=device-width,initial-scale=1"> | |
<title>Slackwise</title> | |
<meta name=author content="Adam 'Slackwise' Flanczewski"> | |
<meta name=description content="Slackwise's Blog"> | |
<meta name=keywords content="keywords,here"> | |
<link rel=stylesheet href="https://fonts.googleapis.com/css?family=Press+Start+2P|Roboto|Roboto+Condensed|Roboto+Mono"> | |
<link rel=stylesheet href="prism-vs.css"> | |
<link rel=stylesheet href="screen.css"> |