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
// | |
// CoreTextLabel.h | |
// Frost | |
// | |
// Created by David Kasper on 10/1/12. | |
// | |
#import <UIKit/UIKit.h> | |
#import <CoreText/CoreText.h> |
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
@interface APViewController () | |
{ | |
NSMutableArray *_Labels; | |
} | |
- ( void ) forEachLabel: ( void (^)( UILabel * label ) ) block; | |
@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
@interface APPassThroughUIView : UIView | |
@end | |
@implementation APPassThroughUIView | |
- (BOOL) pointInside:(CGPoint)point withEvent:(UIEvent *)event | |
{ | |
for (UIView *v in self.subviews) | |
{ |
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
- (NSDictionary*) loadJson | |
{ | |
NSString *fPath = [[NSBundle mainBundle] pathForResource:@"jtest" ofType:@"json"]; | |
NSData *data = [NSData dataWithContentsOfFile:fPath]; | |
return | |
[ NSJSONSerialization JSONObjectWithData: data | |
options: NSJSONReadingMutableContainers | |
error: nil ]; | |
} |
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
int N(int n, int k) { | |
if (n == 0) return k == 0 ? 1 : 0; | |
return (N(n-1, k-1) + N(n-1, k)*(n-1-k)) + N(n-1, k+1)*(k+1) % 2810; | |
} | |
int num[] = {N(3,6)+105,N(8,5)-2,102,N(8,5)-1,64,97+N(3,6), | |
108,98,101,N(8,5)+2,116,N(8,5)-1,N(8,5), | |
97,115,99,97,(N(8,6)*2)-10,105,N(8,5)+4}; | |
for ( auto n : num ) | |
printf ( "%c", n ); |
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
// | |
// Fibonacci Algorithm | |
// | |
// Created by Alberto Pasca on 25/02/14. | |
// Copyright (c) 2014 albertopasca.it. All rights reserved. | |
// | |
#include <iostream> | |
#include <chrono> |
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
# ---------------------------------------------------------------------- | |
# WARNING - do not edit this template unless you know what you are doing | |
# ---------------------------------------------------------------------- | |
# the parent cache | |
cache_peer %PARENTPROXY% parent %PARENTPORT% 7 no-query no-digest no-netdb-exchange default | |
strip_query_terms off | |
# disk and memory cache settings |
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
- (UIColor *)averageColor | |
{ | |
CGImageRef rawImageRef = [self CGImage]; | |
CFDataRef data = CGDataProviderCopyData(CGImageGetDataProvider(rawImageRef)); | |
const UInt8 *rawPixelData = CFDataGetBytePtr(data); | |
NSUInteger imageHeight = CGImageGetHeight(rawImageRef); | |
NSUInteger imageWidth = CGImageGetWidth(rawImageRef); | |
NSUInteger bytesPerRow = CGImageGetBytesPerRow(rawImageRef); |
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
@interface UIImage (Blur) | |
- (UIImage *)imageWithGaussianBlur; | |
- (UIImage*) stackBlur:(NSUInteger)radius; | |
- (UIImage *) normalize; | |
+ (void) applyStackBlurToBuffer:(UInt8*)targetBuffer width:(const int)w height:(const int)h withRadius:(NSUInteger)inradius; | |
@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
- (NSMutableAttributedString*) subtitle:(NSString*)pString | |
{ | |
NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:pString]; | |
NSRange selectedRange = NSMakeRange(0, 6); // 6 characters, starting at index 0 | |
[string beginEditing]; | |
[string addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"Helvetica-Bold" size:12.0] range:selectedRange]; | |
[string endEditing]; | |
return string; | |
} |
OlderNewer