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 / 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)
@ahmedazhar05
ahmedazhar05 / to_JsDelivr_CDN.js
Last active January 9, 2024 08:05
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 / 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 / notes.md
Last active December 23, 2023 09:33
Java 8 OCA 1Z0-808 Certification pre-exam quick go-through notes
@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 / 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 / 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 / intensive1_day1.md
Last active November 19, 2023 15:55
Arabic notes for DREAM INTENSIVE program by Nouman Ali Khan
@ahmedazhar05
ahmedazhar05 / Dockerfile
Last active July 13, 2023 08:52
Docker image configuration for on-the-go TypeScript
FROM node:latest
ARG UID
ARG GID
RUN apt update -y \
&& apt upgrade -y
USER $UID:$GID
@ahmedazhar05
ahmedazhar05 / web_whats_appify.js
Last active May 8, 2022 19:38
Bookmarklet: Converts Whatsapp Web interface into native app like
javascript:(function(){
document.querySelector('meta[name="viewport"]').content = 'width=device-width, initial-scale=1.0';
const st = document.body.lastChild.tagName === 'STYLE' ? document.body.lastChild : document.createElement('style');
document.body.append(st);
document.body.style.zoom = window.devicePixelRatio;
const frame = document.getElementsByClassName('_1XkO3')[0];
window.onpopstate = e => {
let btn = document.querySelector('button.bmJTq');
if(btn){
btn.click();