Skip to content

Instantly share code, notes, and snippets.

View imshvc's full-sized avatar

Nurudin Imširović imshvc

View GitHub Profile
@imshvc
imshvc / xhr.js
Last active September 16, 2024 17:23
Asynchronous XMLHttpRequest abstraction
/**
* Asynchronous XMLHttpRequest abstraction.
* @author Nurudin Imsirovic <[email protected]>
* @param {string} requestMethod - HTTP Request Method [GET, POST, PUT, DELETE, HEAD, OPTIONS, PATCH]
* @param {string} requestSource - URL or relative path to a resource
* @param {string} requestData - Data to be sent (only for POST method)
* @param {function} callback - Callback function for handling the response
* @param {string|null} requestUsername - HTTP Basic Auth Username (default `null`)
* @param {string|null} requestPassword - HTTP Basic Auth Password (default `null`)
* @throws {Error} Throws an error if XMLHttpRequest is not supported or if the callback is not a function.
@imshvc
imshvc / video2frame.js
Created September 22, 2024 17:46
Save frame from video element
/**
* Save frame from video element
* @author Nurudin Imsirovic <[email protected]>
* @param {Element} video Video element
* @param {boolean} download Download frame as file
* @param {string} filename Download name
* @return {?string} Blob URL of frame
*/
function video2frame(video = null, download = true, filename = null) {
// Not a video element
@imshvc
imshvc / svg-cleanup.php
Created February 19, 2025 07:23
CLI Script: SVG Cleanup
<?php
// Cleanup SVG by isolating SVG tag
$file = $argv[1] ?? null;
$output = $argv[2] ?? null;
if ($file === null) {
die(
'Cleanup SVG by isolating SVG tag' . PHP_EOL .
@imshvc
imshvc / create-directory-structure-for-main-storage.cmd
Last active April 7, 2025 09:50
Windows Batch Script: Create Directory Structure For Main Storage
@echo off
rem file:
rem create-directory-structure-for-main-storage.cmd
rem
rem authors:
rem Nurudin Imsirovic
rem
rem summary:
rem This batch script creates a directory structure at the