Skip to content

Instantly share code, notes, and snippets.

View ahmedazhar05's full-sized avatar
🟢
Active

Azhar Ahmed ahmedazhar05

🟢
Active
View GitHub Profile
@ahmedazhar05
ahmedazhar05 / udemy_ff.js
Last active July 19, 2023 15:33
Udemy Fast-forward bookmarklet
javascript:(function forwarder(toggle_script_execution = false) {
const start_alert = () => console.log("%c Forwarder script started running...", "color: green");
const stop_alert = () => console.log("%c Forwarder script stopped running!", "color: red");
/* toggling the execution of this whole script */
if(toggle_script_execution && 'ff_set' in window) {
window.ff_set = !window.ff_set;
if(window.ff_set) start_alert();
} else if(!('ff_set' in window)) {
window.ff_set = true;
@ahmedazhar05
ahmedazhar05 / Date.prototype.format.ts
Last active September 30, 2023 09:23
Date format function similar to date command(https://man7.org/linux/man-pages/man1/date.1.html) in unix, Note: this code haven't been tested even once yet, may contain tons of bugs
export default function format(formatString: string): string {
const day = this.getDate();
const month = this.getMonth();
const year = this.getFullYear();
const isLeapYear = (year % 4 == 0 && year % 100 != 0) || year % 400 == 0;
const data = {
weekdays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
dayCount: [31, Number(isLeapYear) + 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
@ahmedazhar05
ahmedazhar05 / idea.md
Last active November 6, 2023 13:01
Standardizing the parsing of complex URL query strings

Rules:

variable[] = [] # append new item in the array
variable[integer] = [] # alter the (already-available/pre-existing) index in the array
variable[non-integer] = {} # object
y[][non-integer] = [{}] # create an object as a newly created array element
variable[integer][non-integer] = [{}] # alter the object at the pre-existing indexed position
y[non-integer][] = {[]} # append a new array element to the key
variable[non-integer][integer] = {[]} # alter the pre-existing array index of the key-value object
@ahmedazhar05
ahmedazhar05 / notes.md
Last active December 23, 2023 09:33
Java 8 OCA 1Z0-808 Certification pre-exam quick go-through notes
@ahmedazhar05
ahmedazhar05 / functional.ts
Last active December 28, 2023 09:43
recreating conceptual-functions of- the functional programming paradigm
/*
Function Composition
*/
const compose_rtl = (...functions: ((..._: any[]) => any)[]) => {
const [first, ...rest] = functions;
if(!first) return (...argv) => argv;
return (...args) => first.apply(null, rest.length > 0 ? [compose_rtl(...rest)(...args)] : args);
}
const compose = (...functions: ((..._: any[]) => any)[]) => {
@ahmedazhar05
ahmedazhar05 / to_JsDelivr_CDN.js
Last active December 20, 2024 09:23
Convert npm, github and wordpress-svn repositories into JsDelivr CDN with this bookmarklet
javascript:(function(){
const host = window.location.hostname;
const path = window.location.pathname;
let destination_path = "";
switch(host) {
case 'themes.svn.wordpress.org':
destination_path = '/themes';
case 'plugins.svn.wordpress.org':
destination_path = `/wp${destination_path}${path}`;
@ahmedazhar05
ahmedazhar05 / java_collections.yaml.lua
Created January 17, 2024 19:56
Java 8 Collections Framework with Functions
---
# source: https://docs.oracle.com/javase/8/docs/technotes/guides/collections/reference.html
Collections Framework:
Interfaces:
Set:
- boolean add(E e)
- boolean addAll(Collection<? extends E> c)
- void clear()
- boolean contains(Object o)
- boolean containsAll(Collection<?> c)