I hereby claim:
- I am lukabernardi on github.
- I am lucabernardi (https://keybase.io/lucabernardi) on keybase.
- I have a public key whose fingerprint is 36C3 8A7A 02A5 70AC C353 6094 CCA0 CD3A E21B E752
To claim this, I am signing this object:
#import <Foundation/Foundation.h> | |
@interface LBRObject : NSObject | |
@end | |
@implementation LBRObject | |
- (void)execute | |
{ | |
@synchronized(self) { |
-- CIS 194: Homework 1 (http://www.seas.upenn.edu/~cis194/hw/01-intro.pdf) | |
-- toDigits 1234 == [1,2,3,4] | |
-- toDigitsRev 1234 == [4,3,2,1] | |
-- toDigits 0 == [] | |
-- toDigits (-17) == [] | |
toDigitsRev :: Integer -> [Integer] | |
toDigitsRev x = if x <= 0 |
void objc_setProperty_nonatomic_copy(id self, SEL _cmd, id newValue, ptrdiff_t offset) | |
{ | |
temp = [newValue copyWithZone:NULL]; | |
oldValue = *(self + offset); | |
*(sef + offset) = temp; | |
_objc_release(oldValue); | |
} |
I hereby claim:
To claim this, I am signing this object:
/** | |
As Apple said [NSDateFormatter init] is very expensive (https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/DataFormatting/Articles/dfDateFormatting10_4.html#//apple_ref/doc/uid/TP40002369-SW10) | |
In Apple's code is used a static const, but since NSDateFormatter | |
isn't thread safe a better approach is to use Thread local store (http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/Multithreading/CreatingThreads/CreatingThreads.html#//apple_ref/doc/uid/10000057i-CH15-SW4) | |
to cache the NSDateFormatter instance | |
*/ | |
NSString * const kCachedDateFormatterKey = @"CachedDateFormatterKey"; | |
+ (NSDateFormatter *)dateFormatter |
__weak typeof(self) weakSelf = self; | |
self.collectionView = (UICollectionView *)^{ | |
UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init]; | |
UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:weakSelf.view.bounds | |
collectionViewLayout:flowLayout]; | |
collectionView.delegate = weakSelf; | |
collectionView.dataSource = weakSelf; | |
return collectionView; |
protocol Reusable{ | |
static var reuseIdentifier: String { get } | |
} | |
extension Reusable { | |
static var reuseIdentifier: String { return String(Self.self) } | |
} | |
extension UICollectionViewCell : Reusable {} |
UIImage *scaleAndRotateImage(UIImage *image) | |
{ | |
int kMaxResolution = 1920; | |
CGImageRef imgRef = image.CGImage; | |
CGFloat width = CGImageGetWidth(imgRef); | |
CGFloat height = CGImageGetHeight(imgRef); | |
I hereby claim:
To claim this, I am signing this object:
import java.io.InputStream; | |
import java.lang.ref.WeakReference; | |
import java.net.URL; | |
import android.graphics.Bitmap; | |
import android.graphics.BitmapFactory; | |
import android.os.AsyncTask; | |
import android.util.Log; | |
import android.widget.ImageView; |