Skip to content

Instantly share code, notes, and snippets.

View bintangmuh's full-sized avatar
🎯
Focusing

Bintang Muhammad bintangmuh

🎯
Focusing
View GitHub Profile
@bintangmuh
bintangmuh / fixed table.css
Created May 21, 2024 03:00
Fixed first coloumn when table scroll horizontaly
/* source: https://dev.to/nicolaserny/table-with-a-fixed-first-column-2c5b */
/* work with bootstrap table css */
/* make the first coloumn of the (row head and body) sticky */
.table-sticky>tr>th:first-child,.table-sticky>tr>td:first-child {
position: sticky;
left: 0;
background-color: inherit;
}
@bintangmuh
bintangmuh / numbertorupiah.js
Last active December 6, 2021 10:20
Rupiah number formatter
export const convertToRupiah = (angka) => {
var rupiah = '';
var angkarev = angka.toString().split('').reverse().join('');
for(var i = 0; i < angkarev.length; i++) if(i%3 == 0) rupiah += angkarev.substr(i,3)+'.';
return rupiah.split('',rupiah.length-1).reverse().join('');
}
@bintangmuh
bintangmuh / ToggleThemeHooks.jsx
Last active August 11, 2021 11:10
Dark Theme Hooks with Local Storage for Tailwind css
import { useEffect, useState } from "react"
export function useToggleTheme() {
const [theme, setTheme] = useState('dark')
useEffect(() => {
if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
document.documentElement.classList.add('dark')
setTheme('dark')
} else {