This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* @name: Array.prototype.mapKey | |
* @author: @moekhalil (GitHub) | |
* | |
* @description: A prototype of a native Array.prototype.mapKey that | |
* would allow users to map over an array of objects | |
* and return the value of a specific key or nested key | |
* | |
* @param prop {string | string[] | function} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Created By : moe | mail is 𝚐𝚑𝚞𝚋-𝚊𝚝-𝚖𝚔𝚑𝚊𝚕𝚒𝚕.𝚘𝚛𝚐 | |
// Uploaded To : https://gist.github.com/moekhalil | |
// Uploaded Date: 09/06/2022 | |
// Notes : Save any file at a url with a provided filename. | |
// : Unlike download attribute, this even works with cross-origin urls | |
const downloadURLAsFilename = async ({ url, fileName }) => { | |
const mediaItem = await fetch(url); | |
const mediaBlob = await mediaItem.blob(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getAvailablePermissions = async () => { | |
const allFeatures = document.featurePolicy | |
.features() | |
.sort() | |
.map((i) => ({ name: i })); | |
const availablePermissions = []; | |
const nonPermissionFeatures = []; | |
for (let index = 0; index < allFeatures.length; index++) { | |
const feature = allFeatures[index]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Usually sitting in my .bash_alias file | |
folderFileCounter() { | |
echo -e Directory: .\\\nFiles: `(/usr/bin/find . -maxdepth 1 -type f) | wc -l` | |
/usr/bin/find . -mindepth 1 -maxdepth 1 -type d -exec sh -c "echo Directory: {}\\\nFiles: \`/usr/bin/find {} -type f | wc -l\`\\\n" \; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Direcory Listing Downloader - "Index Of/" Downloader | |
// Moe Khalil - me@mkhalil.org | |
// This is to download files located in directories with directory list permissions enabled | |
// set MINIMUM_SIZE to filter smaller files. | |
// File names will be what they are on server with date prepended and host domain appended. | |
(() => { | |
// minimum file-size to download | |
const MINIMUM_SIZE = '800K'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const list = document.createElement("ul"); | |
const filenamePre = document.title.split("-")[0].replace(/ /g, "."); | |
imgList.forEach((i, k) => fetch(i.url).then(x => x.blob()).then(imgBlob => { | |
const url = URL.createObjectURL(imgBlob); | |
const imgNum = k + 1; | |
const item = document.createElement("li"); | |
const ele = document.createElement("a"); | |
ele.innerHTML = `Image ${imgNum} - Download<br />`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getSiteVars = () => { | |
const blankWindow = window.open('about:blank'); | |
const defaultKeys = Object.keys(blankWindow); | |
blankWindow.close(); | |
return Object | |
.keys(window) | |
.reduce((all, key) => | |
blankWindow.hasOwnProperty(key) ? all : { ...all, [key]: window[key]} | |
, {} | |
); |