Skip to content

Instantly share code, notes, and snippets.

View pkamb's full-sized avatar

Peter Kamb pkamb

  • Seattle
View GitHub Profile
@pkamb
pkamb / gist:e0b5bf90e45cad714588feaf14eba523
Created October 24, 2017 01:03
rdar://21376114 - Custom input method app is added to Keyboard Input selector hundreds of times.
rdar://21376114
# Custom input method app is added to Keyboard Input selector hundreds of times. [`NumberInput` sample code]
Summary:
Custom input method app is added to Input selector hundreds of times.
<bug report here>
Apple Developer Relations
June 17 2015, 12:14 PM
@pkamb
pkamb / gist:7361400
Created November 7, 2013 20:33
ngrams
e
t
a
o
i
n
s
h
r
l
@pkamb
pkamb / systemKeyboardLayout
Last active May 3, 2023 16:54
Get current Mac OS X keyboard layout.
#import <Carbon/Carbon.h>
//Example: "com.apple.keylayout.US" or "com.apple.keylayout.Dvorak"
+ (NSString *)systemKeyboardLayout
{
TISInputSourceRef source = TISCopyCurrentKeyboardInputSource();
CFStringRef layoutID = TISGetInputSourceProperty(source, kTISPropertyInputSourceID);
return (NSString *)layoutID;
}
@pkamb
pkamb / gist:6085113
Created July 26, 2013 00:33
XCode 5 titanium build errors
Build settings from command line:
SDKROOT = iphoneos7.0
=== BUILD NATIVE TARGET AppModule OF PROJECT AppModule WITH CONFIGURATION Release ===
Check dependencies
CompileC build/AppModule.build/Release-iphoneos/AppModule.build/Objects-normal/armv7/ComAppModuleModule.o Classes/ComAppModuleModule.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd /Users/pkamb/Desktop/Titanium/AppModule
setenv LANG en_US.US-ASCII
@pkamb
pkamb / gist:6083957
Created July 25, 2013 21:31
Titanium mobile module build failure
Build settings from command line:
SDKROOT = iphoneos6.1
=== BUILD NATIVE TARGET AppModule OF PROJECT AppModule WITH CONFIGURATION Release ===
Check dependencies
ProcessPCH /var/folders/6d/rpk_48kx16v2cxdk_035mdr40000gn/C/com.apple.Xcode.501/SharedPrecompiledHeaders/ComAppModule_Prefix-bulwrpvsbwcevgfrxnwfmyzhewuu/ComAppModule_Prefix.pch.pth ComAppModule_Prefix.pch normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd /Users/pkamb/Desktop/Titanium/AppModule
setenv LANG en_US.US-ASCII
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin:/Users/pkamb/.rbenv/shims:/Users/pkamb/.rbenv/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/Users/pkamb/.rvm/bin"
@pkamb
pkamb / gist:5585751
Created May 15, 2013 17:33
Mac App Store code signing for a nested executable, via Apple ticket
Hello Peter,
I'm responding to your question about App Sandbox.
I checked with Mac App Review. The issue is that your login helper /LOGIN/HELPER/APP/PATH is not sandboxed. In other words, it does not have the com.apple.security.app-sandbox entitlement.
All executables are required to be sandboxed, whether they are the main app or an embedded helper.
Since your app is built from more than one target, the main app and the helper app, here's how we recommend to build this kind of project. Set the Code Signing Identity build setting at the project level to your development code signing identity (starts with "Mac Developer:") and not your distribution signing identity (starts with "3rd Party Mac Developer Application:"). Then delete the Code Signing Identity build setting from all targets by selecting the build setting and pressing the delete key to return the setting to its default value.
@pkamb
pkamb / fizzBuzzObjectiveC
Last active October 9, 2015 06:28
fizzBuzz in Objective-C
// FizzBuzz in Objective-C
// By Peter Kamb
// Seattle, WA
- (void)fizzBuzzObjectiveC {
for (int i = 1; i <= 100; i++) {
NSString *output = @"";
if (i % 3 == 0) {
output = [output stringByAppendingString:@"Fizz"];