Skip to content

Instantly share code, notes, and snippets.

View RyanNorooz's full-sized avatar
⚜️
in pain

Rayan Noroozi RyanNorooz

⚜️
in pain
View GitHub Profile
@RyanNorooz
RyanNorooz / useStateEnhanced.ts
Created August 24, 2022 21:57
react useState hook with callback
import { useEffect, useRef, useState } from 'react'
type OnUpdateCallback<T> = (s: T) => void
type SetStateUpdaterCallback<T> = (s: T) => T
type SetStateAction<T> = (
newState: T | SetStateUpdaterCallback<T>,
callback?: OnUpdateCallback<T>
) => void
export function useStateEnhanced<T>(init: T): [T, SetStateAction<T>]
@RyanNorooz
RyanNorooz / tailwind.config.js
Last active July 26, 2022 11:46 — forked from samselikoff/tailwind.config.js
Firefox plugin for Tailwind CSS. Add styles that target Firefox browser only.
const plugin = require('tailwindcss/plugin')
module.exports = {
plugins: [
// firefox only modifier
plugin(({ addVariant, e, postcss }) => {
addVariant('firefox', ({ container, separator }) => {
const isFirefoxRule = postcss.atRule({
name: 'supports',
params: '(-moz-appearance:none)',
@RyanNorooz
RyanNorooz / clear-console.js
Last active January 4, 2022 01:29 — forked from timneutkens/index.js
Clear console/terminal in node.js the right way (preserve terminal history)
const readline = require('readline')
const blank = '\n'.repeat(process.stdout.rows)
console.log(blank)
readline.cursorTo(process.stdout, 0, 0)
readline.clearScreenDown(process.stdout)
@RyanNorooz
RyanNorooz / linux-setup.sh
Last active March 13, 2023 14:53
My starter script for new linux machines. use this to download and run script: (curl -s {link} | bash)
#!/bin/bash
current_user=$(whoami)
# =================== welcome & notice ===================
echo
echo "User: $current_user"
echo
echo "wassssuuuuup....!"
echo "script will install basic tools and configs apps for the current user: $current_user"
@RyanNorooz
RyanNorooz / 💻 Recent coding in languages
Last active May 24, 2024 01:15
📊 Development breakdown
TypeScript +198/ -80 ███▋░░░░░░░░░░░░░░░░░ 17.6%