Skip to content

Instantly share code, notes, and snippets.

import { useAuth } from "@clerk/clerk-expo";
import { useEffect, useRef, useCallback } from "react";
import EventSource from "react-native-sse";
import { useBaseChat } from "@qms/shared";
import type {
UseChatOptions,
UseChatReturn,
TextDeltaEvent,
ToolCallEvent,
ToolResultEvent,
Understand the Task: Grasp the main objective, goals, requirements, constraints, and expected output.
- Minimal Changes: If an existing prompt is provided, improve it only if it's simple. For complex prompts, enhance clarity and add missing elements without altering the original structure.
- Reasoning Before Conclusions: Encourage reasoning steps before any conclusions are reached. ATTENTION! If the user provides examples where the reasoning happens afterward, REVERSE the order! NEVER START EXAMPLES WITH CONCLUSIONS!
- Reasoning Order: Call out reasoning portions of the prompt and conclusion parts (specific fields by name). For each, determine the ORDER in which this is done, and whether it needs to be reversed.
- Conclusion, classifications, or results should ALWAYS appear last.
- Examples: Include high-quality examples if helpful, using placeholders [in brackets] for complex elements.
- What kinds of examples may need to be included, how many, and whether they are complex enough to benefit from p
@matijagrcic
matijagrcic / reinvent.md
Created September 24, 2024 22:42 — forked from henrysher/reinvent.md
link for reinvent slides
@matijagrcic
matijagrcic / chunking-regex.ts
Created August 14, 2024 20:10 — forked from hanxiao/testRegex.js
Use regex to do chunking by using all semantic cues
// Used in https://jina.ai/tokenizer (Aug. 14th version)
// Define variables for magic numbers
const MAX_HEADING_LENGTH = 6;
const MAX_HEADING_CONTENT_LENGTH = 200;
const MAX_HEADING_UNDERLINE_LENGTH = 200;
const MAX_HTML_HEADING_ATTRIBUTES_LENGTH = 100;
const MAX_LIST_ITEM_LENGTH = 200;
const MAX_NESTED_LIST_ITEMS = 5;
const MAX_LIST_INDENT_SPACES = 7;
const MAX_BLOCKQUOTE_LINE_LENGTH = 200;
@matijagrcic
matijagrcic / lists.txt
Created January 19, 2021 11:05 — forked from ScottHelme/lists.txt
My Pi-hole blocklist list.
https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts https://mirror1.malwaredomains.com/files/justdomains http://sysctl.org/cameleon/hosts https://zeustracker.abuse.ch/blocklist.php?download=domainblocklist https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt https://hosts-file.net/ad_servers.txt https://v.firebog.net/hosts/AdguardDNS.txt https://adaway.org/hosts.txt https://v.firebog.net/hosts/Easyprivacy.txt https://v.firebog.net/hosts/Prigent-Ads.txt https://zerodot1.gitlab.io/CoinBlockerLists/hosts https://s3.amazonaws.com/lists.disconnect.me/simple_malvertising.txt https://raw.githubusercontent.com/ScottHelme/revocation-endpoints/master/ocsp.txt https://raw.githubusercontent.com/ScottHelme/revocation-endpoints/master/crl.txt https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews/hosts https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/gambling/hosts https://www.malwaredomainlist.c
@matijagrcic
matijagrcic / settings.json
Created November 19, 2020 08:58 — forked from jayphelps/settings.json
Modifications on top of "Community Material Theme Palenight" Before and after: https://twitter.com/_jayphelps/status/1259321038728560642?s=20
// Modify your settings.json to add these. Customize further how you prefer.
{
"workbench.editor.highlightModifiedTabs": true,
"workbench.editor.tabCloseButton": "off",
"workbench.colorCustomizations": {
"editor.lineHighlightBackground": "#ffffff06",
"editor.foreground": "#acb3db",
"selection.background": "#89DDFF",
"progressBar.background": "#89DDFF",
"textLink.foreground": "#89DDFF",
import React, { useState, useEffect, useContext } from "react";
import { Checkout } from "shopify-storefront-api-typings";
import Client from "shopify-buy";
const SHOPIFY_CHECKOUT_STORAGE_KEY = "shopify_checkout_id";
const storefrontAccessToken = process.env.GASTBY_SHOPIFY_ACCESS_TOKEN as string;
const client = Client.buildClient({
storefrontAccessToken,
const sanityClient = require('@sanity/client');
const {
SANITY_API_TOKEN,
SANITY_PROJECT_ID,
SANITY_DATASET,
} = process.env;
const client = sanityClient({
projectId: SANITY_PROJECT_ID,
import PropTypes from 'prop-types';
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
type Defined<T> = T extends undefined ? never : T;
/**
* Get the type that represents the props with the defaultProps included.
*
* Alternatively, we could have done something like this:
@matijagrcic
matijagrcic / HeaderLogo.tsx
Created May 22, 2019 07:46 — forked from ryanditjia/HeaderLogo.tsx
Gatsby + TypeScript
// Example useStaticQuery
// this is src/components/HeaderLogo.tsx
import { graphql, Link, useStaticQuery } from 'gatsby'
import React from 'react'
import { HeaderLogoQuery } from '../types/__generated__/HeaderLogoQuery'
const query = graphql`
query HeaderLogoQuery {
contentfulCompanyMetadata {