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
returnedUsers = { | |
"users": [ | |
{ | |
"name": "dusan", | |
"id": 1, | |
"skill": "node.js", | |
"skill_id": 1 | |
}, | |
{ | |
"name": "dusan", |
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
// As a function: | |
const groupBy = (array, key) => | |
array.reduce((a, c) => ( | |
{ | |
...a, | |
[c[key]]: [ ...a[c[key]] || [], c ] | |
} | |
), {}); | |
// As a method: |
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
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 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 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 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 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"> |
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
const operators = { | |
'+': (x, y) => x + y, | |
'-': (x, y) => x - y, | |
'*': (x, y) => x * y, | |
'/': (x, y) => x / y | |
}; | |
const calculate = (expressions) => | |
expressions.reduce(({result, operator}, currentExpressionItem) => | |
isNaN(currentExpressionItem) // is an operator? |
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
static class DictinaryToTupleExtenions { | |
public static (T1, T2) ToTuple<T1, T2>(this KeyValuePair<T1, T2> kv) => (kv.Key, kv.Value); | |
public static IEnumerable<(T1, T2)> ToTupleList<T1, T2>(this IDictionary<T1, T2> d) => d.Select(ToTuple); | |
} |
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
Array.prototype.dissoc = function(i) { | |
return [ | |
...this.slice(0, i), | |
...this.slice(i + 1, this.length) | |
]; | |
}; |