I hereby claim:
- I am tewha on github.
- I am tewha (https://keybase.io/tewha) on keybase.
- I have a public key ASAykxBa8QqrX2hg6nao3GlKI8lNUhQ4uvwPbiBrSIgNdQo
To claim this, I am signing this object:
- (void)showError; | |
{ | |
dispatch_async( dispatch_get_main_queue(), ^ { | |
// Setup error view; these values are visible as it slides into place. | |
_errorView.alpha = finalErrorAlpha; | |
_errorLabel.text = [_error localizedDescription]; | |
// Slide down the error view, with normal alpha. | |
[UIView animateWithDuration: slideDownDuration | |
animations: ^{ | |
CGRect frame = _errorView.frame; |
<?php | |
// NOTE that responses are automatically generated by Presto (this example simulates the call as a demonstration) | |
// 1. Create new Response (faking $ctx) | |
$r = new Response((object) array( 'res' => 'htm' ) ); // htm intentional, tests type matching | |
// 2. Add a new type handler, with a custom mapping (anon fn) |
__block id foo = [MyObject new]; | |
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ | |
NSLog(@"block entering synchronized"); | |
@synchronized(foo) { | |
NSLog(@"running in synchronized"); | |
sleep(10); | |
// what does @synchronized do the now-zombie foo as part of its closure? | |
} | |
NSLog(@"block exited synchronized"); | |
}); |
- (void)colors { | |
// Working with colors in Cocoa Touch. | |
// I think almost everyone uses RGB decimal, which is the worst of the ways. You don't have easy control of | |
// brightness, and you've got decimal points in your code that don't map to the way you think of RGB. | |
UIColor *rgbDec = [UIColor colorWithRed:0.484 green:0.745 blue:0.191 alpha:1.000]; | |
// If you're working from 0-255, why not just code that? | |
UIColor *rgbFrac = [UIColor colorWithRed:123.0/255.0 green:190.0/255.0 blue:49.0/255.0 alpha:1.000]; |
- (void)keyboardWillShowNotification:(NSNotification *)notification { | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
UIView *workingView = self.view; | |
CGRect keyboardScreenRect = [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue]; | |
CGRect keyboardRect = [workingView convertRect:keyboardScreenRect fromView:nil]; | |
CGRect resizeRect = [workingView convertRect:_resizingView.superview.bounds fromView:_resizingView.superview]; | |
CGRect unionRect = CGRectIntersection(keyboardRect, resizeRect); | |
CGFloat bottom = resizeRect.origin.y + resizeRect.size.height; | |
if (!isinf(unionRect.origin.y)) { |
- (UIImage *)rxScalePropertionallyToMaximumSize:(CGSize)maxSize blendMode:(CGBlendMode)blendMode alpha:(CGFloat)alpha scale:(CGFloat)scale { | |
if ((maxSize.width < 1.0e-15) || (maxSize.height < 1.0e-15)) return nil; | |
CGSize imageSize = self.size; | |
CGSize scaleFactors = { | |
.width = maxSize.width / imageSize.width, | |
.height = maxSize.height / imageSize.height, | |
}; | |
// | |
// DateTest.m | |
// DateTest | |
// | |
// Created by Steven Fisher on 2013-09-27. | |
// | |
#import "DateTest.h" | |
void RunDateTest() { |
#define DictionaryOfEnumBindings(...) DictionaryOfEnumBindingsWorker(@"" # __VA_ARGS__, __VA_ARGS__, nil) | |
NSDictionary *DictionaryOfEnumBindingsWorker(NSString *commaSeparatedKeysString, int firstValue, ...) { | |
NSMutableDictionary *enums = [NSMutableDictionary dictionary]; | |
NSMutableArray *names = [[commaSeparatedKeysString componentsSeparatedByString:@","] mutableCopy]; | |
va_list ap; | |
va_start(ap, firstValue); | |
NSCharacterSet *whiteSpace = [NSCharacterSet whitespaceAndNewlineCharacterSet]; | |
NSString *firstPaddedName = [names objectAtIndex:0]; |
I hereby claim:
To claim this, I am signing this object:
This is my personal setup list. Yours may vary.