Skip to content

Instantly share code, notes, and snippets.

View movahhedi's full-sized avatar
💻
Coding, probably.

Shahab Movahhedi movahhedi

💻
Coding, probably.
View GitHub Profile
@movahhedi
movahhedi / draw.html
Created July 30, 2024 13:08
A simple drawing canvas in pure JS
<html>
<script type="text/javascript">
let canvas,
ctx,
flag = false,
prevX = 0,
currentX = 0,
prevY = 0,
currentY = 0,
dotFlag = false,
@movahhedi
movahhedi / Amoozeshyar-Subject-Export.js
Created April 10, 2024 16:59
Exporting subjects from IAU's Amoozeshyar. Run it in the browser console.
const trs = document.querySelectorAll("#tableContainer tbody tr");
const dataColumnsRaw = [];
const dataArrayRaw = [];
const ths = document.querySelectorAll("#tableContainer thead tr th");
ths.forEach((th) => {
dataColumnsRaw.push(th.textContent?.trim());
});
@movahhedi
movahhedi / Ubuntu-Help.md
Last active January 5, 2024 11:09
Useful articles for setting up an Ubuntu server
@movahhedi
movahhedi / SimpleFetch.ts
Created July 16, 2023 20:27
AdmoPro's never-used SimpleFetch function
export async function SimpleFetch(url = "", Data = {}) {
const fd = new FormData();
fd.append("JsonEncodedAjaxData", JSON.stringify(Data));
for (const [key, value] of Object.entries(Data)) fd.append(key, value as string | Blob);
// Default options are marked with *
const response = await fetch(url, {
method: "POST", // *GET, POST, PUT, DELETE, etc.
mode: "cors", // no-cors, *cors, same-origin
cache: "no-cache", // *default, no-cache, reload, force-cache, only-if-cached
@movahhedi
movahhedi / jquery.ts
Created July 16, 2023 09:06
A simple extension of JQuery for TypeScript
import $ from "jquery";
declare global {
interface JQuery {
/**
* Serialize an html form to an object
*
* @param Additional Additional key-value pairs to append to the result
* @returns An object containing form data
*/
@movahhedi
movahhedi / empty-element-benchmark.md
Last active January 5, 2024 14:21
A benchmark of different methods to empty an HTML element