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
/* | |
reverse the string but without the index of the numbers. | |
Example: "he2llo" - "ol2leh" | |
Example: "De5ary4ou" - "uo5yra4eD" | |
Example: "D23amn5Boy" - "y23oBn5maD" | |
*/ | |
reverseNoNumbers = (a) => ( | |
v = a.match(/\D/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
// flat single level array | |
arr1.reduce((acc, val) => acc.concat(val), []); | |
// deep level flatten | |
function flatDeep(arr1) { | |
return arr1.reduce((acc, val) => Array.isArray(val) ? acc.concat(flatDeep(val)) : acc.concat(val), []); | |
}; | |
//recursive flatten deep | |
function flatten(array) { |
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
function map(a, cb) { | |
var res = []; | |
for (var i = 0, l = a.length; i < l; i++) { | |
res.push(cb(a[i], i, a)); | |
} | |
return res; | |
}; | |
// Example : |
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
-- your-WiFi-name | |
Netsh WLAN show interfaces | |
-- wifi password | |
netsh wlan show profile your-WiFi-name key=clear | |
-- remove folder | |
if exist folderName ( rmdir /s/q folderName ) | |
or | |
rd /S nonemptydir |
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
function integerToRoman(num) { | |
let o = { | |
M: 1000, CM: 900, D: 500, CD: 400, | |
C: 100, XC: 90, L: 50, XL: 40, | |
X: 10, IX: 9, V: 5, IV: 4, I: 1 | |
} | |
let result = '' | |
Object.keys(o).map(i => { | |
while (num >= o[i]) { | |
result += i; |
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
var months = [ | |
"jan", "fév", "mars", "avril", "mai", "juin", "juil", "août", "sep", "oct", "nov", "déc" | |
] | |
var data = [ | |
{ user: 'kim', createdAt: '2019-10-01' }, | |
{ user: 'haikel', createdAt: '2019-11-01' }, | |
{ user: 'james', createdAt: '2019-11-01' }, | |
{ user: 'mike', createdAt: '2019-10-01' }, | |
{ user: 'joe', createdAt: '2019-09-01' }, |
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
export default function useFetch (url, options) { | |
const [response, setResponse] = useState(null); | |
const [error, setError] = useState(null); | |
const [isLoading, setIsLoading] = useState(true); | |
useEffect(() => { | |
const controller = new AbortController(); | |
(async () => { |
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
/* fadeIn */ | |
@keyframes fadeIn { | |
from { | |
opacity: 0; | |
transform: scale(0); | |
} | |
to { | |
opacity: 1; | |
transform: scale(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
```shell | |
sudo systemctl stop systemd-resolved | |
sudo systemctl disable systemd-resolved | |
sudo systemctl start resolvconf.service | |
sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf | |
sudo nano /etc/systemd/resolved.conf | |
cat /etc/resolv.conf | |
``` |