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
import { intervalToDuration } from 'date-fns' | |
const seconds = 10000 | |
intervalToDuration({ start: 0, end: seconds * 1000 }) | |
// { hours: 2, minutes: 46, seconds: 40 } |
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
// Get the duration between January 15, 1929 and April 4, 1968. | |
intervalToDuration({ | |
start: new Date(1929, 0, 15, 12, 0, 0), | |
end: new Date(1968, 3, 4, 19, 5, 0) | |
}) | |
// => { years: 39, months: 2, days: 20, hours: 7, minutes: 5, seconds: 0 } |
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
"scripts": { | |
"test": "export NODE_ENV=test && jest", | |
"test:window": "set NODE_ENV=test && jest", | |
"clear_jest": "jest --clearCache", | |
"test-watch": "export NODE_ENV=test && jest --watch" | |
} |
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
Make it cross-platform by using cross-env: | |
"server": "cross-env SERVERPORT=3002 node ./fiboserver" | |
Linux | |
"scripts": { | |
"dev:linux": "NODE_ENV=development node foo.js" | |
} |
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 rm -r --cached FolderName | |
git commit -m "Removed folder from repository" | |
git push origin master |
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
/* Completa com zeros numeros com 1 digito */ | |
function pad(s) { | |
return (s < 10) ? '0' + s : s; | |
} | |
/* Obter a hora e aplica ao objeto */ | |
function newData() { | |
var date = new Date(); |
NewerOlder