Skip to content

Instantly share code, notes, and snippets.

JLarky /
Last active April 26, 2024 02:43
Ultimate example of react context hook with nice type-safe (TypeScript) wrappers and reduced boilerplate by using `ReturnType`
JLarky /
Last active March 18, 2024 04:44
Turn string to number

Get this script

Download the file

curl -o ./str2num.js

Make it executable

/*/.this-doesnt-exist 2>/dev/null
## Please do not edit this part of the script, this is a loader created by "npx bun-self"
if ! [ -x "$(command -v bun)" ]; then
## it's possible that bun is installed but not in the PATH, let's check if BUN_INSTALL is set
if [ -z "$BUN_INSTALL" ]; then
export BUN_INSTALL="$HOME/.bun"
export PATH="$BUN_INSTALL/bin:$PATH"
JLarky /
Created August 1, 2022 17:29
Ultimate example of solidjs context hook with nice type-safe (TypeScript) wrappers and reduced boilerplate by using `ReturnType`
JLarky / .prettierrc.js
Last active February 13, 2024 12:18
Use prettier formatting with Astro (pnpm)
* @type {import('prettier').Options}
module.exports = {
plugins: [require.resolve('prettier-plugin-astro')],
overrides: [
files: '**/*.astro',
options: { parser: 'astro' }
JLarky / builder.html
Created February 10, 2024 08:02
Builder client side A/B testing without flicker
class="builder-component builder-component-b86c37dbf5a74f00b1140749e979b128_e3b7b83ba76d4b1b859cda06103cf240"
data-source="Rendered by"
JLarky /
Last active February 7, 2024 06:42
Google Auto Decline calendar events
// @ts-check
function runOnSchedule() {
function declineEventsForDate() {
var calendar = CalendarApp.getDefaultCalendar(); // Gets your default calendar
var now = new Date();
var sevenDaysFromNow = new Date(now.getTime() + 7 * 24 * 60 * 60 * 1000);
JLarky /
Created January 26, 2024 08:46
Have you ever tried running TypeScript with Bash before?
curl > script.ts
bash script.ts
JLarky /
Last active January 22, 2024 08:11
Remix environment variables

This is a small home grown version of t3-env but with much smaller set of features and example is written using Remix (v1) and Valibot

Big limitations compared to t3-env is that it doesn't enforce client prefix

Also there are some random bits like importing .server files from client, that will probably require you to use vite-env-only, I will try to update this gist once I migrate to Vite :)

JLarky /
Last active January 22, 2024 08:06
Remix environment variables (tiny)