Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
[ | |
{ | |
"name_en": "Afghanistan", | |
"name_es": "Afganistan", | |
"dial_code": "+93", | |
"code": "AF" | |
}, | |
{ | |
"name_en": "Albania", | |
"name_es": "Albania", |
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
[ | |
{ | |
"id": 1, | |
"value": "Dateline Standard Time", | |
"abbr": "DST", | |
"offset": -12, | |
"isdst": false, | |
"text": "(UTC-12:00) International Date Line West", | |
"utc": [ | |
"Etc/GMT+12" |
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
#!/usr/bin/env bash | |
# Installation: | |
# | |
# $ curl -s https://gist.githubusercontent.com/martingaido/85d78a4460b366a2f529abf804e09997/raw/f7a6d220b30c4c236f619da915c959802d93db2a/slack.sh --output /usr/bin/slack | |
# $ chmod +x /usr/bin/slack | |
# | |
# Usage: | |
# | |
# Send message to slack channel/user |
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
/* Fibonacci Sequence */ | |
const fibonacci = (result: number[], len: number) => { | |
let n1: number = result[0], | |
n2: number = result[1], | |
next: number, | |
cnt: number = 2; | |
while (cnt < len) { | |
next = n1 + n2; |
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
/* Remove duplicate values from an iterable object using Set() | |
x.add() | |
x.delete() | |
x.has() | |
x.clear() | |
x.size() | |
*/ | |
const set_one = new Set() |
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
/* Case #1 - Notice that this example also mutates the original array. */ | |
console.time('Test 1'); | |
const arrayOne = [1, 2, 3, 4]; | |
const newArrayOne = arrayOne.reverse(); | |
console.log(arrayOne); // [ 4, 3, 2, 1 ] | |
console.log(newArrayOne); // [ 4, 3, 2, 1 ] | |
console.timeEnd('Test 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
/* Checking if String contains Substring */ | |
const word = 'sunny day in manhattan'; | |
/* Old Way */ | |
word.indexOf('sun') !== -1; // true | |
/* 🚀 ES6 Way */ | |
word.includes('sun'); // true |
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
/* Flatter Arrays */ | |
'use strict'; | |
// Case 1 (two-dimensional array) | |
let array1 = [1, 2, [4, 5, 6], 8, [9, 10], 11]; | |
let newArray1 = array1.flat(); | |
console.log(newArray1); |
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
/* Spread Operator */ | |
// Case 1 | |
const temperatures = [25, 22, 10, 34, 28, 15]; | |
console.log('Min Value: ', Math.min(...temperatures)); | |
console.log('Max Value: ', Math.max(...temperatures)); | |
// Case 2 | |
const someNumbers = ['First Name', 'Last Name', 'Age', 'Gender']; | |
const [first, ...tail] = someNumbers; |
OlderNewer