| layout | category | tags | |||||
|---|---|---|---|---|---|---|---|
post |
resource |
|
##specs
- html5 spec - the w3c spec, always handy
| // Macros for the top and bottom colors of the gradient | |
| #define kGradientTopColor {0.0f/255.0f, 0.0f/255.0f, 0.0f/255.0f, 1.0f} | |
| #define kGradientBottomColor {209.0f/255.0f, 209.0f/255.0f, 209.0f/255.0f, 1.0f} | |
| // Macro for the area that should be covered by the gradient | |
| #define kGradientBounds self.bounds | |
| // Customize your UIView (e.g., UIView, UILabel, UIButton, etc...) drawRect method | |
| - (void)drawRect:(CGRect)rect | |
| { |
| // Destroy UIWebView | |
| - (void)destroyWebView | |
| { | |
| [self.webView loadHTMLString:@"" baseURL:nil]; | |
| [self.webView stopLoading]; | |
| [self.webView setDelegate:nil]; | |
| [self.webView removeFromSuperview]; | |
| [self setWebView:nil]; | |
| [[NSURLCache sharedURLCache] removeAllCachedResponses]; |
| layout | category | tags | |||||
|---|---|---|---|---|---|---|---|
post |
resource |
|
##specs
| @implementation UIImage (WRExtensions) | |
| #pragma mark - | |
| #pragma mark Scale and crop image | |
| - (UIImage*)imageByScalingAndCroppingForSize:(CGSize)targetSize | |
| { | |
| UIImage *sourceImage = self; | |
| UIImage *newImage = nil; | |
| CGSize imageSize = sourceImage.size; |
| + (NSString *)base64EncodeString:(NSString *)stringToEncode | |
| { | |
| CFHTTPMessageRef messageRef = CFHTTPMessageCreateEmpty(kCFAllocatorDefault, FALSE); | |
| CFHTTPMessageAddAuthentication(messageRef, NULL, CFSTR("AS"), (__bridge CFStringRef)stringToEncode, kCFHTTPAuthenticationSchemeBasic, FALSE); | |
| CFStringRef authStringRef = CFHTTPMessageCopyHeaderFieldValue(messageRef, CFSTR("Authorization")); | |
| NSString *encodedString = [(__bridge NSString *)authStringRef substringFromIndex:10]; | |
| CFRelease(messageRef); |
| // Photoshop Script to Create iPhone Icons from iTunesArtwork | |
| // | |
| // WARNING!!! In the rare case that there are name collisions, this script will | |
| // overwrite (delete perminently) files in the same folder in which the selected | |
| // iTunesArtwork file is located. Therefore, to be safe, before running the | |
| // script, it's best to make sure the selected iTuensArtwork file is the only | |
| // file in its containing folder. | |
| // | |
| // Copyright (c) 2010 Matt Di Pasquale | |
| // Added tweaks Copyright (c) 2012 by Josh Jones http://www.appsbynight.com |
| - (void)popView:(UIView *)viewToPop | |
| { | |
| CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"transform"]; | |
| NSValue *scale1Value = [NSValue valueWithCATransform3D:CATransform3DMakeScale(0.5f, 0.5f, 1.0f)]; | |
| NSValue *scale2Value = [NSValue valueWithCATransform3D:CATransform3DMakeScale(1.2f, 1.2f, 1.0f)]; | |
| NSValue *scale3Value = [NSValue valueWithCATransform3D:CATransform3DMakeScale(0.9f, 0.9f, 1.0f)]; | |
| NSValue *scale4Value = [NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0f, 1.0f, 1.0f)]; | |
| NSArray *frameValues = [NSArray arrayWithObjects:scale1Value, scale2Value, scale3Value, scale4Value, nil]; | |
| [animation setValues:frameValues]; |
| #import <UIKit/UIKit.h> | |
| @interface UIImage (ResizeImage) | |
| + (UIImage *)convertImage:(UIImage *)image toSize:(CGSize)size; | |
| @end |
| Delete the relevant section from the .gitmodules file. | |
| Stage the .gitmodules changes git add .gitmodules | |
| Delete the relevant section from .git/config. | |
| Run git rm --cached path_to_submodule (no trailing slash). | |
| Run rm -rf .git/modules/path_to_submodule | |
| Commit git commit -m "Removed submodule <name>" | |
| Delete the now untracked submodule files | |
| rm -rf path_to_submodule |