Skip to content

Instantly share code, notes, and snippets.

View macmade's full-sized avatar
🦄
I may be slow to respond.

JD Gadina macmade

🦄
I may be slow to respond.
View GitHub Profile

Coding Guidelines for Cocoa

Tips and Techniques for Framework Developers

http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CodingGuidelines/Articles/FrameworkImpl.html#//apple_ref/doc/uid/20001286-BAJIBFHD

Object Sizes and Reserved Fields

Each Objective-C object has a size that can be determined by the total size of its own instance variables plus the instance variables of all superclasses. You cannot change the size of a class without requiring the recompilation of subclasses that also have instance variables. To maintain binary compatibility, you usually cannot change object sizes by introducing new instance variables into your classes or getting rid of unneeded ones.

@macmade
macmade / girlfriend.class.php
Created January 3, 2012 06:53
A PHP class representing a girl...
<?php
require_once( 'city.class.php' );
abstract class core_girlFriend
{
private $_mood = false;
private $_wrongMoods = array( 'busy', 'anxious', 'worried', 'working', 'sad', 'melancholic' );
private $_city = null;
@macmade
macmade / GenericViewController
Created January 24, 2012 20:44
GenericViewController
@interface GenericViewController: UIViewController
{}
@end
@implementation GenericViewController
{
- ( id )init
{
NSString * className;
@macmade
macmade / Clang - LLVM MakeFile
Created June 11, 2012 20:05
Clang - LLVM MakeFile
#-------------------------------------------------------------------------------
# Build settings
#-------------------------------------------------------------------------------
PREFIX = /usr/local/my-llvm/
#-------------------------------------------------------------------------------
# Software
#-------------------------------------------------------------------------------
@macmade
macmade / gist:4254411
Created December 10, 2012 23:44
XEOS: Buddy physical memory allocator
--------------------------------------------------------------------------------
XEOS: Buddy physical memory allocator
Total memory: 1024 MB (1073741824 B) at 0x101000000
--------------------------------------------------------------------------------
Memory zone 1 - Length: 639 KB
- Pages: 159
- Buddy 0: 159 blocks of 4 KB
- Buddy 1: 79 blocks of 8 KB
- Buddy 2: 39 blocks of 16 KB
- Buddy 3: 19 blocks of 32 KB
@macmade
macmade / generate-types.awk
Created August 1, 2013 02:32
AWK - Generate types header file
BEGIN {
RS = ""
FS = "@XEOS"
TYPE = ""
NAME = ""
DEF = ""
CONTENT = ""
GUARD = ""
}
{
@macmade
macmade / gist:6250215
Created August 16, 2013 14:03
Objective-C singleton macros
#ifdef OBJC_ARC
#define SingletonImplementation( name ) \
\
static name * __sharedInstance = nil; \
\
+ ( id )sharedInstance \
{ \
static dispatch_once_t token; \
\
@macmade
macmade / Xcode-DTDeviceKitBase-MonotonicCopy.c
Created March 7, 2017 22:27
Xcode - DTDeviceKitBase - MonotonicCopy
int __ZL34DTDKCircularBufferGetMonotonicCopyP18DTDKCircularBuffer(void * arg0) {
rbx = arg0;
rcx = *(rbx + 0x10);
if (rcx == 0x0) goto loc_3a18d;
loc_3a16b:
if (rcx >= *rbx) goto loc_3a1ae;
loc_3a170:
rax = [NSData dataWithBytes:rbx + 0x18 length:rcx];
@macmade
macmade / CocoaUberAlles.m
Last active June 29, 2017 00:16
Cocoa Uber Alles
typedef Class Klasse;
typedef BOOL Wahrheit;
typedef SEL Wahler;
typedef NSZone NSBereich;
typedef void leer;
typedef id kennung;
#define NSObjekt NSObject
#define NSBereich NSZone
@macmade
macmade / gist:92745acd97fc6e53189d83b1728d688b
Last active November 2, 2017 22:39
ISOBMFF-Dump Build
clang++ -std=c++11 -Wall -o Build/Release/Products/x86_64/ISOBMFF-Dump ISOBMFF-Dump/main.cpp Build/Release/Products/x86_64/libISOBMFF.a -I ISOBMFF/include -I Submodules/PIMPL/PIMPL/include