Skip to content

Instantly share code, notes, and snippets.

View ShafSpecs's full-sized avatar
👨‍💻
Smashing my keyboard..

Abdur-Rahman ShafSpecs

👨‍💻
Smashing my keyboard..
View GitHub Profile
@ShafSpecs
ShafSpecs / createStore.ts
Created February 2, 2025 18:53 — forked from Haaxor1689/createStore.ts
Persistent store wrapper for Tauri apps built on top of xstate/store and zod
import { ZodError, type z } from 'zod';
import { ask } from '@tauri-apps/plugin-dialog';
import { exit, relaunch } from '@tauri-apps/plugin-process';
import * as fs from '@tauri-apps/plugin-fs';
import { appDataDir } from '@tauri-apps/api/path';
import { path } from '@tauri-apps/api';
import { createStore as xstateStore } from '@xstate/store';
import { useSelector } from '@xstate/store/react';
const debounce = <T extends (...args: unknown[]) => void>(
import { set, unset, get, PropertyPath } from 'lodash';
import { useSyncExternalStore } from 'react';
export type SimpleReactiveStore = ReturnType<typeof createSimpleReactiveStore>;
/**
*
* @returns a simple store you can use with your react components.
*/
export function createSimpleReactiveStore() {
const data: object = {};
@ShafSpecs
ShafSpecs / GitCommitEmoji.md
Created November 29, 2023 21:54 — forked from parmentf/GitCommitEmoji.md
Git Commit message Emoji
@ShafSpecs
ShafSpecs / app-install-manager.tsx
Created October 21, 2023 22:17 — forked from rphlmr/app-install-manager.tsx
PWA App install button handling native prompt or a fallback.
/**
* App Install Manager
*
* Author: @rphlmr
*/
/**
* You will be surprised by the code below.
*
* `beforeinstallprompt` is an event really hard to work with 😵‍💫
@ShafSpecs
ShafSpecs / ssh.md
Created June 3, 2023 13:21 — forked from barnabyalter/ssh.md
Connect a new computer to GitHub account

I've done this many times but every time I attempt to do it anew many months have passed and I always have to look it up again. Here is a quick reference for myself and others to do this quickly and easily.

Create SSH key

First create the ssh key on your local computer and copy to your clipboard:

~$ cd ~/.ssh && ssh-keygen
~$ cat id_rsa.pub | pbcopy
@ShafSpecs
ShafSpecs / advanced-formatting-github-markdown.md
Created March 3, 2023 17:43 — forked from apaskulin/advanced-formatting-github-markdown.md
Tips and tricks for more formatting options in GitHub Markdown

Advanced Formatting in GitHub Markdown

GitHub Flavored Markdown lets you create useful documents in GitHub and GitHub Enterprise using .md files. Like other varieties of markdown, GitHub Markdown tries to be as readable as possible in its raw form, resulting in an intentionally limited set of formatting options. However, these options can feel restrictive when dealing with complex content.

Although GitHub Markdown strips out most HTML tags, here are a few tricks that can give you more flexibility when formatting your documents. These advanced formatting options can make your documents more useable, but they come at the expense of plain text readability, so use with caution.

@ShafSpecs
ShafSpecs / README.md
Created January 11, 2023 07:25 — forked from gitname/README.md
Using `@react-pdf/renderer` with React 18

Using @react-pdf/renderer with React 18

Introduction

When I tried to use the @react-pdf/renderer package with a React 18 app, two problems arose. In this article, I'll describe those problems and tell you how I solved them.

Update: Here's a video demonstration of the problems and solution described in this article: https://youtu.be/YZP5r7Uy_bU

Problem 1: Dependency Conflict