Skip to content

Instantly share code, notes, and snippets.

View MohammadMD1383's full-sized avatar
💭
I may be slow to respond.

Mohammad Mostafa Dastjerdi MohammadMD1383

💭
I may be slow to respond.
View GitHub Profile
const {randomUUID} = require('node:crypto');
// Mocks for external dependencies
const registerLevel = (level, name, color) => {
// console.log(`Registered level: ${name} (${level}) with color ${color}`);
};
const log = (level, time, source, msg, info, extra) => {
// console.log(`[${time}] [${level}] [${source}] ${msg}`);
};
const time = () => new Date().toISOString();
@MohammadMD1383
MohammadMD1383 / include-html.ts
Created June 1, 2021 13:43
includes the contents of a file to current position it is in a html document
class IncludeHtml extends HTMLElement {
static get observedAttributes(): Array<string> {
return ["url"];
}
constructor() {
super();
}
connectedCallback(): void {
@MohammadMD1383
MohammadMD1383 / AndroidProgressBar.ts
Created June 1, 2021 13:15
an Android like progress ring/bar for html
class AndroidProgressBar extends HTMLElement {
#root: ShadowRoot;
#svg: SVGSVGElement;
#circle: SVGCircleElement;
static #MIN_SPEED_RATE: number = 1.5;
static #MAX_SPEED_RATE: number = 3;
constructor() {
super();
@MohammadMD1383
MohammadMD1383 / Modal.js
Last active December 14, 2020 11:25
use this module to create your bootstrap modals easily with javascript.
export default class Modal {
/** @type {boolean} */
static #isModalOpen = false;
/** @type {boolean} */
static #isRtl = false;
/** @param {boolean} bool */
static set isRtl(bool) {