Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View andrewsardone's full-sized avatar

Andrew Sardone andrewsardone

View GitHub Profile

Using Calca for design

Below, the variables and examples were taken verbatim from [Using Soulver for design][sfd].

I'm just posting this as a reference, and example of sharing plain text documents for use within Calca. [sfd]: http://bjango.com/articles/soulver/

Variables and examples

iPhoneW = 320

@andrewsardone
andrewsardone / gist:6076443
Last active December 20, 2015 05:09
I'm trying my hardest to make sure @cdzombak can't read this code.
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
if (object == self && context == self.kvoContext) {
((void (^)(void)) @{
@"addresses": ^{ self.peep.address = [self dictionaryForArrayOfValues:self.addresses]; },
@"emails": ^{ self.peep.email = [self dictionaryForArrayOfValues:self.emails]; },
}[keyPath] ?: ^{})();
}
else if (object == self.peep && context == self.kvoContext) {
((void (^)(void)) @{

I was linked to this post by Mark Wilson via a tweet from Tim O'Reilly:

This critique of an Apple ad may well be the most important thing you'll read this year: http://bit.ly/115U5uT Take it seriously.

My terse comment on Twitter summed up my response, but I decided to follow O'Reilly's lead and “take [the piece] seriously.” I'll try to keep it short.

Fresh clone and test of script/ci:

git clone https://github.com/andrewsardone/UITextView-UIControl \
  && cd UITextView-UIControl \
  && git checkout -t origin/ci \
  && script/bootstrap \
  && script/ci

To form a parent-child relationship:

  1. Send the -addChildViewController: message to the parent with the child as the parameter. This will send the -willMoveToParentViewController: message to the child with the parent as the parameter.
  2. Add the child view controller's view as a subview to the parent view controller's view.
  3. Send the -didMoveToParentViewController: message to the child with the parent as the parameter.

For example,

[parent addChildViewController:child];
#import <UIKit/UIKit.h>
@interface AbstractViewController : UIViewController
@property (nonatomic, strong) Class specialButtonClass;
@property (nonatomic, strong) IBOutlet UIButton *specialButton; // laid out in nib
@end
// 1.
// “Safe” but retain cycle.
[self setCompletionBlock:^{
NSLog(@"1: %@", self->_foo);
}];
// 2.
// Unsafe. Could dereference nil.
__weak BCThing *weakSelf = self;
require 'delegate'
require 'test/unit'
# http://www.saturnflyer.com/blog/jim/2013/03/21/ruby-delegate-rb-secrets/
class Displayer < SimpleDelegator
# alias_method from post originally out of order:
# alias_method :__getobj__, :object
alias_method :object, :__getobj__
@andrewsardone
andrewsardone / gist:4150919
Created November 26, 2012 21:59
Programmatic UISearchDisplayController retain issue
#import <UIKit/UIKit.h>
@interface ExampleViewController : UIViewController
@end
#pragma mark -
@implementation ExampleViewController
- (void)viewDidLoad
@andrewsardone
andrewsardone / gist:4014223
Created November 4, 2012 22:58
vimari issues

vimari

Feature Requests

  • insert-mode
    • ignore all commands until you hit esc to exit
  • Scroll to top of the page with gg
  • Scroll to bottom of the page with G
  • Scroll a page up with u
  • Scroll a page down with d