Skip to content

Instantly share code, notes, and snippets.

On vacation

Jens Kohl jk

On vacation
View GitHub Profile
View RegexMatchingOperator.swift
// Playground - noun: a place where people can play
import Cocoa
struct Regex {
let pattern: String
let expressionOptions: NSRegularExpressionOptions
let matchingOptions: NSMatchingOptions
init(pattern: String, expressionOptions: NSRegularExpressionOptions, matchingOptions: NSMatchingOptions) {
View fix-xcode
# fix-xcode
# Rob Napier <>
# Script to link in all your old SDKs every time you upgrade Xcode
# Create a directory called /SDKs (or modify source_path).
# Under it, put all the platform directories:
# MacOSX.platform iPhoneOS.platform iPhoneSimulator.platform
# Under those, store the SDKs:
View SYCache.podspec do |s| = 'SYCache'
s.version = '1.0'
s.license = 'MIT'
s.summary = 'Fancy caching with on-disk persistence'
s.homepage = '' = { 'Sam Soffes' => '' }
s.source = { :git => '', :commit => 'origin/master' }
s.source_files = 'SYCache.{h,m}'
s.description = 'Simple in memory and on disk cache. It\'s backed by an NSCache in memory, ' \

Creating a bootable OS X Mavericks USB installer

  • First, plug in an 8GB (or bigger) USB drive, and use Disk Utility to erase it
  • If you use the default settings, you should wind up with a blank drive at /Volumes/Untitled.

With that volume in place, and with the Mavericks installer sitting in /Applications/Install\ OS\ X\, run the following command in your terminal to create a bootable install media:

sudo /Applications/Install\ OS\ X\ --volume /Volumes/Untitled --applicationpath /Applications/Install\ OS\ X\ --nointeraction
View private_api_call.m
UIDevice *device = [UIDevice currentDevice];
SEL selector = NSSelectorFromString([device.systemVersion hasPrefix:@"7"] ? @"_deviceInfoForKey:" : @"deviceInfoForKey:");
NSLog(@"DeviceColor: %@ DeviceEnclosureColor: %@", [device performSelector:selector withObject:@"DeviceColor"], [device performSelector:selector withObject:@"DeviceEnclosureColor"]);
View weak.m
- (void)main {
__weak id obj;
// Wrong:
dispatch_async(queue, ^() {
[obj doSomething];
[obj doSomethingElse]; // can turn to nil at any point, should store in strong at beggining of block
[obj doSomethingElse2];
jk / FeatureContext.php
Last active Feb 14, 2019 — forked from michalochman/gist:3175175
Take screenshots with Behat + Mink + Selenium2 Stack when a step fails. CAUTION: Work in progress
View FeatureContext.php
use Behat\Behat\Event\StepEvent;
use Behat\Gherkin\Node\StepNode,
use Behat\Mink\Driver\Selenium2Driver;
View test.rb
# based on
# Thanks, @alloy!
# To get your project ready for this, you'll have to create a scheme for your unit test project, make sure run is checked in
# the build step, and then delete the Test Host setting.
# Also, make sure you have the colored and open4 gems installed.
require 'rubygems'
require 'colored'
require 'pathname'
#! /bin/sh
# Takes a provisioning profile and installs it into the system path.
# This requires poking inside the provisioning profile and searching for the
# UUID present at the end of the file.
set -e
if [[ -z "$1" ]]
View eclipse-checkstyle-android-best-practices.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "">
This configuration file was written by the eclipse-cs plugin configuration editor
Checkstyle-Configuration: Android Best Practise
Description: none