Skip to content

Instantly share code, notes, and snippets.

View justinnoel's full-sized avatar

Justin Noel justinnoel

View GitHub Profile
@johnspurlock-skymethod
johnspurlock-skymethod / export-d1-database-to-sqlite.md
Created September 11, 2024 16:44
Export a D1 database to a local sqlite3 db file

New one-liner command to download a Cloudflare D1 database to a local sqlite db file.

Prerequisites:

Install the latest Denoflare CLI (newest commit, not release-tagged yet) if not already installed

  • Install deno if not already installed
  • Then install Denoflare: deno install -A --name denoflare --force https://raw.githubusercontent.com/skymethod/denoflare/66b741c9242e724adbf030a2be26af4b58432631/cli/cli.ts

Run the new denoflare d1 export-db command

#!/bin/bash
# Check if the RUN_TYPECHECKER_PRECOMMIT_HOOK environment variable is set to "true"
if [ "$RUN_TYPECHECKER_PRECOMMIT_HOOK" = "true" ]; then
echo "Running TypeScript type checker..."
# Run the TypeScript compiler in type-checking mode and capture the output
tsc_output=$(npx tsc --noEmit 2>&1)
tsc_exit_code=$?
@mosch
mosch / repository.ts
Created April 3, 2022 08:35
Cloudflare Typed Repository with Prefixa
class RepositoryNamespace<Entity = string, Metadata = {}> {
private readonly ns: string
private readonly kv: KVNamespace
constructor(kv: KVNamespace, namespace: string) {
this.ns = namespace
this.kv = kv
}
put(key: string, entity: Entity) {
@meg-gutshall
meg-gutshall / quotes.txt
Last active May 8, 2026 14:24
A file of quotes that bring me joy and inspiration
"Reading is to the mind what exercise is to the body." —Joseph Addison
"You gotta learn how to do something wrong before you can do it right." —David Alpert
"Being nice doesn't take much time." —Marie Antons
"If you have to ask what jazz is, you'll never know." —Louis Armstrong
"In dreams and in love, there are no impossibilities." —Janos Arnay
"Forethought spares afterthought." —Amelia Barr
"Do not seek to follow in the footsteps of the men of old; seek what they sought." —Matsuo Basho
"Believe in yourself. You are braver than you think, more talented than you know, and capable of more than you imagine." —Roy T. Bennett
"Nobody likes getting up early, but everyone likes having gotten up early." —Stephen Blais
"The only wrong first step is not taking the first step." —Stephen Blais
@Princesseuh
Princesseuh / Image.astro
Last active January 30, 2022 04:13
Astro + eleventy-img
---
import Image from "@11ty/eleventy-img"
import { generateImage } from "utils.ts"
import { Markdown } from "astro/components"
const {
src,
alt,
caption,
options = {},
sizes = "",
@cryptoskillz
cryptoskillz / gist:98b8e7090b7cc8d51531bb9dcfe7654a
Created December 5, 2021 16:48
Tips on how to use a KV namespace with Cloudflare Pages
This gist aims to show you how to use KV datastore using Cloudflare pages. The reason I created this quick guide is it took
me almost 2 weeks to get it working, mainly because it is very new and the documentation is not up fully fleshed out yet
https://developers.cloudflare.com/workers/runtime-apis/kv
https://developers.cloudflare.com/pages/platform/functions
https://blog.cloudflare.com/wrangler-v2-beta/
Steps:
Install wrangler 2
@sarah11918
sarah11918 / Astro21Diff.md
Created November 21, 2021 17:35
Astro v0.21.0 - differences that aren't bugs/breaking changes

What's DIFFERENT (but not necessarily buggy/breaking) in Astro 0.21.0 ???

1. How to include a layout in .md files

Previously, front matter REQUIRED a layout property (e.g. layout: ../../layouts/MarkdownPostLayout.astro) Now, it's ALSO OK to include your layout as an import in "setup":

setup: |
  import Layout from '../../layouts/BlogPost.astro'
  import SomeOtherComponent from '../../components/SomeOtherComponent.astro'
@shrop
shrop / curl-loop.sh
Created March 31, 2017 14:12
Script to loop through a text file list of URLs and output the curl -I to a text file
#!/bin/bash
for i in $(cat urls.txt); do
content=$(curl -I -s "{$i}")
echo "URL: $i" >> output.txt
echo "$content" >> output.txt
done
@elfrank
elfrank / collaborate_on_branches.md
Last active June 25, 2025 18:48
How to work on someone else's branch

#How to work on someone else's branch

Let's assume you need to collaborate with Batman on his forked repository.

  • First, you need to add his fork as a remote.
git remote add batman git@github.com:batman/iambatman.git
  • Now, you can fetch, pull and push to his fork (if you have permissions to do so).
@madmax
madmax / gist:1474059
Created December 13, 2011 21:54
changing font in textmate 2
1. Open Bundle editor
2. Select Themes -> Themes -> your theme
3. add to settings
fontName = 'Monaco';
fontSize = '12px';
or what you want, enjoy :)