Skip to content

Instantly share code, notes, and snippets.

View cxjwin's full-sized avatar
💭
I may be slow to respond.

SmartCai cxjwin

💭
I may be slow to respond.
View GitHub Profile
@adamawolf
adamawolf / Apple_mobile_device_types.txt
Last active June 28, 2024 08:58
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
i386 : iPhone Simulator
x86_64 : iPhone Simulator
arm64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S
@OliverLetterer
OliverLetterer / XCDUUID.m
Created January 26, 2013 17:05
With this gist, I, as a total assembly noob, am trying to understand the XCDUUID runtime hack (https://github.com/0xced/NSUUID/blob/1.0.1/NSUUID.m#L167-L221) to be able to use NSUUID on iOS < 6.0.
@implementation XCDUUID
+ (void) load
{
// query runtime if NSUUID class already exists, if so => done
if (objc_getClass("NSUUID"))
{
return;
}
@wmcbain
wmcbain / decoder.m
Last active January 23, 2018 10:30
Objective-C Base58 Decoder / Bitcoin Address Validator
#pragma mark Address validation
// C implementation - credits to Gavin Anderseen I believe
-(NSData *)decodeBase58:(const char *)addy bytes:(unsigned char *)bytes {
static const char *base58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
int i, j, c;
const char *p;
memset(bytes, 0, 25);
@Tokuriku
Tokuriku / universal-framework.sh
Last active September 2, 2020 10:59 — forked from cromandini/universal-framework.sh
Script to put in an Aggregate Target of a Framework in Xcode 6 to create a Universal Framework
#!/bin/sh
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
# make sure the output directory exists
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"
# Step 1. Build Device and Simulator versions
xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
@cmelchior
cmelchior / SerializeToJson.java
Last active September 20, 2022 04:30
Serialize Realm objects to JSON using GSON
// GSON can parse the data.
//
// Deserialization:
// Note there is a bug in GSON 2.3.1 that can cause it to StackOverflow when working with RealmObjects.
// To work around this, use the ExclusionStrategy below or downgrade to 1.7.1
// See more here: https://code.google.com/p/google-gson/issues/detail?id=440
//
// Serialization:
// <Type>RealmProxy objects are created by the Realm annotation processor. They are used to control
// access to the actual data instead of storing them in fields and it is therefore them we need to register a
@mxpr
mxpr / 0.1-export-plist.sh
Last active November 25, 2022 04:15
Export Options Plist flag in xcodebuild
# Switch xcrun to leverage Xcode 7
# Note: This won't be needed once Xcode 7 is released
# and becomes the primary Xcode in use.
export DEVELOPER_DIR=/Applications/Xcode-beta.app/Contents/Developer/
# Export Archive
xcrun xcodebuild -exportArchive -exportOptionsPlist exportPlist.plist -archivePath /path/to/app.xcarchive -exportPath /path/to/app.ipa
@squarism
squarism / iterm2.md
Last active June 27, 2024 00:50
An iTerm2 Cheatsheet

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
Cycle iTerm Windows + backtick (true of all mac apps and works with desktops/mission control)
@alanzeino
alanzeino / lldb-debugging.md
Last active May 29, 2024 03:18
LLDB debugging with examples

LLDB Debugging Cheat Sheet

Commands

LLDB Commands

LLDB comes with a great set of commands for powerful debugging.

help

Your starting point for anything. Type help to get a list of all commands, plus any user installed ones. Type 'help for more information on a command. Type help to get help for a specific option in a command too.

require 'erb'
class Context
attr_reader :properties,
:class_name,
:headers_str,
:enums_str
def initialize
@properties = []
@mattlawer
mattlawer / gist:3db21a1264afdca0314c7183143438bc
Created September 18, 2016 17:28
DirectoryMonitor - Swift 3
/*
Copyright (C) 2016 Apple Inc. All Rights Reserved.
See LICENSE.txt for this sample’s licensing information
Abstract:
`DirectoryMonitor` is used to monitor the contents of the provided directory by using a GCD dispatch source.
*/
import Foundation