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 <Foundation/Foundation.h> | |
@interface NSMutableURLRequest (KDJBasicAuthentication) | |
// Sets the "Authorization" HTTP header to a basic authentication value | |
// with Base64-encoded username and password. This overwrites any existing | |
// value for this header. | |
- (void)setAuthorizationHeaderWithUsername:(NSString *)username | |
password:(NSString *)password; |
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 <UIKit/UIKit.h> | |
@interface ViewController : UITableViewController <UITableViewDelegate, UITableViewDataSource> | |
@property (nonatomic, strong) NSMutableArray *data; | |
@property (nonatomic, strong) NSMutableArray *sectionTitles; | |
@end |
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
alias longestFiles='find . -name \*.m -not -path "./Pods/*" -exec wc -l {} \; | sort | tail' | |
alias avgFilesLong="find . -name \*.m -not -path './Pods/*' -exec wc -l {} \; | awk '{ total += \$1; count++} END { print total/count }'" | |
alias toLongFiles="find . -name \*.m -not -path './Pods/*' -exec wc -l {} \; | sort | awk 'BEGIN{ count = 0; } { if (\$1 > 300){ print \$0; count++}} END { print \" \" count \" files long over 300 lines\" }'" |
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
#contentArea { | |
width:850px!important; | |
} | |
._4-u2,._5x16 ._5inf::after,._6l-:after, ._4_w3::after, ._5va1, .timelineUnitContainer, .timelineReportContainer, ._4lh .fbTimelineCapsule .timelineUnitContainer, ._4lh ._1xz, ._1xw:hover ._1xz, ._4lh ._1xw, .UFIReplyList .UFIRow, ._5vsj .UFIReplyList .UFIComponent.UFILastComponent:after, ._5vsj .UFIReplyList .UFIComponent.UFIFirstComponent:after { | |
border:0!important; | |
border-left: none!important; | |
border-right:none!important; | |
-webkit-box-shadow: none!important; | |
} |
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
// returns a MKCoordinateRegion that encompasses an array of MKAnnotations | |
- (MKCoordinateRegion)regionForAnnotations:(NSArray *)annotations { | |
CLLocationDegrees minLat = 90.0; | |
CLLocationDegrees maxLat = -90.0; | |
CLLocationDegrees minLon = 180.0; | |
CLLocationDegrees maxLon = -180.0; | |
for (id <MKAnnotation> annotation in annotations) { |
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
#!/bin/bash | |
xcodeUUID=`defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID` | |
echo $xcodeUUID | |
find ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins -name Info.plist -maxdepth 3 | xargs -I{} defaults write {} DVTPlugInCompatibilityUUIDs -array-add $xcodeUUID |
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 [ "$CONFIGURATION" = "Ad hoc" ] || [ "$CONFIGURATION" = "Release" ]; then | |
echo "Bumping build number..." | |
plist=${PROJECT_DIR}/${INFOPLIST_FILE} | |
buildnum=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${plist}") | |
if [[ "${buildnum}" == "" ]]; then | |
echo "No build number in $plist" | |
exit 2 | |
fi |
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
enum Tower:String { | |
case A | |
case B | |
case C | |
} | |
func hanoi(_ disk: Int, from: Tower, using: Tower, | |
to: Tower, output: inout [String]) { | |
if disk == 1 { | |
output.append("\(from.rawValue)->\(to.rawValue)") |
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
//remember to intall AFNetworking https://github.com/AFNetworking/AFNetworking#installation-with-cocoapods | |
//and add import : | |
//#import "UIImageView+AFNetworking.h" | |
- (void)setImageFromDictionary:(NSDictionary *)dic2 { | |
NSString *path = dic2[@"safe_value"]; | |
if (![path isKindOfClass:[NSString class]]) { | |
return; | |
} | |
NSURL *imageUrl = [NSURL URLWithString:path]; |
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
extension NSImage { | |
/// Returns the height of the current image. | |
var height: CGFloat { | |
return self.size.height | |
} | |
/// Returns the width of the current image. | |
var width: CGFloat { | |
return self.size.width |
OlderNewer