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
2. Divide and Conquer | |
function diffSum (arr){ | |
if(arr.length === 0) return 0; | |
return arr[0] + sum(arr.slice(1)) | |
} | |
sum([1, 2, 3]) | |
3. Select Sort |
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
// 02 | |
// const Box = x => ({ | |
// map: f => Box(f(x)), | |
// fold: f => f(x), | |
// inspect: () => `Box(${x})` | |
// }) | |
// const moneyToFloat = str => | |
// Box(str) | |
// .map(s => s.replace(/\$/g, '')) |
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
{ | |
// Use IntelliSense to learn about possible Node.js debug attributes. | |
// Hover to view descriptions of existing attributes. | |
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"type": "node", | |
"request": "launch", | |
"name": "Launch Program", |
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
git stash show -p stash@{1} : show contents |
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
// compose | |
sum = (x, y) => x + y; | |
mult = (x, y) => x * y; | |
const result = sum(mult(3, 4), 5); | |
console.log(result); | |
compose2 = (fn1, fn2) => { |
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 other = new Promise((resolve, reject) => { | |
let values = [1,2, 3,4, 5]; | |
let sum = values.reduce((acc, next) => { | |
return acc + next; | |
}, 0) | |
resolve(sum); | |
reject('something went wrong'); | |
}); | |
let fullName = (first, last) => { |
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 offenseAnswer = [ | |
{ | |
name: 'offense1', | |
value: 'offense1 value' | |
}, | |
{ | |
name: 'offense2', | |
value: 'offense2 value' | |
}, | |
{ |
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 answers = [ | |
{ | |
name: 'offense1', | |
value: 'offense1 value' | |
}, | |
{ | |
name: 'offense2', | |
value: 'offense2 value' | |
}, | |
{ |
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
// superagent example https://github.com/request/request#streaming | |
const request = require('request'); | |
const obj = { | |
username: 'string', | |
password: 'string', | |
redirectUrl: 'string', | |
sso: 'string' | |
}; |
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 request = require('superagent'); | |
const agent = request.agent(); | |
agent | |
.post(url) | |
.type('form') | |
.send( | |
{ | |
username:"", | |
password:"^,W^.6ck", | |
redirectUrl: "''", |
NewerOlder