This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* CLAlert is a drop-in replacement for NSAlert | |
* | |
* A CLAlert is exactly the same as a NSAlert, except for the alert style behavior | |
* | |
* - An alert with the informational style (NSInformationalAlertStyle) will always display a "Note icon" (kAlertNoteIcon) | |
* - An alert with the warning style (NSWarningAlertStyle) will always display a "Caution icon" (kAlertCautionIcon) | |
* - An alert with the critical style (NSCriticalAlertStyle) will always display a "Stop icon" (kAlertStopIcon) | |
* | |
* Tested on Mac OS X 10.5.8, 10.6.1 and 10.11.5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Nicolas Seriot | |
# 2011-01-06 | |
# https://gist.github.com/768457 | |
""" | |
Input: path of an Objective-C project | |
Output: import dependancies Graphviz format |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <time.h> | |
+ (NSDate *)dateFromISO8601String:(NSString *)string { | |
if (!string) { | |
return nil; | |
} | |
struct tm tm; | |
time_t t; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def deBruijn(n, k): | |
''' | |
An implementation of the FKM algorithm for generating the de Bruijn | |
sequence containing all k-ary strings of length n, as described in | |
"Combinatorial Generation" by Frank Ruskey. | |
''' | |
a = [ 0 ] * (n + 1) | |
def gen(t, p): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# $ gcc --version | |
# i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3) | |
# Copyright (C) 2007 Free Software Foundation, Inc. | |
# This is free software; see the source for copying conditions. There is NO | |
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
# | |
# $ clang --version | |
# Apple clang version 1.7 (tags/Apple/clang-77) (based on LLVM 2.9svn) | |
# Target: x86_64-apple-darwin10 | |
# Thread model: posix |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
#--------- | |
# Script to change the prefix of a framework | |
#--------- | |
import os | |
import re | |
import string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Get strings descriptions for enum values for debugging. | |
Usage: | |
With enum | |
typedef enum { | |
AppleFruit = 0, | |
BlueberryFruit = 1, | |
BlackberryFruit = -1 | |
} Fruit; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Licensed under the MIT License | |
Copyright (c) 2011 Cédric Luthi | |
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 | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface UILabel (dynamicSizeMe) | |
-(float)resizeToFit; | |
-(float)expectedHeight; | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
static void unsafe_signal_handler (int signo) { | |
signal(signo, SIG_DFL); | |
/* Attempt to use ObjC to fetch the backtrace. Will trigger deadlock. */ | |
[NSThread callStackSymbols]; | |
} | |
int main(int argc, char *argv[]) { |
OlderNewer