Skip to content

Instantly share code, notes, and snippets.

Working on a Mac app probably.

Boy van Amstel boyvanamstel

Working on a Mac app probably.
View GitHub Profile
View NSDirectionalEdgeInsets+Helpers.swift
extension NSDirectionalEdgeInsets {
/// Returns new insets with just a value applied to the supplied edge.
/// - Parameters:
/// - edge: The edge to apply an inset to.
/// - value: The value to set the edge inset to.
init(_ edge: WritableKeyPath<Self, CGFloat>, _ value: CGFloat) {
top: edge == \.top ? value : 0.0,
boyvanamstel / organize_games
Last active Nov 23, 2018
Game organizer bash script.
View organize_games
# Organizes a directory of games into a more convenient layout:
# Games/
# - 0-9/
# - A/
# - B-D/
# - E-H/
# - I/
boyvanamstel /
Created Mar 7, 2017
MarkeyJester’s Motorola 68000 Beginner’s Tutorial Readability Update
# Download a copy of the manual, you'll need wget (brew install wget)
wget --recursive --no-clobber --page-requisites --html-extension --convert-links --restrict-file-names=windows --random-wait --domains --no-parent
boyvanamstel / views-for-bouncy-areas-of-NSScrollView.swift
Last active Aug 16, 2016
How to add views to the bouncy/elastic areas of an NSScrollView.
View views-for-bouncy-areas-of-NSScrollView.swift
// SomeViewController.swift
// Created by Boy van Amstel on 15/08/16.
// Copyright © 2016 Danger Cove. All rights reserved.
// To change the background color, simply modify .backgroundColors: [NSColor]
import Cocoa
boyvanamstel /
Last active Mar 29, 2017
Xcode archive post-action to copy zip, dSYM and DMG (using DropDMG) to desktop
VERSION=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${SOURCE_ROOT}/${INFOPLIST_FILE}")
BUILD=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${SOURCE_ROOT}/${INFOPLIST_FILE}")
# The build number gets automatically increased by a build phase
BUILD=$((BUILD - 1))
DATE=$(/bin/date +%Y%m%d%H%M%S)
mkdir "$OUTPUT_DIR"
# Zip and copy .dSYM
/usr/bin/zip -r "$OUTPUT_DIR/${TARGET_NAME}" "${TARGET_NAME}.app.dSYM"

Keybase proof

I hereby claim:

  • I am boyvanamstel on github.
  • I am boyvanamstel ( on keybase.
  • I have a public key whose fingerprint is 7194 3A0A 33CC 7063 2CDD FCFD 5069 041D 0970 CA9E

To claim this, I am signing this object:

boyvanamstel / gist:781954f59e2417a518c8
Created Aug 6, 2014
Remove '#define DEBUG 0' from Receigen's receipt.h to be able to use '#ifdef DEBUG'. Add at the bottom of Receigen's build phase script.
View gist:781954f59e2417a518c8
# Remove #define DEBUG 0
awk '!/#define DEBUG 0/' "$DERIVED_FILES_DIR"/receipt.h > "$DERIVED_FILES_DIR"/receipt.temp && mv "$DERIVED_FILES_DIR"/receipt.temp "$DERIVED_FILES_DIR"/receipt.h
boyvanamstel / CocoaPods.sublime-build
Created May 29, 2013
Select Tools -> Build System -> New Build System... from the Sublime Text 2 menu. Paste the 4 lines below in your new build script, save and select it from the menu. Press cmd + b (OS X) to automatically install the pods after you've edited your Podfile.
View CocoaPods.sublime-build
"cmd": ["pod", "install"],
"selector": "Podfile"
boyvanamstel / .zshrc
Created May 15, 2013
Add this script to your ~/.bashrc (~/.zshrc, ~/.bash_profile etc) and it'll ask you if you want to run irssi when you start a terminal, unless irssi is already running. The script automatically chooses the default after a timeout (currently 3 seconds). Pressing return or n/N will skip it.
View .zshrc
# Run irssi if it's not already running
ps cax | grep irssi > /dev/null
if ! [ $? -eq 0 ]; then
yn="y" # Set the default, if the timeout expires
echo -n "Run irssi? [yn] "
read -t 3 yn
case $yn in
[Yy]* ) irssi;;
* ) ;;
boyvanamstel / gist:4730804
Last active Dec 12, 2015
Add an active state to your Octopress menu items
View gist:4730804
# This is the Danger Cove Active Menu plugin
# Installation:
# Place this file in your plugin directory.
# Usage:
# class="{% dcactivemenu checkfor.html [/another] %}"
# Returns 'active' when the checkfor.html occurs in the page.url
You can’t perform that action at this time.