Skip to content

Instantly share code, notes, and snippets.

@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)
@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 / ejectdisks
Last active August 6, 2023 17:00
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 / Eject disks.scpt
Last active August 6, 2023 16:32
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 / 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 / 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)
}
}
{
"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 / 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>
@pascalpp
pascalpp / myview.js
Last active November 23, 2015 02:40
using a CSS module 'scope' with less and webpack's css loader
'use strict';
var styles = require('./styles.less');
// styles => { 'scope': 'oasduf98aus9df8ja9s8d' }
// this view uses the given scope as its classname
// so buttons in my view will be gold and green
// the color of buttons outside my view will not be affected
module.exports = Marionette.LayoutView.extend({
@pascalpp
pascalpp / styles.less
Last active August 24, 2017 02:22
my styles.less for Atom
/*
* Your Stylesheet
*
* This stylesheet is loaded when Atom starts up and is reloaded automatically
* when it is changed.
*
* If you are unfamiliar with LESS, you can read more about it here:
* http://www.lesscss.org
*/