Skip to content

Instantly share code, notes, and snippets.

View JoepKockelkorn's full-sized avatar

Joep Kockelkorn JoepKockelkorn

View GitHub Profile
@JoepKockelkorn
JoepKockelkorn / keybase.md
Created December 10, 2020 15:10
Keybase proof

Keybase proof

I hereby claim:

  • I am joepkockelkorn on github.
  • I am joepkockelkorn (https://keybase.io/joepkockelkorn) on keybase.
  • I have a public key ASD9NTrEm2GSIzDuQ0kkjWUbkPXHLv0cAwUwyOV3YVIfRQo

To claim this, I am signing this object:

// Menu: Watch slack status
// Description: Open a refreshing widget which shows any slack incidents
/** @type {import("@johnlindquist/kit")} */
const intervalInMinutes = 2;
const intervalInMs = 2 * 60 * 1000;
const { incidentTitle, updatedFormatted, nextUpdateFormatted } = await getData(
intervalInMs
);
// 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("")
// 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: 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" });
@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: Open GIPHY CAPTURE
// Shortcut: cmd + shift + v
/** @type {import("@johnlindquist/kit")} */
await $`open -a "GIPHY CAPTURE"`
// 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: 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"];
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()