Skip to content

Instantly share code, notes, and snippets.

View chrismiles's full-sized avatar

Chris Miles chrismiles

View GitHub Profile
@kgn
kgn / .gitconfig
Last active May 9, 2016 20:43 — forked from henrik/.bashrc
My user setup
[alias]
cl = clone --recursive
un = reset --hard
st = status -s
aa = add --all
ci = commit -m
co = checkout
cob = checkout -b
br = branch
rbr = branch -r
@tassock
tassock / FloatExtract.m
Created January 24, 2011 00:43
Attempt to
#import <Foundation/Foundation.h>
#include <AudioToolbox/AudioToolbox.h>
#define kInputFileLocation CFSTR("/Users/petermarks/Developer/CoreAudio/FloatExtract/loop.wav")
#pragma mark utility functions
static void CheckResult(OSStatus error, const char *operation)
{
if (error == noErr) return;
char errorString[20];
@boctor
boctor / BaseViewController.m
Created May 5, 2011 02:08
A base view controller class that when running on the simulator in debug mode, will auto simulate a memory warning every time the view controller's viewDidAppear is called
//
// BaseViewController.m
//
// Created by Peter Boctor on 5/4/11.
//
// Copyright (c) 2011 Peter Boctor
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
@sadatrahman
sadatrahman / SRUtilities.m
Created July 12, 2011 09:26
CoreData SQL Debugger
+ (void)installSQLiteDebugger
{
#ifdef DEBUG
[NSClassFromString(@"NSSQLCore") performSelector:@selector(setDebugDefault:) withObject:[NSNumber numberWithBool:YES]];
#endif
}
@steipete
steipete / ARCCheck.m
Created December 5, 2011 22:26
Don't be a fool and wonder why nothing is working... ADD THIS CHECK.
// ARC is compatible with iOS 4.0 upwards, but you need at least Xcode 4.2 with Clang LLVM 3.0 to compile it.
#if !defined(__clang__) || __clang_major__ < 3 || !__has_feature(objc_arc)
#error This project must be compiled with ARC (Xcode 4.2+ with LLVM 3.0 and above)
#endif
@tonyarnold
tonyarnold / gist:2010649
Created March 10, 2012 07:22
Exhaustively check if an Objective-C object is "empty"
static inline BOOL CBIsEmpty(id obj) {
return obj == nil
|| (NSNull *)obj == [NSNull null]
|| ([obj respondsToSelector:@selector(length)] && [obj length] == 0)
|| ([obj respondsToSelector:@selector(count)] && [obj count] == 0);
}
@gillibrand
gillibrand / air_hockey.py
Created August 6, 2012 05:38
An Air Hockey game for Pythonista on iPad and iPhone. Yes, I typed this all on my iPad. A little painful.
# Hockey
#
# A air hockey game for two players. First to
# seven wins.
# Most of the game is drawn with the scene
# module. Goal and winner messages are animated
# with layers.
from scene import *
from sound import *
@marcedwards
marcedwards / high-dpi-media.css
Last active November 19, 2023 12:56
A CSS media query that captures almost all high DPI aware devices.
/* ---------------------------------------------------------- */
/* */
/* A media query that captures: */
/* */
/* - Retina iOS devices */
/* - Retina Macs running Safari */
/* - High DPI Windows PCs running IE 8 and above */
/* - Low DPI Windows PCs running IE, zoomed in */
/* - Low DPI Windows PCs and Macs running Firefox, zoomed in */
/* - Android hdpi devices and above */
@krzysztofzablocki
krzysztofzablocki / gist:4396302
Last active November 24, 2021 19:17
Set symbol breakpoint on objc_msgSend then setup this debug command to log all methods called in iOS Simulator. If you want to do device debugging change esp+4 register to r0, esp+8 to r1 Found long ago somewhere on stackoverflow.
expr -- (void)printf("[%s, %s]\n",(char *) object_getClassName(*(long*)($esp+4)), (char *) *(long *)($esp+8) )
@heardrwt
heardrwt / NSBundle+RHLaunchAtLoginAdditions.m
Last active December 13, 2015 21:19
RHLaunchAtLoginAdditions
This has moved. See https://github.com/heardrwt/RHAdditions/blob/master/RHAdditions/NSBundle+RHLaunchAtLoginAdditions.m