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
// | |
// Created by Mugunth Kumar, Copyright © 2019 MK. All rights reserved. | |
// | |
import Foundation | |
import UIKit | |
import ImageIO | |
public extension UIImageView { |
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
func measure(prefix: String = "Time Taken", closure:()->()) { | |
let a = CFAbsoluteTimeGetCurrent() | |
closure() | |
let b = CFAbsoluteTimeGetCurrent() | |
let m = ((b-a) * 1000.0) | |
print("\(prefix): \(m) ms") | |
} |
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
- (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]; | |
}]; | |
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 | |
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 |
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 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"] |
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
-(void) baseInit_ { | |
<#Your code here#> | |
} | |
-(id) initWithCoder:(NSCoder *)aDecoder { | |
if(self = [super initWithCoder:aDecoder]) { | |
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 ! __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 |
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
self.myView.layer.masksToBounds = NO; | |
self.myView.layer.shadowColor = [UIColor blackColor].CGColor; | |
self.myView.layer.shadowOffset = CGSizeMake(0.0f, 2.0f); | |
self.myView.layer.shadowOpacity = 0.7f; | |
self.myView.layer.shadowRadius = 3.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
[AppDelegate.imageFetcher imageAtURL:self.profile.avatarURL | |
onCompletion:^(UIImage *image, NSURL *url, BOOL isInCache) | |
{ | |
// this "if" is to prevent images flashing repeatedly when cells are reused. | |
if ([[self.profile.avatarURL absoluteString] isEqualToString:[url absoluteString]]) { | |
self.avatarImageView.image = resizedImage; | |
} | |
}]; |
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
# Copy this file to /usr/local/bin/ on your Mac | |
# type chmod +x initgit.sh | |
# From now on, on any folder, you can just type initgit.sh and a new git repo with a default .gitignore file will be created for you. | |
#! /bin/sh | |
git init | |
cp ~/.gitignore . | |
rm -r build/ | |
git add .gitignore |
NewerOlder