Skip to content

Instantly share code, notes, and snippets.

View justinnoel's full-sized avatar

Justin Noel justinnoel

View GitHub Profile
#!/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) {
@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 May 7, 2024 00:29
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 :)