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
<?php | |
// | |
// executeRequest | |
// | |
// uses cURL to run a http(s) request. | |
// data, contentType, user, password are all optional | |
// | |
function executeRequest($target, $data, $contentType, $user, $password, &$http_status) { | |
//try to send request to remote |
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
NSString *CurrenySymbolForIso(NSString *isoCode) { | |
NSLocale *locale = [NSLocale currentLocale]; | |
return [locale displayNameForKey:NSLocaleCurrencySymbol value:isoCode]; | |
} | |
int main(int argc, char *argv[]) { | |
@autoreleasepool { | |
NSString *isoCode = @"GBP"; | |
NSString *currency = CurrenySymbolForIso(isoCode); | |
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 "XMLUtils.h" | |
#import <libxml/xmlreader.h> | |
@implementation XMLUtils | |
//... | |
+ (NSString*)rootNodeNameFromURL:(NSURL*)url { | |
NSString* obj = nil; | |
xmlTextReaderPtr reader = xmlReaderForFile( url.absoluteString.UTF8String, |
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
#!/bin/bash | |
#config | |
validGitPattern1="@github.com" | |
echoValidRepos=0 | |
#check git paths | |
for path in `ls` | |
do | |
gistfile="" |
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
@implementation NSAttributedString (DTTextAttachment) | |
+ (instancetype)attributedStringWithTextAttachment:(DTTextAttachment*)attachment { | |
NSMutableDictionary *mAttributes = [NSMutableDictionary dictionary]; | |
[mAttributes setObject:attachment forKey:NSAttachmentAttributeName]; | |
#if DTCORETEXT_SUPPORT_NS_ATTRIBUTES && TARGET_OS_IPHONE | |
// need run delegate for sizing | |
CTRunDelegateRef embeddedObjectRunDelegate = createEmbeddedObjectRunDelegate(attachment); |
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 <CoreData/CoreData.h> | |
@interface NSManagedObjectContext (SafeMerge) | |
@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
@implementation DDViewController | |
- (void)viewDidAppear:(BOOL)animated { | |
NSURL *u = [NSURL URLWithString:@"http://www.google.de"]; | |
NSURLRequest *r = [NSURLRequest requestWithURL:u]; | |
[self.webView loadRequest:r]; | |
} | |
- (void)webViewDidFinishLoad:(UIWebView *)webView { | |
NSCachedURLResponse *resp = [[NSURLCache sharedURLCache] cachedResponseForRequest:webView.request]; |
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 <UIKit/UIKit.h> | |
#import <CoreText/CTFont.h> | |
@interface UIFont (Traits) | |
@property(nonatomic, readonly) CTFontRef CTFontRef; | |
@property(nonatomic, readonly) CTFontSymbolicTraits traits; | |
@property(nonatomic, readonly, getter=isBold) BOOL bold; | |
@property(nonatomic, readonly, getter=isItalic) BOOL italic; |
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
// | |
// main.m | |
// | |
// Created by Dominik Pich on 10.02.13. | |
// Everybody is free to use this however they want! | |
// | |
#if TARGET_OS_IPHONE | |
#import <UIKit/UIKit.h> | |
#else | |
#import <Cocoa/Cocoa.h> |