Skip to content

Instantly share code, notes, and snippets.

View islami00's full-sized avatar

Islam islami00

View GitHub Profile
@dbrxnds
dbrxnds / transformer.ts
Last active May 6, 2025 10:16
Mantine v6 to v7 - createStyles to CSS modules basic codemod
import { API, Collection, FileInfo, JSCodeshift } from "jscodeshift"
import fs from "fs"
export default function transformer(file: FileInfo, api: API) {
const j = api.jscodeshift
const source = j(file.source)
const createStylesCalls = j(file.source).find(j.CallExpression, {
callee: {
name: "createStyles",
@7468696e6b
7468696e6b / okular-appleSilicon.md
Last active July 4, 2025 09:44
how to install Okular viewer on macOS Big Sur, using M1/Apple Silicon/arm64
  1. Install homebrew from https://brew.sh/ (follow the instructions there)
  2. tap the https://invent.kde.org/packaging/homebrew-kde/ repo, brew tap kde-mac/kde https://invent.kde.org/packaging/homebrew-kde.git
  3. brew edit okular, workaround now is to comment out or delete the line depends_on "chmlib" (won't compile on macos arm64 for now as of 2021-08-18), then save (if using vim you need to first press i to insert/type, when saving then <esc> then :wq then <enter>.
  4. brew install okular, wait for stuff to compile and/or install
  5. It may ask for keychain credentials (to sign the binaries? because of mac arm64 security policy https://eclecticlight.co/2021/01/26/when-you-dont-have-permission-to-run-an-app-on-an-m1-mac/)
  6. $(brew --repo kde-mac/kde)/tools/do-caveats.sh
  7. Now okular is in your $HOME/Applications/KDE folder, and will show up in Launchpad! You can view pdf, djvu, etc documents.

Edit: as of 2025 there is now a precompiled nightly binary available for download at https://okul

@skurfuerst
skurfuerst / gen-types.mjs
Created January 16, 2021 21:10
Generate runtypes from TypeScript definitions using ts-morph
// RUN with a recent node.js version, using "node gen-types.mjs"
// DEPENDS on typescript and ts-morph
import { Project } from "ts-morph";
import { writeFileSync } from "fs";
const project = new Project({
tsConfigFilePath: "tsconfig.json",
});
@textbook
textbook / cypress-cra.md
Last active September 28, 2023 20:16
Adding Cypress to a Create React App app

Here is how to add Cypress E2E tests to a Create React App bootstrapped application. Assumes the *nix command line, you may need to adapt this for a Windows command line (or use WSL or Git Bash).

  1. Install Cypress and the Testing Library utilities for it (to match the helpers CRA installs):

    $ npm i {,@testing-library/}cypress

    i is short for install, and the braces {} are expanded by brace expansion to cypress @testing-library/cypress.

@mtilson
mtilson / _script.sh
Last active November 14, 2022 08:26
how to trigger GitHub Actions workflows in different ways [git] [github] [workflow] [webhook]
#!/usr/bin/env bash
set -e
# we are going to setup different GitHub Actions workflows on
# GitHub repo '${repoName}' under GitHub user account '${userName}'
# which has Write access to the repo
# to trigger 'webhook' event with help of 'curl' command we use
# 'Authorization' header with personal access token '${token}' which
# has to be created aforehand, see [2]
@tianhaoz95
tianhaoz95 / open-in-gitpod.md
Last active February 29, 2024 21:43
Code to add a open in Gitpod badge

Here is your awesome Open in Gitpod badge

[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/[your GitHub username]/[your repository])

Open in Gitpod

@WangHansen
WangHansen / userschema.ts
Last active October 14, 2022 18:40
Convert Mongoose js to ts
import { Document, Model, model, Types, Schema, Query } from "mongoose"
import { Company } from "./Company"
// Schema
const UserSchema = Schema<UserDocument, UserModel>({
firstName: {
type: String,
required: true
},
lastName: String,
@stolinski
stolinski / providerCompose.js
Created April 23, 2019 17:40
ProviderComposer
function ProviderComposer({ contexts, children }) {
return contexts.reduceRight(
(kids, parent) =>
React.cloneElement(parent, {
children: kids,
}),
children
);
}
@qoomon
qoomon / conventional-commits-cheatsheet.md
Last active July 20, 2025 05:50
Conventional Commits Cheatsheet
@bvaughn
bvaughn / index.md
Last active June 16, 2025 15:19
How to use profiling in production mode for react-dom

React recently introduced an experimental profiler API. This page gives instructions on how to use this API in a production release of your app.

Table of Contents

Profiling in production

React DOM automatically supports profiling in development mode for v16.5+, but since profiling adds some small additional overhead it is opt-in for production mode. This gist explains how to opt-in.