Skip to content

Instantly share code, notes, and snippets.

View monkeydom's full-sized avatar

Dominik Wagner monkeydom

View GitHub Profile
@monkeydom
monkeydom / MacPro
Created October 29, 2013 18:36
Mac Pro Apple Copy
It's the computer we were insane to build.
The one that turns conventional thinking on its head, then kicks the living $#&% out of it.
We challenged all our assumptions.
Abandoned our preconceptions.
And Blew away limitation after limitation.
This is the new Mac Pro.
It's like no Mac we've created before.
And we can't wait to see what you create with it.
@monkeydom
monkeydom / SingletonMacro.h
Last active December 24, 2015 17:19
New try on Singleton non-redundancy
/** usage example
@implementation ABCPlayerManager
+ (instancetype)sharedPlayerManager {
return TCM_SINGLETON(ABCPlayerManager);
}
@end
*/
#define TCM_SINGLETON(THECLASS) ({ \
static THECLASS *s_sharedInstance = nil; \
@monkeydom
monkeydom / MIN_MAX_NEW.m
Last active December 24, 2015 17:19
MIN and MAX definitions starting with iOS 7
#if __clang__
#define __NSX_PASTE__(A,B) A##B
#if !defined(MIN)
#define __NSMIN_IMPL__(A,B,L) ({ __typeof__(A) __NSX_PASTE__(__a,L) = (A); __typeof__(B) __NSX_PASTE__(__b,L) = (B); (__NSX_PASTE__(__a,L) < __NSX_PASTE__(__b,L)) ? __NSX_PASTE__(__a,L) : __NSX_PASTE__(__b,L); })
#define MIN(A,B) __NSMIN_IMPL__(A,B,__COUNTER__)
#endif
#if !defined(MAX)
while true; do curl -sS http://store.apple.com/de/iphone | grep "back soon" || (terminal-notifier -message "buy it" -title "Good news everyone" -open http://store.apple.com/de/iphone && say buy now && sleep 3600); sleep 10; done
@monkeydom
monkeydom / EraseAndCreateBuildDisk.sh
Created March 5, 2013 11:32
A ram disk to build in to reduce tear on the SSDS
#!/bin/sh
rmdir /Volumes/BuildDisk
diskutil erasevolume HFS+ "BuildDisk" `hdiutil attach -nomount ram://4661720`
@monkeydom
monkeydom / WEBrickNow.rb
Last active October 9, 2015 02:27
Start Webrick in current directory, port 9090 - added option for bonjour annoucement so it works via back to my mac!
#!/usr/bin/env ruby
require 'webrick'
require 'optparse'
include WEBrick
options = {:Port => 9090,
:DocumentRoot => './',
:Bonjour => false}
optparser=OptionParser.new do |opts|
opts.banner = "Usage: #{File.basename(__FILE__)} [options]"
@monkeydom
monkeydom / EraseAndCreateBuildDisk.sh
Created February 8, 2012 12:19
Script to create build ramdisk on mac os x
#!/bin/sh
diskutil erasevolume HFS+ "BuildDisk" `hdiutil attach -nomount ram://9323440`
@monkeydom
monkeydom / blinkenproxy.rb
Created December 26, 2011 23:03
Ruby script to read blinkenlights protocol streams from proxies
#!/usr/bin/env ruby
# == Synopsis
# blinkenpackets listens on a port for blinkenpackets and prints out verbose descriptions for them
# == Examples
# blinkenpackets.rb -p 2323
#
# Other examples:
# blinkenpackets.rb proxy.blinkenlights.net:4244
# blinkenpackets.rb proxy.blinkenlights.net:4245
@monkeydom
monkeydom / UUIDString_Category_ARC.m
Created August 31, 2011 16:45
ARC UUIDString generation method.
+ (NSString *)UUIDString {
CFUUIDRef myUUID = CFUUIDCreate(NULL);
NSString *myUUIDString = CFBridgingRelease(CFUUIDCreateString(NULL, myUUID));
CFRelease(myUUID);
return myUUIDString;
}
@monkeydom
monkeydom / CompareMacro.h
Created August 24, 2011 10:33
Objective-C Compare Macro for your convenience
#if !defined(COMPARE)
#define COMPARE(A,B) ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? NSOrderedAscending : (__a > __b ? NSOrderedDescending : NSOrderedSame); })
#endif