Skip to content

Instantly share code, notes, and snippets.

View ReDetection's full-sized avatar
🛰️
Converting ideas into fun

Serg ReDetection

🛰️
Converting ideas into fun
View GitHub Profile
@iamcam
iamcam / BuildPhase1.sh
Last active August 29, 2015 14:18
Automate iOS + WatchKit extension build numbers w/ Git
if [ ${CONFIGURATION} == "AppStore" ]; then
buildNumber=$(git rev-list HEAD | wc -l | tr -d ' ')
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/AppName/AppName-Info.plist"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/AppName WatchKit App/Info.plist"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/AppName WatchKit Extension/Info.plist"
fi;
if [ ${CONFIGURATION} == "Release" ]; then
buildNumber=$(git rev-list HEAD | wc -l | tr -d ' ')
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/AppName/AppName-Info.plist"
@adamvduke
adamvduke / main.m
Created June 23, 2011 15:53
Testing dispatch_queue_create to see if it returns a unique queue for a given name
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
dispatch_queue_t queue1 = dispatch_queue_create("a_test_queue", NULL);
dispatch_queue_t queue2 = dispatch_queue_create("a_test_queue", NULL);
dispatch_async(queue1, ^{
@74monkeys
74monkeys / AdHocManifestTemplate.plist
Created September 25, 2014 19:37
Manifest Template for OTA iOS Ad Hoc Distribution
<?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>items</key>
<array>
<dict>
<key>assets</key>
<array>
<dict>
@AppLamp-API
AppLamp-API / commands.js
Last active March 1, 2018 19:53
API Byte commands for AppLamp.nl / Wifiledlamp.com Mi Light RGB / RGBW / Dual White Wifi LED bulbs and controllers
/**
Filename: commands.js
AppLamp.nl led light API: wifi box byte commands
© AppLamp.nl: you can share,modify and use this code (commercially) as long as you
keep the referer "AppLamp.nl led light API" in the file header.
RESPECT AT LEAST 50 MS BETWEEN EACH SEND COMMAND TO PREVENT PACKAGE LOSS
The functions in this file will return the appropriate hex commands as 3 byte array
to send to an UDP-socket towards WIFI BOX-IP:8899 (see wifibox.js)
@iwasrobbed
iwasrobbed / gist:5528897
Last active June 5, 2020 20:34
UICollectionView w/ NSFetchedResultsController & NSBlockOperation. Idea originated from Blake Watters (https://github.com/AshFurrow/UICollectionView-NSFetchedResultsController/issues/13)
- (void)controllerWillChangeContent:(NSFetchedResultsController *)controller
{
self.shouldReloadCollectionView = NO;
self.blockOperation = [[NSBlockOperation alloc] init];
}
- (void)controller:(NSFetchedResultsController *)controller didChangeSection:(id<NSFetchedResultsSectionInfo>)sectionInfo
atIndex:(NSUInteger)sectionIndex forChangeType:(NSFetchedResultsChangeType)type
{
__weak UICollectionView *collectionView = self.collectionView;
@kabturek
kabturek / pins_arduino.c
Created July 14, 2011 10:37
Arduino port mapping with additional pins PB6 & PB7
const uint8_t PROGMEM digital_pin_to_port_PGM[] = {
PD, /* 0 */
PD,
PD,
PD,
PD,
PD,
PD,
PD,
PB, /* 8 */
@fichek
fichek / iPhone X Simulator Screenshots.md
Last active March 3, 2021 00:09
iPhone X Simulator Screenshots

Now that you can finally™ submit iPhone X screenshots of your apps to iTunes Connect, here's an easy Terminal command to take a proper screenshot:

xcrun simctl io booted screenshot "~/Desktop/Simulator Screen Shot - iPhone X - $(date +'%Y-%m-%d at %H.%M.%S').png"

This will use Xcode's built-in Simulator command line utility to save a full-frame screenshot of the iPhone X simulator (assuming it's the only one running), without cutting of the notch and rounded corners like cmd+s does. Name is formatted the same as cmd+s would do it and it's also saved to desktop.

Important thing to note: if Debug -> Optimize Rendering for Window Scale is on, screenshot might be saved at wrong resolution, so either turn that off or make sure it's at 100% scale before taking the screenshot (not "Actual Size", but 100%).

@CraigSiemens
CraigSiemens / iflet.m
Last active May 2, 2021 02:09 — forked from jspahrsummers/iflet.m
if-let and guard macros for Objective C
#import <Foundation/Foundation.h>
// VARIABLE must be a variable declaration (NSString *foo)
// VALUE is what you are checking is not nil
// WHERE is an additional BOOL condition
#define iflet(VARIABLE, VALUE) \
ifletwhere(VARIABLE, VALUE, YES)
#define ifletwhere(VARIABLE, VALUE, WHERE) \

Useful resources that were used to build the memory graph application. This is also a set of interesting materials which are related to memory understanding.

Source code

  1. The Memory Graph Project builds the memory graph of the application
  2. Python implementation of searching object's references and other interesting features via (lldb) script import lldb.macosx.heap
  3. C++ implementation of searching object's references
  4. FLEX set of in-app debugging and exploration tools for iOS development

Materials and media

  1. WWDC 2018 session iOS Memory Deep Dive
@sixman9
sixman9 / CMakeLists.txt
Created December 14, 2010 10:42
cmake files for Apple IOS development (has C++ lean, can be adapted however)
# See original post at http://stackoverflow.com/questions/822404/how-to-set-up-cmake-to-build-an-app-for-the-iphone
cmake_minimum_required(VERSION 2.8)
cmake_policy(SET CMP0015 NEW)
cmake_policy(SET CMP0016 NEW)
project(test)
set(NAME test)