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 {get} = require("axios"); | |
const urls = [get("https://www.google.com"), get("https://www.yahoo.com"), get("https://www.facebook.com")]; | |
async function processTasks() { | |
return urls.reduce(async (accPromise, u, i) => { | |
const acc = await accPromise; | |
const {data, ...r} = await u; | |
acc[i] = r.config.url; | |
return acc; |
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 arr = [true, 'tset', 'test', 'test', 'tset', true, 1, 3, 1] | |
const group = arr.reduce( | |
(a, b) => ({ | |
...a, | |
[b]: (a[b] || 0) + 1 | |
}), {} | |
) | |
console.log(group) |
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
/* | |
* Create the function factorial here | |
*/ | |
const factorial = (n) => (1 < n && n <= 10) ? n * factorial(--n) : n; |
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 getLetter = s => | |
s.match(/^[aeiou]/) | |
? "A" | |
: s.match(/^[bcdfg]/) | |
? "B" | |
: s.match(/^[hjklm]/) | |
? "C" | |
: "D"; |
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
/* | |
* Complete the vowelsAndConsonants function. | |
* Print your output using 'console.log()'. | |
*/ | |
const vowelsAndConsonants = s => | |
console.log( | |
s.match(/[aeiou]/gi).join("\n") + | |
"\n" + | |
s.match(/[^aeiou0-9_\W]/gi).join("\n") | |
); |
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
/** | |
* Return the second largest number in the array. | |
* @param {Number[]} nums - An array of numbers. | |
* @return {Number} The second largest number in the array. | |
**/ | |
const getSecondLargest = nums => | |
nums.length > 1 | |
? (function secondLargest(sortedNums, n) { | |
return sortedNums[n] !== sortedNums[n - 1] || n === 1 | |
? sortedNums[n - 1] |
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
CHOST="x86_64-pc-linux-gnu" | |
CFLAGS="-march=ivybridge -O2 -pipe" | |
CXXFLAGS="${CFLAGS}" | |
CPU_FLAGS="avx mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" | |
USE="X udev xorg xvfb glamor gallium zsh-completions egl nptl vaapi memcached mysql caps savedconfig json yaml | |
netbeans initramfs dri3 monolithic hwaccel threads usb cpudetection server pcap | |
pulseaudio openh264 gstreamer numa 10bit curl javascript cairo | |
startup-notification branding xfce libnotify ambiance truetype efiemu openssl | |
cscope d3d9 clang gpm lua luajit perl tcl vim-pager jpeg jpeg2k tiff fontconfig |
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
0#0c0e10 | |
1#FF0000 | |
2#198844 | |
3#fba922 | |
4#3465a4 | |
5#75507b | |
6#055b91 | |
7#d3d7cf | |
8#555753 | |
9#ef2929 |