Skip to content

Instantly share code, notes, and snippets.

View JoepKockelkorn's full-sized avatar

Joep Kockelkorn JoepKockelkorn

View GitHub Profile
// Shortcut:
// Name: Translate with DeepL
// Description: Translate a text from a lang to a lang
// Author: Jon E. Eguiluz
// Twitter: @viroide
import "@johnlindquist/kit"
let DEEPL_API_KEY = await env("DEEPL_API_KEY", {
hint: md(
// Menu: Surround text with
// Description: Surround the selected text with some input
// Snippet:
const text = await getSelectedText();
const cmdEnterToEmit = {
name: "Submit",
key: "enter",
bar: "right",
onPress: async input => {
import "@johnlindquist/kit"
// Menu: Resize an Image
// Description: Select an image in Finder. Type option + i to resize it.
// Shortcut:
let sharp = await npm("sharp")
let imagePath = await getSelectedFile()
// Name: Convert selected images
import "@johnlindquist/kit";
// Grab selected files
const files = (await getSelectedFile()).split("\n");
// Set up whitelist of formats
const supportedFormats = [".heic", ".png", ".gif", ".webp", ".jpg", ".jpeg"];
// Menu: Resize window for focus
// Description: Set window to 75% width, 100% height and center horizontally
// Shortcut: ctrl + shift + f
/** @type {import("@johnlindquist/kit")} */
const {
bounds: { width: screenWidth, height: screenHeight },
} = await getActiveScreen();
const inset = (screenWidth * 0.25) / 2;
// Name: Open GIPHY CAPTURE
// Shortcut: cmd + shift + v
/** @type {import("@johnlindquist/kit")} */
await $`open -a "GIPHY CAPTURE"`
@JoepKockelkorn
JoepKockelkorn / redirecting-github-pages.md
Created October 8, 2022 12:26 — forked from domenic/redirecting-github-pages.md
Redirecting GitHub pages after a repository move

Redirecting GitHub Pages after a repository move

The problem

You have a repository, call it alice/repo. You would like to transfer it to the user bob, so it will become bob/repo.

However, you make heavy use of the GitHub Pages feature, so that people are often accessing https://alice.github.io/repo/. GitHub will helpfully redirect all of your repository stuff hosted on github.com after the move, but will not redirect the GitHub Pages hosted on github.io.

The solution

// Name: Lorem Ipsum
// Description: Generate lorem ipsum to clipboard
/** @type {import("@johnlindquist/kit")} */
/** @type {import("lorem-ipsum")} */
const { loremIpsum } = await npm("lorem-ipsum");
const types = ["paragraph", "sentence", "word"];
const type = await arg("Which type?", types);
const count = await arg({ description: "Count?", type: "number" });
// Menu: Surround text with
// Description: Surround the selected text with some input
/** @type {import("@johnlindquist/kit")} */
const text = await getSelectedText();
const getNewText = (surrounding) =>
md(`Output: \`${surrounding}${text}${surrounding}\``);
const surrounding = await arg("Surround with?", getNewText);
await setSelectedText(getActiveAppBounds(surrounding));
// Name: Change Case
// Description: Change casing of selected text
const v = await npm("voca");
const text = await getSelectedText();
const pascalCase = (t) =>
v
.camelCase(t)
.split("")