Skip to content

Instantly share code, notes, and snippets.

@pascalpp
pascalpp / RenderOne.md
Last active May 25, 2017 19:45
RenderOne React Component idea

I'm trying to do this:

<RenderOne {...props}>
    <ComponentOne />
    <ComponentTwo />
    <ComponentThree />
</RenderOne>
{
"short_name": "Broadly",
"name": "Broadly",
"description": "Broadly helps you engage with your customers, get better reviews, and convert more leads.",
"icons": [
{
"src": "/images/dashboard/icon-512-pwa.png",
"type": "image/png",
"sizes": "512x512"
},
@pascalpp
pascalpp / UserDefaults+NSColor.swift
Last active March 12, 2022 19:12
Swift 5 extension to add NSColor support to UserDefaults
import Cocoa
extension UserDefaults {
func set(_ color: NSColor, forKey: String) {
if let data = try? NSKeyedArchiver.archivedData(withRootObject: color, requiringSecureCoding: false) {
self.set(data, forKey: forKey)
}
}
@pascalpp
pascalpp / diacritics.js
Created November 12, 2019 13:13
Method for converting diacritics to 'plain' counterparts for string comparison
/* eslint-disable max-len */
/*
this is a modified version of the diacritics translator from here:
http://jsperf.com/diacritics/12
via http://stackoverflow.com/questions/990904/javascript-remove-accents-in-strings
2014-04-05 -p
*/
const defaultDiacriticsRemovalMap = [
@pascalpp
pascalpp / Eject disks.scpt
Last active August 28, 2024 05:20
An AppleScript to unmount all ejectable disks so I can unplug my MacBook from my dock
-- An AppleScript to unmount all ejectable disks so I can unplug my MacBook from my dock
-- map this script to a hotkey with an app like Keyboard Maestro - I use Cmd+End
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
tell application "Finder"
display notification "Please wait…" with title "Unmounting disks"
-- some of my disks are finicky so I repeat this three times
@pascalpp
pascalpp / ejectdisks
Last active August 28, 2024 05:20
ejectdisks
#!/bin/bash
#
# ejectdisks
# script to unmount all external drives on a Mac
# assumes your external volumes are all 'APFS Volume' or 'Apple_HFS'
# try `diskutil list external` to see your volumes
#
# Installation
# copy this file to /usr/local/bin or somewhere in your path and make it executable
@pascalpp
pascalpp / mountdisks
Last active August 6, 2023 17:00
mountdisks
#!/bin/bash
#
# mountdisks
# script to remount all external drives
# assumes your external volumes are all 'APFS Volume' or 'Apple_HFS'
# try `diskutil list external` to see your volumes
#
# Installation
# copy this file to /usr/local/bin or somewhere in your path and make it executable
@pascalpp
pascalpp / delete-squashed-branches.sh
Created April 5, 2024 19:23
delete-squashed-branches
#!/bin/sh
# Cribbed most of this from
# https://stackoverflow.com/questions/43489303/how-can-i-delete-all-git-branches-which-have-been-squash-and-merge-via-github
# Requirements:
# gh (https://cli.github.com/)
# Installation:
# touch ~/bin/delete-squashed-branches (or somewhere in your path)