Skip to content

Instantly share code, notes, and snippets.

Avatar
🌴
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
#!/usr/bin/python
# fix-xcode
# Rob Napier <robnapier@gmail.com>
# 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
Pod::Spec.new do |s|
s.name = 'SYCache'
s.version = '1.0'
s.license = 'MIT'
s.summary = 'Fancy caching with on-disk persistence'
s.homepage = 'https://github.com/Synthetic/SYCache'
s.author = { 'Sam Soffes' => 'sam@samsoff.es' }
s.source = { :git => 'https://github.com/Synthetic/SYCache.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, ' \
View osx-mavericks-install-media.md

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\ Mavericks.app, run the following command in your terminal to create a bootable install media:

sudo /Applications/Install\ OS\ X\ Mavericks.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled --applicationpath /Applications/Install\ OS\ X\ Mavericks.app --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
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
<?php
use Behat\Behat\Event\StepEvent;
use Behat\Gherkin\Node\StepNode,
Behat\Gherkin\Node\ScenarioNode,
Behat\Gherkin\Node\FeatureNode;
use Behat\Mink\Driver\Selenium2Driver;
/**
View test.rb
# based on https://gist.github.com/3349345
# 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'
View install_provisioning_profile.sh
#! /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" ]]
then
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" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<!--
This configuration file was written by the eclipse-cs plugin configuration editor
-->
<!--
Checkstyle-Configuration: Android Best Practise
Description: none
-->