Skip to content

Instantly share code, notes, and snippets.

View GregoryZeng's full-sized avatar

Shaohao Zeng GregoryZeng

  • University of Edinburgh
  • University of Edinburgh
View GitHub Profile
@GregoryZeng
GregoryZeng / index.html
Created May 21, 2025 10:09 — forked from lscherub/index.html
Wibbly Wobbly SVG Jelly ✨
<svg fill="none" viewBox="0 0 200 200" style="opacity: 0;">
<g>
<g filter="url(#filter0_f)">
<ellipse cx="100.5" cy="140.5" fill="#F84F8A" rx="60.5" ry="23.5" />
</g>
<path stroke="#3B0216" fill="url(#gradient)" stroke-width="2" d="M112.411 54.44l8.465 54.001C121.9 114.975 116.388 121 108.965 121h-16.93c-7.423 0-12.935-6.025-11.91-12.559l8.464-54C89.567 48.198 94.939 45 100.5 45c5.562 0 10.932 3.198 11.911 9.44z" />
<path stroke="#3B0216" fill="url(#gradient)" stroke-width="2" d="M109.788 58.444c1-6.23 6.494-9.444 12.212-9.444s11.212 3.214 12.212 9.444l8.661 54c1.044 6.508-4.576 12.556-12.211 12.556h-17.324c-7.635 0-13.255-6.048-12.211-12.556l8.661-54z" />
<path stroke="#3B0216" fill="url(#gradient)" stroke-width="2" d="M66.788 58.444C67.788 52.214 73.282 49 79 49s11.212 3.214 12.212 9.444l8.661 54C100.917 118.952 95.297 125 87.662 125H70.338c-7.635 0-13.255-6.048-12.211-12.556l8.661-54z" />
<path stroke="#3B0216" fill="url(#gradient)" stroke-width="2" d="M129 93c0 16.016-12.98
@GregoryZeng
GregoryZeng / worker.ts
Created February 23, 2025 15:38 — forked from richardscarrott/worker.ts
Cloudflare Workers / Pages `stale-while-revalidate`
import { parse } from 'cache-control-parser';
export default {
async fetch(request: Request, env: {}, ctx: ExecutionContext): Promise<Response> {
try {
const cache = await caches.default;
const cachedResponse = await cache.match(request);
if (cachedResponse) {
console.log('Cache: HIT');
if (shouldRevalidate(cachedResponse)) {
@GregoryZeng
GregoryZeng / jokes.md
Created September 21, 2024 16:54 — forked from kentcdodds/jokes.md
Headers and caching section removed from the Remix Tutorial because it was too long.

Headers and Caching

Caching is a big subject and it can get pretty complicated. Luckily, the browsers have done all the really hard work for us and we just need to #useThePlatform.

There are three types of caches you'll likely deal with in Remix applications:

  1. Application-level caches that you implement in your own code.
  2. Browser caches you can control through the Cache-Control header.
  3. CDN caches you also can control through the Cache-Control headers.