Benjamin Modayil

Benjamin Modayil

// Name: Get Hero Icons
// Description: Copies a Hero Icon from TailwindLabs open-sourced repository.
// Author: Benjamin Modayil
// Twitter: @modayilme
/** @type {import("@johnlindquist/kit")} */
const baseRoute = 'https://api.github.com/repos/tailwindlabs/heroicons/contents/optimized';
let outlineFolderPath = `${baseRoute}/outline`;
let solidFolderPath = `${baseRoute}/solid`;
let outlineFiles;
let solidFiles;
const headers = {
'User-Agent': 'scriptkit/hero-icons'
};
try {
let outlineResponse = await get(outlineFolderPath, headers);
let solidResponse = await get(solidFolderPath, headers);
outlineFiles = outlineResponse.data;
solidFiles = solidResponse.data;
} catch (error) {
notify(error);
}
const outlineRemotePath =
'https://raw.githubusercontent.com/tailwindlabs/heroicons/master/optimized/outline';
const solidRemotePath =
'https://raw.githubusercontent.com/tailwindlabs/heroicons/master/optimized/solid';
// We only loop over the outline folder files as the only difference in folders is the icon style type, solid versus outline, (230 files in each folder).
const options = outlineFiles.map((file) => {
return {
name: file.name,
description: file.path,
value: file.name,
preview: `
<div class="bg-white flex">
<figure class="flex flex-col items-center flex-auto w-40 m-0">
<img class="w-40" src="${outlineRemotePath}/${file.name}" alt="outline ">
<figcaption class="center text-black">outline</figcaption>
</figure>
<figure class="flex flex-col items-center flex-auto w-40 m-0">
<img class="w-40" src="${solidRemotePath}/${file.name}" alt="solid ">
<figcaption class="center text-black">solid</figcaption>
</figure>
</div>
`
};
});
const fileName = await arg('Search for an icon:', options);
const typeOptions = [
{
name: 'outline',
value: `${outlineRemotePath}/${fileName}`,
preview: `
<div>
<figure class="bg-white flex flex-col items-center flex-auto w-40 m-0">
<img class="w-40" src="${outlineRemotePath}/${fileName}" alt="outline ${fileName}">
<figcaption class="center text-black">outline</figcaption>
</figure>
</div>
`
},
{
name: 'solid',
value: `${solidRemotePath}/${fileName}`,
preview: () => `
<div>
<figure class="bg-white flex flex-col items-center flex-auto w-40 m-0">
<img class="w-40" src="${solidRemotePath}/${fileName}" alt="solid ${fileName}">
<figcaption class="center text-black">solid</figcaption>
</figure>
</div>
`
}
];
const downloadLink = await arg('Which type?', typeOptions);
const type = downloadLink.includes('outline') ? 'outline' : 'solid';
try {
let buffer = await download(downloadLink, headers);
await copy(buffer.toString());
notify(`Copied ${type} ${fileName} icon to clipboard`);
} catch (error) {
notify(error);
}

#! /usr/bin/env python3
import pyautogui
import time
while True:
pyautogui.moveRel(0, 50, duration=1.5)
time.sleep(1)
pyautogui.moveRel(0, -50, duration=1.5)
time.sleep(1)
pyautogui.moveRel(50, 0, duration=1.5)
time.sleep(1)
pyautogui.moveRel(-50, 0, duration=1.5)
time.sleep(1)
# You can remove a bunch of the repetition above. I just like seeing the mouse move a lot to know it's working.
// Menu: Mouse Mover
// Description: Moves your mouse so you don't go inactive in Slack or Microsoft Teams
// Author: Benjamin Modayil
// Twitter: @24props
await exec(`/PATH-TO-PYTHON-EXECUTABLE/python3.9 /PATH-TO-SCRIPT/i-am-here.py`)

// Title: Generate types
// Description: Paste your JSON in and get your Interfaces straight to your clipboard
// Author: Benjamin Modayil
// Twitter: @24props
let {json2ts} = await npm('json-ts')
let schema = await arg("What is the schema?");
await copy(`${json2ts(schema)}`)
notify({
title: 'Interfaces copied to the clipboard',
message: "Paste your interfaces into a text editor"
})
exit() // needed otherwise scriptkit hangs open
interface IRootObject {
count: number;
next: string;
previous: null;
results: IResultsItem[];
}
interface IResultsItem {
name: string;
url: string;
}