Skip to content

Instantly share code, notes, and snippets.

View gogones's full-sized avatar
👋
Goo

Annas Alghoffar gogones

👋
Goo
  • Jakarta, Indonesia
View GitHub Profile
@gogones
gogones / pxToViewport.ts
Created July 2, 2024 06:57
Get value vw/vh from px given relative to screen define
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 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
@gogones
gogones / BaseForm.tsx
Created March 26, 2024 20:56 — forked from ToJen/BaseForm.tsx
Framer Form Component
/*
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:
@gogones
gogones / renameReactJsToJsx.sh
Created September 4, 2023 04:31 — forked from parties/renameReactJsToJsx.sh
rename all *.js files containing React markup to *.jsx
# 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"' {} \;
@gogones
gogones / CommunityCard.tsx
Created August 13, 2023 06:33 — forked from adrianhajdin/CommunityCard.tsx
Build and Deploy a Full Stack MERN Next.js 13 Threads App | React, Next JS, TypeScript, MongoDB
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;
@gogones
gogones / GitAliases.md
Created August 4, 2023 03:28 — forked from velyo/GitAliases.md
Git Aliases collection

Git Aliases

This is a collection of some usefule git aliases.

git status shortcut [usage: git st]

git config --global alias.st status

checkout shortcut [usage: git co dev]

@gogones
gogones / brew-sync.sh
Created July 29, 2023 01:03 — forked from jamiew/brew-sync.sh
Sync Homebrew installations between Macs via Dropbox (including casks)
#!/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.*
@gogones
gogones / moment-js-timezones.txt
Created January 10, 2023 22:32 — forked from diogocapela/moment-js-timezones.txt
List of All Moment.js Timezones
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Asmera
Africa/Bamako
Africa/Bangui
Africa/Banjul
Africa/Bissau
@gogones
gogones / findLockerLevel.js
Last active August 23, 2023 03:35
find floor from locker number given
function findLockerLevel(lockerNumber) {
if(lockerNumber <= 0) {
return 'Error, Masukkan locker lebih dari 0'
}
let regionPosition = 1;
let currentFloor = 1;
let isFound = false;
while(!isFound) {