Skip to content

Instantly share code, notes, and snippets.

View imkarimkarim's full-sized avatar
🔭
crawling the internet

karim imkarimkarim

🔭
crawling the internet
View GitHub Profile
@imkarimkarim
imkarimkarim / products.js
Last active November 11, 2022 07:54
strapi in app auth: only let authed users CUD their enteties, not other users... (i implemented for store and its child(product) content-type here but you can extend...)
"use strict";
const { getStoreOfProduct, isUserOwnsStore } = require("../../../lib/utils");
/**
* product service
*/
const { createCoreService } = require("@strapi/strapi").factories;
git commit conventions:
https://github.com/conventional-changelog/commitlint#what-is-commitlint
https://www.conventionalcommits.org/en/v1.0.0/#specification
# examples
type(scope?): subject
feat: add espanol lanugage
fix(ui): bug in submit button
@imkarimkarim
imkarimkarim / ContextProvider.tsx
Last active September 5, 2023 07:38
React Context in Typescript
import { createContext, FC, useContext, useState } from 'react';
const Context = createContext<any>(null);
type Props = {
children: JSX.Element[] | JSX.Element | string;
};
const StateProvider: FC<Props> = ({ children }) => {
const [state, setState] = useState();
@imkarimkarim
imkarimkarim / x-ui_default_credentials.txt
Created April 11, 2023 09:17
x-ui default credentials
port: 54321
user: admin
pass: admin
@imkarimkarim
imkarimkarim / extensions.json
Last active May 30, 2024 13:48
VSCode's Settings - Syncing
[
{
"id": "aaron-bond.better-comments",
"name": "better-comments",
"publisher": "aaron-bond",
"version": "3.0.2"
},
{
"id": "adpyke.codesnap",
"name": "codesnap",
@imkarimkarim
imkarimkarim / Example.tsx
Last active December 13, 2023 07:43
Pure React OTP input
import React from "react";
export default function Example() {
return <OtpInput value={otp} onChange={(value: string) => setOtp(value)} />;
}
@imkarimkarim
imkarimkarim / .eslintignore
Created December 13, 2023 04:22
karim project configs and helpers
node_modules
build
scripts/setNewVersion.js
@imkarimkarim
imkarimkarim / setNewVersion.js
Last active December 30, 2023 23:26
version setter script
// nodejs script that adds a new version to the project. (git(local, and remote), package.json and a commit message)
// example: node setNewVersion.js 0.0.1
const fs = require('fs');
const path = require('path');
const { exec } = require('child_process');
let v = process.argv[2];
if (v.charAt(0) === 'v') {
v = v.substring(1);
@imkarimkarim
imkarimkarim / redditCleaner.js
Last active April 7, 2024 21:05
click on reddits "RECENT", "CUSTOME FEED" and "Clear(history)" buttons with js.
function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
const t = 50;
(async () => {
let f1 = false;
while (!f1) {
let jsPath;
@imkarimkarim
imkarimkarim / nvchad.cheatsheet
Last active June 6, 2024 10:11
chad-cheats (nvchad cheatsheet)
chad-cheats:
# based on: https://youtu.be/Mtgo-nP_r8Y
space + h + t : change theme
:TSInstall <language>(elixir) : add syntax highlighting support
:TSInstallInfo : see what syntax highlighting are already installed