Skip to content

Instantly share code, notes, and snippets.

@TKLCZ
TKLCZ / brewsync
Last active May 30, 2023 19:16 — forked from jamiew/brew-sync.sh
Upgrade and sync your Homebrew installations between Macs (Intel and Silicon M1/M2) via iCloud (including casks). You only need to chmod +x and run.
#!/bin/bash
# Sync Homebrew installations between Macs via iCloud
# Working on Intel and Silicon Macs
# Target folder on iCloud
TARGET="Homebrew"
# Homebrew binary path by platform
if [[ $(uname -m) == 'arm64' ]]; then
@srfrog
srfrog / cuid.sql
Created November 27, 2019 03:49
CUIDs for PL/PgSQL
-- Collision-resistant ids optimized for horizontal scaling and performance, for PL/PgSQL.
-- Based on https://github.com/ericelliott/cuid
-- Version 1.0.0
-- Usage: SELECT cuid();
-- BEGIN CONFIG ---
-- Put a unique host ID (int) here per server instance.
-- Once set, this value should not be changed.
@philmander
philmander / nav.jsx
Last active August 1, 2020 15:49
Simple Preact Unit Testing with Jest (with shallow rendering)
import { h, Component } from 'preact';
import { Link } from 'preact-router/match';
class Nav extends Component {
constructor() {
super();
this.state.title = 'Navigation'
}
@joshuataylor
joshuataylor / app.js
Created October 23, 2017 12:31
Preact component to notify user when a change has been made, and on route change reload the page.
import { h, Component } from 'preact';
import { Router } from 'preact-router';
import Header from './header';
import Home from '../routes/home';
import Profile from '../routes/profile';
import NotifyChange from "./NotifyChange/index";
// import Home from 'async!../routes/home';
// import Profile from 'async!../routes/profile';
@cereallarceny
cereallarceny / index.js
Created October 12, 2017 20:37
Server-side rendering with create-react-app (Fiber), React Router v4, Helmet, Redux, and Thunk
// Ignore those pesky styles
require('ignore-styles');
// Set up babel to do its thing... env for the latest toys, react-app for CRA
require('babel-register')({
ignore: /\/(build|node_modules)\//,
presets: ['env', 'react-app']
});
// Now that the nonsense is over... load up the server entry point