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
if (isSometimesTrue) { | |
// Sometimes do something | |
} if (isAlsoSometimesTrue) { | |
// Sometimes do something else | |
} else { | |
// Only do if others fail, but is instead always executed. | |
} |
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
// This | |
self.label.snp_makeConstraints { make in | |
make.edges.equalTo(self.view) | |
} | |
// Instead of this | |
self.label.snp_makeConstraints { make in | |
make.edges.equalTo(self.view) | |
return | |
} |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>com.vendhq.ci</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/usr/bin/java</string> | |
<string>-Djava.awt.headless=true</string> |
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
// http://stackoverflow.com/questions/1560081/how-can-i-create-a-uicolor-from-a-hex-string | |
+ (UIColor *) colorWithHex:(int)hex { | |
return [UIColor colorWithRed:((float)((hex & 0xFF0000) >> 16))/255.0 | |
green:((float)((hex & 0xFF00) >> 8))/255.0 | |
blue:((float)(hex & 0xFF))/255.0 alpha:1.0]; | |
} |
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
#!/usr/bin/env python | |
# encoding: utf-8 | |
""" | |
IMDB250TallyDirectors.py | |
Created by Jin Budelmann on 2012-08-03. | |
""" | |
import sys | |
import os |
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
#!/usr/bin/env python | |
# encoding: utf-8 | |
""" | |
IMDB250TallyDirectors.py | |
Created by Jin Budelmann on 2012-08-03. | |
""" | |
import sys | |
import os |
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
@implementation MySingleton | |
+ (MySingleton*)singleton { | |
static MySingleton* __singleton = nil; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
__singleton = [[MySingleton alloc] init]; | |
}); | |
return __singleton; | |
} |
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
#import <objc/runtime.h> | |
#define ASSOCIATIVE_PROPERTY(GET_NAME, SET_NAME, TYPE, ASSOCIATION_POLICY) \ | |
static char GET_NAME##Key; \ | |
- (TYPE) GET_NAME \ | |
{ \ | |
return objc_getAssociatedObject(self, & GET_NAME##Key); \ | |
} \ | |
\ | |
- (void) SET_NAME:(TYPE)value\ |
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
int n1 = 320; | |
int n2 = 480; | |
simplifyRatio(&n1, &n2); | |
printf("%d %d", &n1, &n2); | |
int highestCommonFactor(int n1, int n2) { | |
int remainder = n1%n2; |
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
//receive loop(timeout=1000ms) | |
long long starttime = [self currentTimeMillis]; | |
while(true){ | |
//timeout check | |
long long readTimeout = SEND_RESPONSE_TIMEOUT - ([self currentTimeMillis] - starttime); | |
if(readTimeout < 0){ | |
break; | |
} | |
OlderNewer