Skip to content

Instantly share code, notes, and snippets.

View farhadeidi's full-sized avatar

Farhad Eidi farhadeidi

View GitHub Profile
@farhadeidi
farhadeidi / __root.tsx
Created January 31, 2026 21:57
Uniwind + Tanstach Start (SSR) + React Native Web
// Make sure to add a className to the html tag. Because uniwind needs it to apply the correct theme styles.
<html lang="en" className="light"></html>
@farhadeidi
farhadeidi / script.bash
Created January 8, 2026 08:30
Disable the default Ctrl+Shift+Alt+Arrow shortcuts in Ubuntu, ZorinOS, or Gnome to avoid conflicts with editors like Cursor, VS Code, and Zed
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-up "['<Super>Page_Up']"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-down "['<Super>Page_Down']"
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-up "['<Super><Shift>Page_Up']"
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-down "['<Super><Shift>Page_Down']"
@farhadeidi
farhadeidi / nuqs-expo-adapter.tsx
Created January 3, 2026 19:44
Nuqs + Expo Router Adapter
// Source: https://github.com/47ng/nuqs/issues/837#issuecomment-3136982512
import {
router,
type UnknownOutputParams,
useLocalSearchParams,
useSegments,
} from "expo-router";
import {
type unstable_AdapterInterface,
unstable_createAdapterProvider,
@farhadeidi
farhadeidi / tsconfig.json
Last active January 3, 2026 15:04
React native builder bob + Uniwind / Nativewind setup
{
"compilerOptions": {
"rootDir": ".",
"paths": {
"unative-form": ["./src/index"]
},
"allowUnreachableCode": false,
"allowUnusedLabels": false,
// "customConditions": ["react-native-strict-api"], // Remove This
"esModuleInterop": true,
@farhadeidi
farhadeidi / tailwind-css-colors.ts
Created December 19, 2024 05:18
tailwindcss colors
export default {
inherit: 'inherit',
current: 'currentColor',
transparent: 'transparent',
black: '#000',
white: '#fff',
slate: {
'50': 'oklch(0.984 0.003 247.858)',
'100': 'oklch(0.968 0.007 247.896)',
'200': 'oklch(0.929 0.013 255.508)',
@farhadeidi
farhadeidi / event-emitter.ts
Last active November 1, 2024 13:02
React native (Expo router) (Typescript) scroll to top on tab press when it's focused
import { TinyEmitter } from "tiny-emitter";
const eventEmitter = new TinyEmitter();
const eventEmitterActions = {
TAB_ONE_PRESSED: "TAB_ONE_PRESSED",
TAB_TWO_PRESSED: "TAB_TWO_PRESSED",
TAB_THREE_PRESSED: "TAB_THREE_PRESSED",
TAB_FOUR_PRESSED: "TAB_FOUR_PRESSED",
};
@farhadeidi
farhadeidi / reserved-slugs.js
Created May 19, 2024 18:13
Reserved usernames for new website or platform
// Source: https://docs.google.com/spreadsheets/d/1Gj1LidTJgA1TgOjhxTaoQKaZTvV2-xZlvo9XEsBnZ5I/edit#gid=0
// Reserved Usernames
// Reserved urls
export const reservedSlugs = [
"admin",
"blog",
"dev",
"ftp",
"mail",
@farhadeidi
farhadeidi / T3Stack - TRPC - ReactHook-Form error handling.ts
Created May 19, 2024 15:38
T3 Stack, Nextjs, TRPC, React-hook-form auto error handling
import { type TRPCClientErrorBase } from "@trpc/client";
import { type DefaultErrorShape } from "@trpc/server/unstable-core-do-not-import";
import { type Path, type UseFormReturn } from "react-hook-form";
import { type typeToFlattenedError } from "zod";
type ServerZodError =
| typeToFlattenedError<Record<string, unknown>, string>
| undefined
| null;
@farhadeidi
farhadeidi / app.config.ts
Created April 27, 2024 01:42
Pushy.me - PushyJS - pushy-react-native Expo config file
import { ExpoConfig, ConfigContext } from "expo/config";
import { withPlugins } from "expo/config-plugins";
import { withExpoPushyConfig } from "./pushy-expo-config";
export default ({ config }: ConfigContext): ExpoConfig => {
const otherConfigs: ExpoConfig = {
...config,
};
return withPlugins(otherConfigs, [withExpoPushyConfig]);
@farhadeidi
farhadeidi / Logics.cs
Last active August 25, 2023 10:34
Add helpers to unity
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
using System.Runtime.InteropServices;
public class LogicScript : MonoBehaviour
{
[DllImport("__Internal")]