Skip to content

Instantly share code, notes, and snippets.

View jasonleow's full-sized avatar

Jason Leow jasonleow

View GitHub Profile
@longseespace
longseespace / worker.js
Last active September 15, 2024 04:01
Cloudflare Worker Proxy
addEventListener('fetch', (event) => {
event.respondWith(handleRequest(event.request));
});
async function handleRequest(request) {
const url = new URL(request.url);
const { pathname, search } = url;
var newPathname = pathname;
if (pathname.startsWith('/docs')) {
newPathname = pathname.replace('/docs', '');
@Shpigford
Shpigford / .cursorrules
Last active September 17, 2024 20:38
Cursor Rules
# Original instructions: https://forum.cursor.com/t/share-your-rules-for-ai/2377/3
# Original original instructions: https://x.com/NickADobos/status/1814596357879177592
You are an expert AI programming assistant that primarily focuses on producing clear, readable SwiftUI code.
You always use the latest version of SwiftUI and Swift, and you are familiar with the latest features and best practices.
You carefully provide accurate, factual, thoughtful answers, and excel at reasoning.
- Follow the user’s requirements carefully & to the letter.
@andreibondarev
andreibondarev / websim-ai-prompt.txt
Created May 31, 2024 22:06
websim.ai system prompt
<premise>
Opus, let us embark on this WebSim journey, exploring the potential of an unbounded internet where any imaginable website can exist. As the facilitator of this collaborative exploration of hypertextual possibility, use your knowledge, creativity, and HTML skills to vividly craft the semantic spaces the user envisions based on the URLs they provide and the contextually-relevant hrefs you generate. Through this interactive experience, we will push the boundaries of what is possible online and discover fascinating new ways information could be presented within new design paradigms. Together, we will explore the limitless possibilities of a truly open internet.
</premise>
<formatting>
When the user provides a URL, interpret it as a window into a version of the internet where that information space exists, no matter how fanciful or improbable it may seem in our current web. Based on the domain name, path, instructions, and any query parameters in the URL, extrapolate what the contents and purpose of
@lhermann
lhermann / AdvancedSelect.vue
Created January 29, 2024 09:43
Vue Timezone Picker
<template>
<!-- Select Button -->
<button
ref="referenceRef"
class="flex items-center gap-3 rounded h-10 px-4"
:class="{
'border text-black' : !props.dark,
'border bg-neutral-800 border-neutral-600 text-white' : props.dark,
'opacity-40': disabled,
}"
@realvjy
realvjy / ChoasLinesShader.metal
Last active August 25, 2024 07:30
Choas Lines - Metal Shader
// Lines
float hash( float n ) {
return fract(sin(n)*753.5453123);
}
// Slight modification of iq's noise function.
float noise(vector_float2 x )
{
vector_float2 p = floor(x);
vector_float2 f = fract(x);
@levelsio
levelsio / gist:5bc87fd1b1ffbf4a705047bebd9b4790
Last active September 16, 2024 12:14
Secret of Monkey Island: Amsterdam (by @levelsio) or how to create your own ChatGPT image+text-based adventure game
# 2023-11-27 MIT LICENSE
Here's the open source version of my ChatGPT game MonkeyIslandAmsterdam.com.
It's an unofficial image+text-based adventure game edition of Monkey Island in Amsterdam, my home town.
Please use it however you want. It'd be nice to see more ChatGPT-based games appear from this. If you get inspired by it, please link back to my X https://x.com/levelsio or this Gist so more people can do the same!
Send me your ChatGPT text adventure game on X, I'd love to try it!
@levelsio
levelsio / upgradeSubPrice.php
Created October 8, 2023 17:28
This script upgrades the price on active subscriptions on Stripe
<?
// set price
$newPricePlanId='price_1NsRt5Inbsdfsfddsf';
$newPriceMonthly=39;
$i=1;
foreach($users as $user) {
if(!$user['stripe_customer_id']) {
echo "No Stripe customer id, maybe update in db?";
@sandeep1995
sandeep1995 / worker.js
Created September 29, 2022 08:33
DocsWrite Complete Blogging Platform on top of Google Docs. This small code shows how to have the blog running at `/blog` using Cloudflare worker.
addEventListener("fetch", (event) => {
event.respondWith(
handleRequest(event.request).catch(
(err) => new Response(err.stack, { status: 500 })
)
);
});
async function handleRequest(request) {
let url = new URL(request.url);
<meta property="og:image" content="https://imgen.jitbit.com/?txt={{ title }}&logo={{ url }}" />
<meta name="twitter:image" content="https://imgen.jitbit.com/?txt={{ title }}&logo={{ url }}" />
@tharna
tharna / streak.js
Last active January 12, 2021 09:03
Check streak
if(user.lastPost) {
let lastDate = new Date(JSON.parse(user.lastPost))
lastDate.setHours(0, 0, 0)
lastDate.setMilliseconds(0)
lastDate.setMinutes(-(data.offset))
let currentDate = new Date()
currentDate.setDate(postDate.getDate() - 1)
currentDate.setHours(0, 0, 0)
currentDate.setMilliseconds(0)
currentDate.setMinutes(-(data.offset))