Skip to content

Instantly share code, notes, and snippets.

@mahmoud-eskandari
mahmoud-eskandari / README.md
Last active June 27, 2024 07:58
Install v2ray on Bridge:(Ubuntu +18 via systemd) - Upstream (Ubuntu +18/CentOS +7 via docker)

پنل x-ui

پنل تحت وب مدیریت V2ray و ساخت کاربر و مدیریت سرور

mkdir x-ui && cd x-ui
docker run -itd --network=host \
    -v $PWD/db/:/etc/x-ui/ \
 -v $PWD/cert/:/root/cert/ \
@ali-master
ali-master / redux-from-scratch.js
Created July 15, 2021 18:46
Redux from scratch without typescript
function createStore(reducer, preloadedState) {
if(typeof reducer !== "function") {
throw new Error("Reducer should be a function.");
}
if(typeof preloadedState === "function") {
throw new Error("PreloadedState can't be a function.");
}
let currentState = preloadedState;
@ali-master
ali-master / redux-from-scratch.ts
Created July 9, 2021 19:12
A simple redux from scratch
/**
* Redux
* - getState()
* - subscribe()
* - dispatch() -> ui -> state
* - combineReducer
*
*
* - replaceReducer
* - injectReducer
@sindresorhus
sindresorhus / esm-package.md
Last active July 3, 2024 11:21
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@geordee
geordee / emirates-id.html
Last active February 20, 2024 06:32
Validate Emirates ID
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Validate Emirates ID</title>
<link rel="stylesheet" href="https://unpkg.com/mvp.css">
<style>
section {
display: flex;
const express = require('express');
const app = express();
// Application
app.get('/', function(req, res) {
if (process.env.NODE_ENV === 'development') {
for (var key in require.cache) {
delete require.cache[key];
}
}
@ali-master
ali-master / README.md
Last active November 20, 2021 13:32
Update Snappfood order page

Install

  1. Install the tampermonkey extension.
  2. Add this hack into your scripts
  3. Go to snappfood.com and then click on an order in orders page.
  4. Open the browser console
  5. Call one of these functions in console

Change date

updateDate("۱۳۹۸/۰۱/۱۲");
@chalist
chalist / package.json
Created February 13, 2019 03:56
pckage.json for coompile and lint scss files and minify css, lint and minify js, inject css with browserSync and watch files
{
"name": "bookism",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"scss": "node-sass --output-style compressed --watch src/scss -o dist/css",
"serve": "browser-sync start --proxy 0.0.0.0:9999 --files 'dist/css/*.css'",
"clean": "rimraf dist/{css/*,js/*}",
"lint": "eslint src/js || true",
@unicornist
unicornist / Persian CharFix Arabic (Selection).sublime-macro
Created January 12, 2019 20:53
SublimeText Macros to convert some Arabic chars (yeh, keh, digits) and convert English digits to their correct Persian alternatives.
[
{"command": "insert_snippet", "args": {"contents": "${SELECTION/(?<1>\\x{661})|(?<2>\\x{662})|(?<3>\\x{663})|(?<4>\\x{664})|(?<5>\\x{665})|(?<6>\\x{666})|(?<7>\\x{667})|(?<8>\\x{668})|(?<9>\\x{669})|(?<10>\\x{660})|(?<11>\\x{64A})|(?<12>\\x{643})/(?{1}\\x{6F1}:(?{2}\\x{6F2}:(?{3}\\x{6F3}:(?{4}\\x{6F4}:(?{5}\\x{6F5}:(?{6}\\x{6F6}:(?{7}\\x{6F7}:(?{8}\\x{6F8}:(?{9}\\x{6F9}:(?{10}\\x{6F0}:(?{11}\\x{6CC}:\\x{6A9})))))))))))/gm}"}}
]