Skip to content

Instantly share code, notes, and snippets.

View PatrickJS's full-sized avatar

PatrickJS PatrickJS

View GitHub Profile
@PatrickJS
PatrickJS / hosts
Created September 17, 2013 06:06 — forked from amitaibu/hosts
# /etc/ hosts
# For local developement
127.0.0.1 app.local
127.0.0.1 api.app.local
@PatrickJS
PatrickJS / zoom-bombing.php
Created April 3, 2020 17:26 — forked from nekromoff/zoom-bombing.php
Zoom bombing - identify Zoom existing meeting IDs
<?php
/*
Identify existing meetings/meeting IDs on Zoom.us call app
License: Public domain. Use for pranking only. Any other use prohibited.
https://gist.github.com/nekromoff/48ec26cbaecc31fccb202d1efa7d0657
*/
$ch = curl_init();
@PatrickJS
PatrickJS / try-catch.ts
Created February 24, 2025 18:17 — forked from t3dotgg/try-catch.ts
Theo's preferred way of handling try/catch in TypeScript
// Types for the result object with discriminated union
type Success<T> = {
data: T;
error: null;
};
type Failure<E> = {
data: null;
error: E;
};
import { component$, Slot, useSignal, useVisibleTask$ } from '@builder.io/qwik';
export const ResumeBrowser = component$(() => {
const csr = useSignal(false);
// eslint-disable-next-line qwik/no-use-visible-task
useVisibleTask$(() => {
csr.value = true;
});
return csr.value ? <Slot /> : null;
});
@PatrickJS
PatrickJS / deploy-ssh.sh
Created October 29, 2024 13:18 — forked from lambrospetrou/deploy-ssh.sh
Simple deployment on a VPS, Hetzner, EC2 with zero downtime. Uses Caddy and systemd.
#!/usr/bin/env bash
# Inspired from:
# - https://blog.wesleyac.com/posts/simple-deploy-script
# - https://gist.github.com/WesleyAC/b3aaa0292579158ad566c140415c875d
# - https://caddyserver.com/docs/running#using-the-service
set -e
# cd $(dirname $0)
@PatrickJS
PatrickJS / html-languages.txt
Created October 22, 2024 16:36 — forked from JamieMason/html-languages.txt
HTML lang attribute / ISO language code reference / Culture names
CULTURE SPEC.CULTURE ENGLISH NAME
--------------------------------------------------------------
Invariant Language (Invariant Country)
af af-ZA Afrikaans
af-ZA af-ZA Afrikaans (South Africa)
ar ar-SA Arabic
ar-AE ar-AE Arabic (U.A.E.)
ar-BH ar-BH Arabic (Bahrain)
ar-DZ ar-DZ Arabic (Algeria)
ar-EG ar-EG Arabic (Egypt)
# save this file in ~/.gitignore_global
# set this file as the global .gitignore
# > git config --global core.excludesFile ~/.gitignore_global
# verify by running
# > git config --global core.excludesfile
.DS_Store
._.DS_Store
**/.DS_Store
**/._.DS_Store
@PatrickJS
PatrickJS / variousCountryListFormats.js
Created September 23, 2024 00:28 — forked from incredimike/variousCountryListFormats.js
List of Countries in various Javascript data structures: Alphabetical country lists & Country data objects.
// Lists of countries with ISO 3166 codes, presented in various formats.
// Last Updated: July 30, 2020
// If you're using PHP, I suggest checking out:
// https://github.com/thephpleague/iso3166
// or Laravel: https://github.com/squirephp/squire
//
// JS developers can check out:
// https://www.npmjs.com/package/iso3166-2-db
//
@PatrickJS
PatrickJS / qwik.tsx
Created September 20, 2024 04:16
Basic Folder/File Recursive UI
import { component$, useStore, useSignal, useTask$ } from '@builder.io/qwik';
// Define the Node type
type Node = {
id: string;
name: string;
type: string;
tags: string[];
children?: Node[];
attributes?: Record<string, unknown>;
@PatrickJS
PatrickJS / binary _function_with_two_invocations.js
Created April 25, 2013 19:59
Write a function that takes a binary function, and makes it callable with two invocations
function applyf(binary) {
return function(x) {
return function(y) {
return binary(x, y);
};
};
}
addf = applyf(add);
addf(3)(4) //=> 7