Skip to content
View NSURLRequest+cURL
- (NSString *)description {
__block NSMutableString *displayString = [NSMutableString stringWithFormat:@"curl -v -X %@", self.HTTPMethod];
[displayString appendFormat:@" \'%@\'", self.URL.absoluteString];
[self.allHTTPHeaderFields enumerateKeysAndObjectsUsingBlock:^(id key, id val, BOOL *stop) {
[displayString appendFormat:@" -H \'%@: %@\'", key, val];
}];
View gist:330fc38b542c96fcecc6
<?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>Consumables</key>
<dict>
<key>com.steinlogic.dummyconsumable.pack10</key>
<dict>
<key>ConsumableCount</key>
<integer>10</integer>
View gist:4545a5d5b85353163faa
#!/bin/bash
function check {
status=`curl -Is http://store.apple.com/sg/ | grep "HTTP/1.1"`
echo ${status:9:3}
if [ "${status:9:3}" == "200" ]; then
while true; do
say "Its here... Its here... Its here"
echo -en "\007"
done
fi
View gist:3fcb7b5f63a309fc5b60
#!/bin/bash
function check {
status=`curl -Is http://store.apple.com/sg/ | grep "HTTP/1.1"`
echo ${status:9:3}
if [ "${status:9:3}" == "200" ]; then
while true; do
say "Its here... Its here... Its here"
echo -en "\007"
done
fi
View gist:5044533
[[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil]
setBackgroundImage:[[UIImage imageNamed:@"NavButton"] stretchableImageWithLeftCapWidth:10 topCapHeight:0]
forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
[[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil]
setBackButtonBackgroundImage:[[UIImage imageNamed:@"BackButton"] stretchableImageWithLeftCapWidth:15 topCapHeight:0]
forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setTintColor:[UIColor rmRedColor]];
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"NavBarBG"]
View Base Init
-(void) baseInit_ {
<#Your code here#>
}
-(id) initWithCoder:(NSCoder *)aDecoder {
if(self = [super initWithCoder:aDecoder]) {
View gist:4269643
self.textLayer = [CATextLayer layer];
self.textLayer.frame = CGRectMake(20, 300, 280, 21);
self.textLayer.alignmentMode = kCAAlignmentLeft;
self.textLayer.wrapped = YES;
self.textLayer.contentsScale = [[UIScreen mainScreen] scale];
[self.view.layer addSublayer:self.textLayer];
CTFontRef ctBoldFont = CTFontCreateWithName((__bridge CFStringRef)[UIFont boldSystemFontOfSize:12].fontName, [UIFont boldSystemFontOfSize:12].pointSize, NULL);
NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:
#if ! __has_feature(objc_arc)
#error This file/class is targeted for the ARC compiler. Either turn on ARC for your project or use -fobjc-arc flag
#endif
View gist:3037228
for (id objFamilyName in [UIFont familyNames]) {
if ([objFamilyName isKindOfClass:[NSString class]]) {
for(id objFontName in [UIFont fontNamesForFamilyName:(NSString*)objFamilyName]) {
if ([objFontName isKindOfClass:[NSString class]]) {
NSLog(@"%s: %@: %@", __FUNCTION__, objFamilyName, objFontName);
}
}
}
}
View UIViewController controller.m
+(id) controller {
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{
return [[[self class] alloc] initWithNibName:NSStringFromClass([self class]) bundle:nil];
}
else
{
return [[[self class] alloc] initWithNibName:[NSString stringWithFormat:@"%@~ipad",
Something went wrong with that request. Please try again.