Skip to content

Instantly share code, notes, and snippets.

@stokesman
stokesman / vite.config.js
Created October 24, 2023 18:56
Rudimentary Vite config that builds with WordPress dependency extraction
import { createHash } from 'crypto'
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import {
defaultRequestToExternal,
defaultRequestToHandle
} from '@wordpress/dependency-extraction-webpack-plugin/lib/util.js'
import json2php from 'json2php'
import packageMeta from './package.json';
@bizz84
bizz84 / show_alert_dialog.dart
Last active May 1, 2025 09:10
Helper function for showing an adaptive alert dialog (Material, Cupertino)
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
/// Helper function for showing an adaptive alert dialog
/// Returns:
/// - true if the default action was selected
/// - false if the cancel action was selected
/// - null if the dialog was dismissed
Future<bool?> showAlertDialog({
@qoomon
qoomon / conventional-commits-cheatsheet.md
Last active May 1, 2025 09:04
Conventional Commits Cheatsheet

Conventional Commit Messages starline

See how a minor change to your commit message style can make a difference.

Tip

Take a look at git-conventional-commits , a CLI util to ensure these conventions, determine version and generate changelogs

Commit Message Formats

Default

@gingerBill
gingerBill / dumb_handle_map.odin
Last active May 1, 2025 09:05
Handle-based Map
package dumb_handle_map
// NOTE: ONLY TO SHOW WHAT A GENERATION IS DOING
// BUT DOES NO INSERTION WHATSOEVER
Handle_Map :: struct($T: typeid) {
entries: [dynamic]Entry(T),
}
Entry :: struct($T: typeid) {
@eashish93
eashish93 / frontend.ts
Created August 3, 2024 11:51
Parallel upload on R2 using S3 sdk with multipart (for large files)
// Define the type for upload parts
type UploadParts = {
ETag: string;
PartNumber: number;
};
// Function to create multipart upload
async function createMultipartUpload(file: File): Promise<{ uploadId: string; key: string }> {
const fileKey = `${crypto.randomUUID()}-${file.name}`;
@ArthurVerrez
ArthurVerrez / profile_memory_and_time.py
Last active May 1, 2025 08:58
A wrapper python function to easily profile memory and time without requiring any non-standard libraries.
import tracemalloc
import functools
import time
def profile_memory_and_time(func):
"""
A decorator that profiles the memory usage and execution time of a function
using tracemalloc.
It measures the memory allocated by Python during the function's execution
import 'package:meta/meta.dart';
@sealed
class Unit {
const Unit._();
}
const Unit unit = Unit._();
sealed class Result<S, F> {
@efrecon
efrecon / run.tpl
Last active May 1, 2025 08:53
`docker inspect` template to regenerate the `docker run` command that created a container
docker run \
--name {{printf "%q" .Name}} \
{{- with .HostConfig}}
{{- if .Privileged}}
--privileged \
{{- end}}
{{- if .AutoRemove}}
--rm \
{{- end}}
{{- if .Runtime}}
@Dowwie
Dowwie / prd_tod.txt
Created March 13, 2025 09:07
Product requirement document generation using LLM task oriented dialogue
This is an LLM-assisted workflow for creating a product requirement document using LLM assistance for task completion.
It keeps track of inputs for the template and works with the user to acquire them, finally generating a completed PRD
prompt when all slots are addressed.
credit: Ian Nuttall - https://gist.github.com/iannuttall/f3d425ad5610923a32397a687758ebf2
**System-Prompt for Facilitating Chat-Based PRD Creation**