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 const pxToVw = (px: number, windowWidth?: number) => | |
`${(px / (windowWidth ?? window.innerWidth)) * 100}vw`; | |
export const pxToVh = (px: number, windowHeight?: number) => | |
`${(px / (windowHeight ?? window.innerHeight)) * 100}vh`; |
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
This a comparison to help myself decide my IDE, listed in order of importance. | |
## Context | |
1. Coding in Typescript for 2 year, 3 years on NodeJS before that, 15+ years in general (mostly Java) | |
2. Spent about 6 months on VS Code and 6 month with WebStorm | |
3. Cost is not a factor (company provides JetBrain licenses) | |
4. What my projects look like: back-end, OOP, Typescript, Mocha, ESLint, pnpm and monorepos (~15 packages, ~300 files) | |
## WebStorm does better |
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
/* | |
MIT License | |
Copyright © Joel Whitaker | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
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
# finds all *.js files that have either `</` or `/>` tags in them and renames them to *.jsx | |
find ./src -type f -name '*.js' -not -name '*.jsx' -not -name '*.ejs' -exec bash -c 'grep -l -E "</|/>" "$0"' {} \; -exec bash -c 'mv "$0" "${0%.js}.jsx"' {} \; |
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 Image from "next/image"; | |
import Link from "next/link"; | |
import { Button } from "../ui/button"; | |
interface Props { | |
id: string; | |
name: string; | |
username: string; | |
imgUrl: string; |
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
#!/bin/bash | |
# Sync Homebrew installations between Macs via Dropbox | |
# | |
BREW="/usr/local/bin/brew" | |
# first get local settings | |
echo "Reading local settings ..." | |
rm -f /tmp/brew-sync.* |
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
Africa/Abidjan | |
Africa/Accra | |
Africa/Addis_Ababa | |
Africa/Algiers | |
Africa/Asmara | |
Africa/Asmera | |
Africa/Bamako | |
Africa/Bangui | |
Africa/Banjul | |
Africa/Bissau |
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 findLockerLevel(lockerNumber) { | |
if(lockerNumber <= 0) { | |
return 'Error, Masukkan locker lebih dari 0' | |
} | |
let regionPosition = 1; | |
let currentFloor = 1; | |
let isFound = false; | |
while(!isFound) { |
NewerOlder