Skip to content

Instantly share code, notes, and snippets.

View mhmda-83's full-sized avatar
🤔

Mohammad Mohammadalian mhmda-83

🤔
  • Iran
View GitHub Profile
@AmirhBeigi
AmirhBeigi / iranCityWithPrefixPhoneNumber.json
Created August 10, 2022 07:22
Iran city with prefix phone number
[
{
"name": "آذربایجان شرقی",
"code": "041"
},
{
"name": "آذربایجان غربی",
"code": "044"
},
{
@mojaray2k
mojaray2k / typescript-compiler-config-optons.md
Created May 23, 2020 16:17
Common TypeScript compiler and tsconfig options

TypeScript Compiler and TS Config Options

You can store the TS compiler configuration in the file called tsconfig.json. You’ll usually add this file to the root directory of your project, together with the package.json.

When you launch the compiler, it reads the tsconfig.json from the folder you launched it from, to get the instructions about how to compile your project (e.g., which source files to compile, where to store the output, etc).

The compiler reads the tsconfig.json from the folder where you run it. Also, you can tell the compiler where to look for the config using the -p option:

tsc -p tsconfig.server.json The structure of the tsconfig.json looks like this:

@bradtraversy
bradtraversy / mongodb_cheat_sheet.md
Last active November 15, 2024 10:00
MongoDB Cheat Sheet

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@franciscocpg
franciscocpg / README.md
Last active May 13, 2024 08:48
Import mitm certificate to CA in arch linux
  1. After installing mitmproxy run it (just type mitmproxy) in a terminal session and quit. This will create the necessaries certificates files at ~/.mitmproxy.

  2. Extract the certificate to .crt format:
    openssl x509 -in ~/.mitmproxy/mitmproxy-ca.pem -inform PEM -out ca.crt

  3. Trust the certificate into CA:
    sudo trust anchor ca.crt

  4. Run the mitmproxy again

@themojilla
themojilla / countries.js
Last active November 11, 2024 05:54
لیست کامل کشورهای جهان - json
export default [
{ name: 'Afghanistan', code: 'AF', name_fa: 'افغانستان' },
{ name: 'land Islands', code: 'AX', name_fa: 'جزایر الند' },
{ name: 'Albania', code: 'AL', name_fa: 'آلبانی' },
{ name: 'Algeria', code: 'DZ', name_fa: 'الجزایر' },
{ name: 'American Samoa', code: 'AS', name_fa: 'ساموآی آمریکا' },
{ name: 'AndorrA', code: 'AD', name_fa: 'آندورا' },
{ name: 'Angola', code: 'AO', name_fa: 'آنگولا' },
{ name: 'Anguilla', code: 'AI', name_fa: 'آنگویلا' },
{ name: 'Antigua and Barbuda', code: 'AG', name_fa: 'آنتیگوآ و باربودا' },
@javilobo8
javilobo8 / download-file.js
Last active October 27, 2024 09:15
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);
@amirasaran
amirasaran / JavaScript Arabic character to Persian
Created September 27, 2016 06:23
JavaScript Arabic character to Persian (تبدیل حروف عربی به فارسی)
String.prototype.replaceAll = function(search, replacement) {
var target = this;
return target.replace(new RegExp(search, 'g'), replacement);
};
String.prototype.toPersianCharacter = function () {
var string = this;
var obj = {
'ك' :'ک',
'دِ': 'د',
@watson
watson / redos.js
Last active December 15, 2022 17:11
Node.js ReDoS example
// for more info about ReDoS, see:
// https://en.wikipedia.org/wiki/ReDoS
var r = /([a-z]+)+$/
var s = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaa!'
console.log('Running regular expression... please wait')
console.time('benchmark')
r.test(s)
@jossef
jossef / utils.py
Created May 24, 2016 07:09
python different ways to import external modules (from cdn / memory string / file path / plugin directory)
import imp
import importlib
import inspect
import glob
import requests
import os
def import_from_string(content, module_name, file_name=None):
if not file_name:
file_name = '{0}.py'.format(module_name)
@josteink
josteink / on_stateful_code.txt
Last active October 21, 2020 05:37
On why stateful code is bad
On why stateful code is bad
===========================
STUDENT: Sir, can I ask a question?
TEACHER: Yes!
STUDENT: How do you put an elephant inside a fridge?
TEACHER: I don't know.
STUDENT: It's easy, you just open the fridge and put it in. I have another question!
TEACHER: Ok, ask.
STUDENT: How to put a donkey inside the fridge?