Skip to content

Instantly share code, notes, and snippets.

View boyvanamstel's full-sized avatar
👋
Hi there

Boy van Amstel boyvanamstel

👋
Hi there
View GitHub Profile
@boyvanamstel
boyvanamstel / views-for-bouncy-areas-of-NSScrollView.swift
Last active August 16, 2016 11:57
How to add views to the bouncy/elastic areas of an NSScrollView.
//
// 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
boyvanamstel / CocoaPods.sublime-build
Created May 29, 2013 14:30
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.
{
"cmd": ["pod", "install"],
"selector": "Podfile"
}
@boyvanamstel
boyvanamstel / .zshrc
Created May 15, 2013 07:18
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.
# 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;;
* ) ;;
esac
@boyvanamstel
boyvanamstel / gist:4730804
Last active December 12, 2015 06:39
Add an active state to your Octopress menu items
# 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
#
@boyvanamstel
boyvanamstel / gist:3011433
Created June 28, 2012 13:38
Automatically increase build number in Xcode4 project
# Via: http://blog.suda.pl/2012/01/auto-increment-build-number-in-xcode-4-2-fixed/
# Just add “Run Script” build phase with this script (remember to move it before
# “Copy Bundle Resources” phase) and set your CFBundleVersion to an integer.
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" ${PROJECT_DIR}/${PROJECT_NAME}/${PROJECT_NAME}-Info.plist)
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" ${PROJECT_DIR}/${PROJECT_NAME}/${PROJECT_NAME}-Info.plist
@boyvanamstel
boyvanamstel / gist:2954676
Created June 19, 2012 15:04
Firefox Extension: Add a button to the navigation toolbar
// Source: http://stackoverflow.com/questions/5572632/firefox-how-can-i-add-modify-toolbars-using-the-add-on-sdk-jetpack
// Only works on first window opened..
var data = require("self").data;
var {Cc, Ci} = require("chrome");
var mediator = Cc['@mozilla.org/appshell/window-mediator;1'].getService(Ci.nsIWindowMediator);
exports.main = function(options, callbacks) {
addToolbarButton();
// other stuff
@boyvanamstel
boyvanamstel / gist:2936138
Created June 15, 2012 12:01
Minimal HTML5 template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>title</title>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
</head>
<body>
<!-- page content -->
@boyvanamstel
boyvanamstel / gist:2932429
Created June 14, 2012 19:34
Change app language
$ /Applications/Porthole.app/Contents/MacOS/Porthole -AppleLanguages "(German)"
@boyvanamstel
boyvanamstel / gist:2919779
Created June 12, 2012 19:58
Enable/Disable 'Gatekeeper' in Mac OS X Lion for testing purposes
$ sudo spctl --master-enable
$ sudo spctl --master-disable
# Read more: http://forums.appleinsider.com/t/143736/gatekeeper-is-hidden-in-os-x-10-7-3-lion-developers-can-preview-it-now
@boyvanamstel
boyvanamstel / gist:2919615
Created June 12, 2012 19:29
Get .app certificate details
$ codesign -d -vvv [Application].app
# Or use: http://itunes.apple.com/us/app/rb-app-checker-lite/id519421117?mt=12