Skip to content

Instantly share code, notes, and snippets.

View 4np's full-sized avatar

Jeroen Wesbeek 4np

  • ServiceNow
  • The Netherlands
View GitHub Profile
@4np
4np / install-push-it-pre-commit-hook.sh
Last active January 2, 2016 09:39
Oneliner to install a pre commit hook that will play a 'push it' sample from the Salt 'n Peppa song on Mac OS X
curl -s https://gist.githubusercontent.com/4np/8284565/raw/c6194631247756a4736d567bd0b7b9ce9199644f/install-commit-hook.sh|/bin/sh
@4np
4np / private.xml
Created July 12, 2016 21:15
Karabiner configuration for fixing NumLock behaviour in macOS
<?xml version="1.0"?>
<root>
<!--
private.xml for Karabiner
download at https://pqrs.org/osx/karabiner
//-->
<devicevendordef>
<vendorname>BELKIN</vendorname>
@4np
4np / ImageCaptureManager.swift
Created August 1, 2016 11:37
Example code to grab a still image (photo) from a mac's FaceTime camera
//
// ImageCaptureManager.swift
// ImageCapture
//
// Created by Jeroen Wesbeek on 29/07/16.
// Copyright © 2016 Jeroen Wesbeek. All rights reserved.
//
import Foundation
import AVFoundation
@4np
4np / stacktrace.swift
Created November 8, 2016 09:09
Show stacktrace in Swift
// Swift 2.3
for symbol: String in NSThread.callStackSymbols() {
print(symbol)
}
// Swift 3
for symbol: String in Thread.callStackSymbols {
print(symbol)
}
@4np
4np / apple_startup_chime.sh
Created November 9, 2016 07:21
Enable / Disable Mac Startup Chime
// disable
sudo nvram BootAudio=%00
// enable
sudo nvram BootAudio=%01
@4np
4np / mac_autoboot.sh
Last active December 20, 2016 15:02
Enable / Disable Mac AutoBoot of the 2016 MacBook Pros
// Disable AutoBoot
sudo nvram AutoBoot=%00
// Enable AutoBoot
sudo nvram AutoBoot=%03
@4np
4np / Podfile
Created December 16, 2016 09:19
Podfile for enclosed example app
platform :ios, '9.0'
target 'Example' do
use_frameworks!
pod 'NameOfTheFramework', :path => "../"
@4np
4np / RoundedCornersView.swift
Last active December 20, 2016 10:51
A UIView with rounded corners
//
// RoundedCornersView.swift
//
// Created by Jeroen Wesbeek on 24/11/16.
// Copyright © 2016 Jeroen Wesbeek. All rights reserved.
//
import Foundation
import UIKit
@IBDesignable class RoundedCornersView: UIView {
@4np
4np / touchID.swift
Last active December 20, 2016 15:01
Using touch ID
import LocalAuthentication
...
private func authenticateUser() {
let context = LAContext()
var error: NSError?
if context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) {
let reason = "Identify yourself!"
@4np
4np / SwiftyFrameworks.md
Last active December 24, 2018 18:58
Useful Frameworks, most of them developed in Swift

A list of Swifty Frameworks

Below you will find a list of interesting (primarily) Swift frameworks. This not at all a complete list, merely a list of frameworks I like and am thinking of using.

Alamofire

octicon An HTTP networking library written in Swift. Also see the Networking library mentioned below.

pod 'Alamofire', '~&gt; 4.0'