This file contains 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
// Is there a better way to do this?: | |
static int someIntegerValue = | |
#ifdef SOME_MACRO | |
4 | |
#else | |
2 | |
#endif | |
; | |
// Or even this?: |
This file contains 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
#define UIViewAutoresizingFlexibleDimensions (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight) | |
#define UIViewAutoresizingFlexibleMargins (UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin) |
This file contains 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 <stdio.h> | |
#define MAIN int main(int argc, const char * argv[]) { printf("Hello, World!\n"); return 0; } | |
MAIN |
This file contains 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 <stdio.h> | |
#include <stdlib.h> | |
#define main main(){ return EXIT_SUCCESS; } int nope | |
int main() | |
{ | |
printf("Hello, World!\n"); | |
return EXIT_SUCCESS; | |
} |
This file contains 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 <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#define main main() { printf("Loading program..."); unsigned int i=1; while (1) { sleep(i++); printf("."); fflush(stdout); } } int nope | |
int main() | |
{ | |
printf("Hello, World!\n"); | |
return EXIT_SUCCESS; |
This file contains 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
CGFloat red = 0.08f; | |
CGFloat green = 0.49f; | |
CGFloat blue = 0.98f; | |
CGFloat hue = 0.59f; | |
CGFloat saturation = 0.92f; | |
CGFloat brightness = 0.98f; | |
CGFloat alpha = 1.0f; |
This file contains 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
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:[[UIImage imageNamed:@"IMG"] resizableImageWithCapInsets:UIEdgeInsetsMake(4, 4, 4, 4)] | |
forState:UIControlStateNormal | |
barMetrics:UIBarMetricsDefault]; | |
[[UIBarButtonItem appearance] setTitleTextAttributes:@{NSFontAttributeName: [UIFont fontWithName:@"Courier" size:16], | |
NSForegroundColorAttributeName: [UIColor redColor]} | |
forState:UIControlStateNormal]; |
This file contains 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
var total : Int | |
let myString = "foo" | |
// When originally looking at Swift's switch statements, you may think this is how you get fall through behaviour: | |
total = 0 | |
switch myString { | |
case "foo": | |
total += 4 | |
case "foo", "bar": | |
total += 2 |
This file contains 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
// In Objective-C, a relatively long method call could be easily wrapped on multiple lines: | |
[attributedString addAttribute:NSParagraphStyleAttributeName | |
value:paragraphStyle | |
range:NSMakeRange(0, attributedString.length)]; | |
// But how do you do that in Swift? | |
attributedString.addAttribute(NSParagraphStyleAttributeName, value: paragraphStyle, range: NSRange(location: 0, length: attributedString.length)) |
This file contains 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
defaults read <domain> | grep -o --regexp="\"NSWindow Frame [^\"]*\"" | xargs -L1 defaults delete <domain> |
OlderNewer