Skip to content

Instantly share code, notes, and snippets.

View johannschopplich's full-sized avatar

Johann Schopplich johannschopplich

View GitHub Profile
@johannschopplich
johannschopplich / index.html
Created March 4, 2026 15:06
Qlock – aem1k.com/qlock
<script>
(r=()=>setInterval(t=>{for(j=o="\n",y=5;y--;document.body["inn"
+"erHTML"]="<pre>&lt"+(S="script>\n")+o+"\n\n&lt/"+S)for(x=-01;
63-!y>x++;o+=`(r=${r})()`[j++].fontcolor(c?"#FF0":"#444"))c=x/2
%4<3&&parseInt("odRFacb67o2vi5gmOZmwFNteohbOh3sw".slice(i="9"<(
D=Date()[16+(x/8|0)])?30:D*3,i+3),36)&1<<(x/2|0)%4+3*y},100))()
</script>
@johannschopplich
johannschopplich / README.md
Last active February 7, 2025 10:28
Bücherspur Flowchart

Bücherspur Flow

Kirby CMS & Stationen

Im Kirby CMS können Benutzer Touren und Stationen anlegen und bearbeiten. Jede Station enthält neben Textinhalten auch einen POI-Datensatz. Dieser POI-Datensatz ist für die Nutzer schreibgeschützt, da er von der externen Destination One-Datenbank importiert wird. Anhand eines POI-ID-Feldes wird eine Verbindung zwischen der Station und dem entsprechenden POI hergestellt. Über einen Button im Kirby Panel können Sie gezielt POI-Daten importieren. Wird der Button betätigt, erfolgt ein Aufruf des Workers, der die Datenaktualisierung durchführt.

Der Abruf von POI-Daten von Destination One erfolgt auf Abruf. Alle Daten vom Frontend werden immer von Kirby geladen.

Worker

Der serverlose Worker kümmert sich um sämtliche Logik rund um die POI-Daten. Er kommuniziert direkt mit der externen Destination One-Datenbank und stellt über zwei unterschiedliche Routen sicher, dass die Daten synchronisiert werden:

  • Die Route /destination-one/:id/poi holt gezielt die POI-Daten
@johannschopplich
johannschopplich / index.ts
Created January 3, 2025 06:57
TypeScript Cheat Sheet
// 📜 TypeScript Cheat Sheet: Types and Their Usage
// 🛠️ **Primitive Type**
// Used mostly for documentation.
type SanitizedInput = string; // Example primitive type.
type MissingNo = 404; // Custom primitive type.
// 🏠 **Object Literal Type**
type Location = {
x: number;
@johannschopplich
johannschopplich / cache_expiration.conf
Created November 23, 2024 21:20
Ploi.io nginx Configuration Extensions for Kirby CMS
# ----------------------------------------------------------------------
# | Cache expiration |
# ----------------------------------------------------------------------
# Serve resources with a far-future expiration date.
#
# (!) If you don't control versioning with filename-based cache busting, you
# should consider lowering the cache times to something like one week.
#
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
@johannschopplich
johannschopplich / prompts.ts
Last active November 23, 2024 21:48
bolt.new System Prompt
// https://github.com/stackblitz/bolt.new/blob/main/app/lib/.server/llm/prompts.ts
import { MODIFICATIONS_TAG_NAME, WORK_DIR } from '~/utils/constants';
import { allowedHTMLElements } from '~/utils/markdown';
import { stripIndents } from '~/utils/stripIndent';
export const getSystemPrompt = (cwd: string = WORK_DIR) => `
You are Bolt, an expert AI assistant and exceptional senior software developer with vast knowledge across multiple programming languages, frameworks, and best practices.
<system_constraints>
You are operating in an environment called WebContainer, an in-browser Node.js runtime that emulates a Linux system to some degree. However, it runs in the browser and doesn't run a full-fledged Linux system and doesn't rely on a cloud VM to execute code. All code is executed in the browser. It does come with a shell that emulates zsh. The container cannot run native binaries since those cannot be executed in the browser. That means it can only execute code that is native to a browser including JS, Web
@johannschopplich
johannschopplich / proxy.ts
Created August 30, 2024 08:19
unenv `createMock`, but optimized
const fn = function () {}
function createMock(name: string, overrides: Record<any, any> = {}): any {
fn.prototype.name = name
const props: Record<any, any> = {}
return new Proxy(fn, {
get(_target, prop) {
if (prop === 'caller') {
return null
}
@johannschopplich
johannschopplich / blueprint.yaml
Created April 19, 2024 05:43 — forked from lukaskleinschmidt/blueprint.yaml
Kirby 4 query pages from a searchengine for the pages field
fields:
articles:
type: pages
query: kirby.collection('articles')
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Patrick Marsceill, software designer</title>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="/favicon-32x32.png"
@johannschopplich
johannschopplich / storage.ts
Created October 30, 2023 11:05
Capacitor Preferences binding for VueUse `useStorageAsync`
import { Preferences } from "@capacitor/preferences";
import type {
MaybeRefOrGetter,
RemovableRef,
StorageLikeAsync,
UseStorageAsyncOptions,
} from "@vueuse/core";
const capacitorPreferenceStorage: StorageLikeAsync = {
async getItem(key: string): Promise<string | null> {
@johannschopplich
johannschopplich / better-scroller.client.ts
Created June 7, 2023 17:19
Nuxt plugin for `vue-router-better-scroller` with with Suspense route resolution
import { createRouterScroller } from 'vue-router-better-scroller'
interface ScrollPositionCoordinates {
behavior?: ScrollOptions['behavior']
left?: number
top?: number
}
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.vueApp.use(