Skip to content

Instantly share code, notes, and snippets.

{
"1002": {
"message": "Unterminated string literal.",
"category": "Error",
"code": 1002
},
"1003": {
"message": "Identifier expected.",
"category": "Error",
"code": 1003
@jordiup
jordiup / .zshrc
Created February 1, 2026 23:08
port kill ~/.zshrc script
pk() {
if [ -z "$1" ]; then
echo -e "💀 \033[31mSelect ports to kill:\033[0m"
echo " 1) 3000"
echo " 2) 3001"
echo " 3) both"
read -r "choice?> "
local ports=()
case "$choice" in
1) ports=(3000) ;;
@jordiup
jordiup / medicare-number-validation.ts
Last active January 12, 2026 23:18
Medicare Number Validation - Typescript
/**
* Australian Medicare Number Validation
*
* Validates an 11-digit Medicare card number using the official checksum algorithm.
*
* Structure (11 digits total):
* - Identifier: 8 digits (first digit must be 2-6, indicates state/territory)
* - Checksum: 1 digit (weighted sum mod 10)
* - Issue Number: 1 digit (card reissue count)
* - IRN: 1 digit (Individual Reference Number)
SELECT
EXTRACT(MONTH FROM s."shiftStart")::int AS month,
/* ---------- average hourly rate ---------- */
ROUND(AVG(
CASE
WHEN s."positionParentCategory" = 'Consultant' THEN
CASE
WHEN s."isDayRate" THEN s.cost / NULLIF(s.hours, 0)
WHEN s."isHourlyRate" THEN s.rate
@jordiup
jordiup / zod-postgres-connection.ts
Created August 29, 2024 14:45
Zod Postgres Connection Schema
import { z } from 'zod';
const connectionSchema = z.object({
user: z.string(),
password: z.string(),
host: z.string(),
database: z.string(),
port: z.number().int().positive().default(5432),
ssl: z.boolean().default(true),
pooling: z.boolean().default(true),
@jordiup
jordiup / use-multiple-gh-accounts-in-desktop.md
Last active June 22, 2025 19:25 — forked from TheGardenMan/use-multiple-gh-accounts-in-desktop.md
How to use multiple GitHub accounts in GitHub Desktop

How to use multiple GitHub accounts in GitHub Desktop

Background

Let's say you have two users and repos likejordiup/repo1 and not_jordiup/repo2.

You want to push and pull from them using different accounts.

Solution

@jordiup
jordiup / getLastModifiedGitDate.ts
Last active October 25, 2023 04:53
useful for fetching a last modified value from a blog post
function getLastModifiedGitDate(filePath: string): Date {
filePath = 'README.md';
const query = `
{
repository(owner: "jordiup", name: "sharehouse") {
ref(qualifiedName: "refs/heads/main") {
target {
... on Commit {
history(first: 1, path: "${filePath}") {
edges {
{
"activities": [
{
"actor": {
"email": "josh@commonfate.io",
"familyName": "Wilkes",
"givenName": "Josh",
"id": "usr_2SPP3b2dtynEPF9RMJESySftFJu"
},
"allowed": true,
@jordiup
jordiup / CustomAvatar.tsx
Created May 27, 2023 02:49
# Nativebase Avatar with Coloured Text (Chakra UI Equivalent)
import React from 'react';
import ColorHash from 'color-hash';
import { Circle, ICircleProps, Image, Text } from 'native-base';
type Props = {
firstName: string;
lastName?: string;
name?: string;
size?: string;
src?: string;
{
"targets": [
{
"id": "1a3a6e75-fc32-4f36-8d7c-9fe2f7c0a2a1",
"targetGroupId": "group-1",
"targetGroupFrom": {
"publisher": "common-fate",
"name": "aws",
"version": "v1.0.0",
"kind": "string"