Skip to content

Instantly share code, notes, and snippets.

View deandex's full-sized avatar
:octocat:
Working from home

Noviandra Syahputra deandex

:octocat:
Working from home
View GitHub Profile
@deandex
deandex / package.json
Created August 28, 2020 17:24
Package.json Scaffolding
"devDependencies": {
"commitizen": "^4.2.1",
"cz-conventional-changelog": "^3.3.0",
"env-cmd": "^10.1.0",
"eslint-config-airbnb": "^18.2.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.20.6",
@deandex
deandex / .prettierrc
Last active November 9, 2019 15:44
VSCode Prettier Config
{
"bracketSpacing": true,
"endOfLine": "lf",
"jsxBracketSameLine": false,
"printWidth": 120,
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all",
"useTabs": false
@deandex
deandex / .eslintrc
Last active November 20, 2019 14:22
VSCode Eslint Config
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"parser": "babel-eslint",
"extends": [
"airbnb",
"prettier"
@deandex
deandex / .editorconfig
Last active October 30, 2019 17:05
VSCode Config File
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
@deandex
deandex / momentjs.humanized.triplesplit.time.js
Created October 30, 2019 02:57
Get a humanized, "Morning", "Afternoon", "Evening" from moment.js **Great for user greetings!** (ES6)
getGreetingTime = (currentTime, user = null) => {
if (!currentTime || !currentTime.isValid()) { return `Hello ${user ? ` ${user}` : ''}`; }
const splitAfternoon = 12; // 24hr time to split the afternoon
const splitEvening = 17; // 24hr time to split the evening
const currentHour = parseFloat(currentTime.format('HH'));
let greetingText = 'Good morning'; // Between dawn and noon
if (currentHour >= splitAfternoon && currentHour <= splitEvening) {
// Between 12 PM and 5PM