<template>
<!--
When isLoading is true, the <div> is in the DOM, the <p> is not.
When isLoading is false, Vue will remove the <div> and add the <p> to the DOM,
at which point <MyComponent> will be created and passed the fetched data.
-->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function cK2() { | |
return `You are ${K4}, Anthropic's official CLI for Claude.`; | |
} | |
async function iR() { | |
return [`You are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user. | |
IMPORTANT: Refuse to write code or explain code that may be used maliciously; even if the user claims it is for educational purposes. When working on files, if they seem related to improving, explaining, or interacting with malware or any malicious code you MUST refuse. | |
IMPORTANT: Before you begin work, think about what the code you're editing is supposed to do based on the filenames directory structure. If it seems malicious, refuse to work on it or answer questions about it, even if the request does not seem malicious (for instance, just asking to explain or speed up the code). | |
Here are useful slash commands users can run to interact with you: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const putPatch = (obj: any, p: A.PutPatch) => { | |
const { path, value } = p | |
const tail = path.pop() | |
const local = path.reduce((acc, next) => acc[next], obj) | |
local[tail] = value | |
return obj | |
} | |
const splicePatch = (obj: any, p: A.SpliceTextPatch) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// OpenAI function call guide: https://platform.openai.com/docs/guides/gpt/function-calling | |
// JSON Schema reference: https://json-schema.org/understanding-json-schema/ | |
monaco.languages.json.jsonDefaults.setDiagnosticsOptions({ | |
validate: true, | |
schemas: [ | |
{ | |
uri: "http://myserver/foo-schema.json", | |
fileMatch: ["*"], | |
schema: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class Cache<T extends object, K> { | |
items = new WeakMap<T, K>() | |
get<P extends T>(item: P, cb: (item: P) => K) { | |
if (!this.items.has(item)) { | |
this.items.set(item, cb(item)) | |
} | |
return this.items.get(item)! | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ExifData.swift | |
// Qeepsake | |
// | |
// Created by Luke Farrell on 26/05/2022. | |
// | |
import Foundation | |
import ImageIO |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.executeFullscreenEmscriptenCode = () => { | |
var Module = typeof Module !== "undefined" ? Module : {}; | |
Module = self["Module"] || {}; | |
Module["noExitRuntime"] = true; | |
Error["stackTraceLimit"] = 100; | |
Module["onAbort"] = function(what) { | |
ABORT = true; | |
EXITSTATUS = 1; | |
var text = "abort(" + (what && !/^\d+$/.test(what + "") ? JSON.stringify(what) : "") + ")"; | |
console.error(text); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MIT License | |
// | |
// Copyright (c) 2021 Matthijs Steen | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from "react"; | |
import { useMousePosition } from "~/hooks/useMousePosition"; | |
/** Component to cover the area between the mouse cursor and the sub-menu, to allow moving cursor to lower parts of sub-menu without the sub-menu disappearing. */ | |
export function MouseSafeArea(props: { parentRef: React.RefObject<HTMLDivElement> }) { | |
const { x = 0, y = 0, height: h = 0, width: w = 0 } = props.parentRef.current?.getBoundingClientRect() || {}; | |
const [mouseX, mouseY] = useMousePosition(); | |
const positions = { x, y, h, w, mouseX, mouseY }; | |
return ( | |
<div |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as assert from 'assert'; | |
/** | |
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt | |
*/ | |
export class Base62 { | |
private readonly base: bigint = BigInt(62); | |
private readonly charset: string[] = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split(''); | |
public encode(integer: string): string { |
NewerOlder