Skip to content

Instantly share code, notes, and snippets.

@kenji21
kenji21 / xcode-previous-older-sdks.md
Last active May 8, 2024 11:37
Use previous/older SDKs with Xcode
@kenji21
kenji21 / openssl-build.h
Created July 1, 2016 07:09 — forked from steipete/openssl-build.h
Updated script that builds OpenSSL with Bitcode enabled (tested with Xcode 7.0b3)
#!/bin/bash
# This script downlaods and builds the iOS and Mac openSSL libraries with Bitcode enabled
# Credits:
# https://github.com/st3fan/ios-openssl
# https://github.com/x2on/OpenSSL-for-iPhone/blob/master/build-libssl.sh
# Peter Steinberger, PSPDFKit GmbH, @steipete.
set -e
@kenji21
kenji21 / Breakpoints_v2.xcbkptlist
Created October 17, 2015 08:28 — forked from Ashton-W/Breakpoints_v2.xcbkptlist
My User Breakpoints_v2.xcbkptlist
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "2"
version = "2.0">
<Breakpoints>
<!-- All Exceptions -->
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
<BreakpointContent
@kenji21
kenji21 / lmutracker.mm
Created October 11, 2015 11:45 — forked from kenkeiter/lmutracker.mm
Read lux measurement using MBP ambient light sensor.
// lmutracker.mm -- Provides lux measurement using MacBook Ambient Light Sensor
//
// clang -o lmutracker lmutracker.mm -framework IOKit -framework CoreFoundation
//
// Adaptation of code originally posted at https://bugzilla.mozilla.org/show_bug.cgi?id=793728
// by Reuben Morais. Modified by Ken Keiter <ken@kenkeiter.com> to output a single *lux* value
// and exit, rather than repeating measurements on the sensor's arbitrary scale.
#include <mach/mach.h>
#include <math.h>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.xcode_ramdisk.agent</string>
<key>ProgramArguments</key>
<array>
<string>xcode_ramdisk.sh</string>
<string>start</string>
Now and then I need to manually symbolicate an Xcode crash report. Xcode can often do this, but not always. Here are steps that are specifically for a Watch Extension, but can be easily applied to just about anything.
You need the Watch Extension's dSYM from the archive created when you submitted the app. The general form:
$ symbolicatecrash report.crash app.dSYM
or more specifically, for a WatchKit Extension:
$ export DEVELOPER_DIR=`xcode-select --print-path`
$ /Applications/Xcode.app/Contents/SharedFrameworks/DTDeviceKitBase.framework/Versions/A/Resources/symbolicatecrash ~/Desktop/CrashLog1.crash ~/Desktop/yourApp.xcarchive/dSYMs/yourApp\ WatchKit\ Extension.appex.dSYM > ~/Desktop/CrashLog1Symbolicated.crash
#import path
export PATH=${PATH}:/usr/local/bin
#import what we have in bash_profile
source ~/.bash_profile
#check for oclint
hash oclint &> /dev/null
if [ $? -eq 1 ]; then
echo >&2 "oclint not found, analyzing stopped"
exit 1
fi
#!/usr/bin/env ruby -w
class String
def starts_with?(prefix)
prefix.respond_to?(:to_str) && self[0, prefix.length] == prefix
end
end
HEADER_REGEX = /^#import\s+["<](.*)[">]/
//
// DynamicMethodTest.m
// OCMockito
//
// Created by Richard Bergoin on 20/03/14.
// Copyright (c) 2014 Jonathan M. Reid. All rights reserved.
//
#define MOCKITO_SHORTHAND
#import "OCMockito.h"
// http://www.olark.com/spw/2011/08/you-can-list-a-directory-with-8-million-files-but-not-with-ls/
#define _GNU_SOURCE
#include <dirent.h> /* Defines DT_* constants */
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/syscall.h>