Skip to content

Instantly share code, notes, and snippets.

View vojtaholik's full-sized avatar
:shipit:
waiting for better models ;)

Vojta Holik vojtaholik

:shipit:
waiting for better models ;)
View GitHub Profile
// Name: Save to MyMind
// Description: Save bookmarks, notes, or images to MyMind
// Shortcut: cmd+shift+s
import "@johnlindquist/kit";
import { readFile } from "node:fs/promises";
import { extname, basename } from "node:path";
const MYMIND_URL = "http://localhost:1234";

Fuck yeah, Nuxt makes perfect sense for your use case! Since you’re planning Vue integration later, this gives you a smooth migration path from static to dynamic. Here’s how your current setup would look in Nuxt:

Nuxt Configuration

// nuxt.config.ts
export default defineNuxtConfig({
  devtools: { enabled: true },
  
  // Generate static files
export const cohortProductFieldsSchema = z.object({
// Defaults
body: z.string().nullable().optional(),
description: z.string().optional(),
slug: z.string(),
state: ResourceStateSchema.default('draft'),
visibility: ResourceVisibilitySchema.default('unlisted'),
type: z.literal('live'),
// Cohort Details
@vojtaholik
vojtaholik / page.tsx
Last active December 13, 2023 14:50
feat: resizable panels
import ResizablePanels from '../_components/resizable-panels'
import {cookies} from 'next/headers'
const EditorLayout = () => {
const defaultLayout = getDefaultLayout()
return (
<div className="flex h-full flex-grow flex-col">
<ResizablePanels defaultLayout={defaultLayout} />
</div>
)
// Name: Watch Screenshots Dir
// Watch: ~/Desktop/screenshots
// Description: Don't forget to run following command in your terminal to set default screenshot directory in macOSX: defaults write com.apple.screencapture location ~/Desktop/screenshots
import "@johnlindquist/kit";
import cloudinary from "cloudinary";
import trash from "trash";
const DIR = "screenshots";
const NOTIFY_SOUND_FILE_PATH = false; // home("Desktop/come-here-notification.mp3");
// Menu: Record Screen
// Shortcut: shift cmd 5
/** @type {import("@johnlindquist/kit")} */
await applescript(`
-- # Setup to do a screen recording.
# tell application "QuickTime Player" to new screen recording
import {Button} from '@package/ui/button'
import {ThemeProvider} from '@package/ui/use-theme'
import {appUniqueTheme} from './theme'
const Page = () => {
return (
<ThemeProvider theme={appUniqueTheme} />
<Button />
</ThemeProvider>
)
// Menu: Tinify
// Description: Compress selected images with Tinify
// Author: Vojta Holik
// Twitter: @vjthlk
let tinify = await npm("tinify");
let fs = await import("fs");
let selectedFiles = await getSelectedFile();
tinify.key = await env("TINIFY_API_KEY", {
import {publicProcedure, router} from '@skillrecordings/skill-lesson'
import {isEmpty} from 'lodash'
import {getToken} from 'next-auth/jwt'
import {getSubscriberFromCookie} from '@skillrecordings/skill-lesson/utils/ck-subscriber-from-cookie'
export const offerRouter = router({
getNextOffer: publicProcedure.query(async ({ctx}) => {
const token = await getToken({req: ctx.req})
const subscriber = await getSubscriberFromCookie(ctx.req)
// Name: Markdown to Portable Text
/** @type {import("@johnlindquist/kit")} */
const { markdownToRichText } = await npm("@tryfabric/martian");
const showdown = await npm("showdown");
const input = await getSelectedText();
const output = markdownToRichText(input);
const converter = new showdown.Converter();
const html = converter.makeHtml(input, {