Skip to content

Instantly share code, notes, and snippets.

View oussamahamdaoui's full-sized avatar
🎯
Focusing

Hamdaoui Oussama oussamahamdaoui

🎯
Focusing
View GitHub Profile
@oussamahamdaoui
oussamahamdaoui / whiteSpace.js
Created June 25, 2023 11:39
Short interpreter for the whitespace language in node js
//@ts-check
const { readFileSync } = require('fs');
const { join } = require('path');
const readline = require('readline');
/** @typedef {Exclude<typeof instructions[number]["name"], "NEW_LABEL">} INSTRUCTION_NAME */
/** @typedef {{name:INSTRUCTION_NAME}} INSTRUCTION */
/** @typedef {{value:bigint, type:"NUMBER"}|{type:"LABEL", value:string}} VALUE */
/** @typedef {VALUE|INSTRUCTION} VALUE_OR_INSTRUCTION */
@oussamahamdaoui
oussamahamdaoui / lib.js
Created March 13, 2023 00:59
Parser combinators for data validation Part 1 and 2
/**
* Context
* @typedef {object} Context
* @property {boolean} isError
* @property {string} errorMessage
* @property {number} index
* @property {any} result
* @property {any} srcObj
* @property {string} path
*
@oussamahamdaoui
oussamahamdaoui / devtools-backend.ts
Last active January 14, 2025 06:03
Detect devtools open and close events tested on Chrome and Safari,
/**
Any server would do as long as there is a path that sets a cookie named devtools
**/
//@ts-ignore
import { Bun } from 'bun';
import fs from "fs";
export default {
port: 3000,
{
"list":[
"localhost:400",
]
}