Skip to content

Instantly share code, notes, and snippets.

@cemolcay
cemolcay / ABLLinkManager.swift
Last active December 2, 2018 21:42
Swift 4.0 port for LinkKit iOS of Ableton Link
//
// ABLLinkManager.swift
//
// Created by Cem Olcay on 5.03.2018.
// Copyright © 2018 cemolcay. All rights reserved.
//
import Foundation
import AVFoundation
@beccadax
beccadax / ControllerShakeRecognizer.swift
Created October 15, 2015 19:07
Notes when a tvOS controller is shaken. Unfortunately, it requires a fair bit of force...
import Foundation
import GameController
private let epsilonMotion = 1.0
private func near(a: Double, _ b: Double) -> Bool {
return abs(a - b) < epsilonMotion
}
private let minimumNotableAcceleration = 1.0
@joshhudnall
joshhudnall / UIAlertViewCrashFix.h
Created April 28, 2015 23:13
A potential fix to a new crash in iOS 8.3 where UIAlertViews will crash because they expect a different auto rotation behavior than what they are getting.
//
// UIAlertViewCrashFix.h
//
// Created by Josh Hudnall on 4/28/15.
//
//
#import <Foundation/Foundation.h>
@interface UIAlertController (CrashFix)
@cabeca
cabeca / simulator_populator
Created September 23, 2014 21:30
This script removes and recreates all simulators in Xcode 6.
#!/usr/bin/env ruby
device_types_output = `xcrun simctl list devicetypes`
device_types = device_types_output.scan /(.*) \((.*)\)/
runtimes_output = `xcrun simctl list runtimes`
runtimes = runtimes_output.scan /(.*) \(.*\) \((com.apple[^)]+)\)$/
devices_output = `xcrun simctl list devices`
devices = devices_output.scan /\s\s\s\s(.*) \(([^)]+)\) (.*)/
@TimMedcalf
TimMedcalf / tableViewKeyboardHandling.m
Last active May 6, 2024 14:21
The easy & reliable way of handling UITableView insets when the keyboard is shown. This works unchanged no matter where the table view is on the screen (including dealing with orientation, hierarchy, container view controllers & all devices)
/*
One of the first things someone new to iOS Development finds is that dealing with the keyboard is trickier
than they think it should be. Simply changing the scrolling extents of a UITableView (or UIScrollView, or
UICollectionView) that is partially covered by they keyboard reveals a lot about the internals of how iOS
works and highlights various "gotchas" that need to be considered.
There are various ways to know that a keyboard has been shown - but observing some specific notifications
provides a reliable way to allow you to modify your views to deal with it.
#!/bin/sh
info_plist="${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
spot_environment=$(echo "$GCC_PREPROCESSOR_DEFINITIONS" | sed -n 's/^.*ENVIRONMENT=\(.\)/\1/p')
facebook_url="fb0000000000${spot_environment}"
current_facebook_url=$(/usr/libexec/PlistBuddy -c "Print CFBundleURLTypes:0:CFBundleURLSchemes:0" "$info_plist")
@FlorianMielke
FlorianMielke / FMInfoPanelViewController.h
Created December 6, 2011 06:58
Info Panel attached to a UIScrollViewIndicator like in the Path 2 app. More information: http://cl.ly/CN2p
//
// FMInfoPanelViewController.h
// Created by Florian Mielke (@FlorianMielke) on 06.12.11.
//
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <QuartzCore/QuartzCore.h>
@interface FMInfoPanelViewController : UIViewController <UIScrollViewDelegate>
@zz85
zz85 / werckmeister.js
Created November 29, 2011 20:19
midi number to frequency using Werckmeister I (III) temperament
// by https://github.com/zz85
// http://en.wikipedia.org/wiki/Werckmeister_temperament
// Werckmeister I (III): "correct temperament" based on 1/4 comma divisions
var werckmeister = [
1, // c
256/243, // c#
64 / 81 * Math.pow(2, 1/2), // d
32/27, // d#
@darkseed
darkseed / Reachability.h
Created August 30, 2011 23:16 — forked from dhoerl/Reachability.h
Reachability (iOS) ARCified
/*
File: Reachability.h
Abstract: Basic demonstration of how to use the SystemConfiguration Reachablity APIs.
Version: 2.2 - ARCified
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc.
("Apple") in consideration of your agreement to the following terms, and your
use, installation, modification or redistribution of this Apple software