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; | |
} |
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
BOOL dragUp = [pan velocityInView:<#UIView#>].y < 0; |
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
// | |
// APAppDelegate.m | |
// TestMouse | |
// | |
// Created by alberto pasca on 04/09/14. | |
// Copyright (c) 2014 albertopasca.it. All rights reserved. | |
// | |
#import "APAppDelegate.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
// listen for keystrokes | |
[NSEvent addGlobalMonitorForEventsMatchingMask:NSKeyDownMask handler:^(NSEvent *event) | |
{ | |
NSLog(@"%lui -- %@", (unsigned long)[event modifierFlags], event.characters ); | |
// | |
// if flag and char do something, like bring to front the application | |
// 256 is ESC, in my case. | |
// |
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
lipo -create libPhone.a libSimulator.a -output libUniversal.a |
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
<?php | |
class MyClass | |
{ | |
private static $instance = null; | |
private function __construct() { } | |
public static function getInstance() | |
{ | |
if(self::$instance == null) | |
{ |
OlderNewer