Skip to content

Instantly share code, notes, and snippets.

Avatar
🥊

Parsa Ghadimi qti3e

🥊
View GitHub Profile
@qti3e
qti3e / chan_demo.ts
Created May 20, 2021
Go concurrency in JavaScript
View chan_demo.ts
import { Go, Chan, Lock } from "./go";
const chan = Chan<number>();
const sumPromise = Go(async ($: WaitFn) => {
let sum = 0;
for await (const msg of chan.receive()) {
console.log('Received', msg);
sum += msg;
}
@qti3e
qti3e / bernoulli.js
Created May 22, 2019
Generate first n Bernoulli numbers
View bernoulli.js
function b(max) {
const B = Array(max + 1).fill(0);
B[0] = 1;
B[1] = 1/2;
for (let n = 2; n <= max; n += 2) {
let sum = 0;
let c = 1;
for (let j = 0, j2 = n; j <= n / 2; j += 2, j2 -= 2) {
View .tmux-layout
|/|
0> vim
2> cd client && yarn start
3> cd server && yarn start
0
View main.c
#include <stdlib.h> // for NULL
#include <sys/mman.h> // for mmap
#include <stdio.h>
#include <string.h>
#include <stdint.h>
unsigned char data[] = {
// "Hello\n"
0x48, 0x65, 0x6c, 0x6c, 0x6f, 0xA
};
View data.json
This file has been truncated, but you can view the full file.
[
{
"names": [
"تورهال"
],
"country": "TR",
"lng": 36.09,
"lat": 40.39
},
View persian.ts
/**
* ____ _ _ _____
* /___ \ |_(_)___ / ___
* // / / __| | |_ \ / _ \
* / \_/ /| |_| |___) | __/
* \___,_\ \__|_|____/ \___|
*/
import { Request, Response } from "express";
View index.ts
async function bottom(props, resolve, parentDom) {
const btn = document.createElement("bottom");
parentDom.appendChild(btn);
btn.onclick = (e) => {
props.onClick(e, resolve);
}
return btn;
}
function html(elementName) {
@qti3e
qti3e / gist:939157626614b0a1cfe453a4985262cf
Created May 31, 2018 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup
View gist:939157626614b0a1cfe453a4985262cf

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
View fix_macintosh_portrange.sh
#sudo sysctl -w net.inet.ip.portrange.first=32768
sudo sysctl -w net.inet.ip.portrange.first=12000
sudo sysctl -w net.inet.tcp.msl=1000
sudo sysctl -w kern.maxfiles=1000000 kern.maxfilesperproc=1000000
@qti3e
qti3e / break.js
Created Mar 27, 2018
Why break in a switch statement is important?
View break.js
const o = {
i: 0,
get x() {
return this.i++;
}
};
switch (o.x) {
case 0:
console.log("a");
case 1: