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 / 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
@movahhedi
movahhedi / image-resize.js
Created June 21, 2023 15:11 — forked from daviesesiro/image-resize.js
a minimal function to resize an image on the browser in JavaScript
/**
* Resizes an Image File and converts it to a dataurl string.
* @param imageFile the image file (probably from a file input)
* @param resize_width The width you want the image to be
* @param quality quality of the resize image 0 - 1
*/
const resizeImage = ({
resizeWidth = 400,
imageFile,
quality = 1,