###View Transitions in iOS 7
class GroupersController < ApplicationController::Base | |
def create | |
@grouper = Grouper.new(leader: current_member) | |
if @grouper.save | |
ConfirmedGrouperEmails.new(@grouper).deliver | |
AssignBarForGrouper.enqueue(@grouper.id) | |
redirect_to home_path | |
else |
class GroupersController < ApplicationController::Base | |
def create | |
@grouper = Grouper.new(leader: current_member) | |
if @grouper.save | |
confirm_grouper_via_emails(@grouper) | |
enqueue_bar_assignment(@grouper) | |
redirect_to home_path | |
else |
NSTimeInterval duration = 3.0; | |
SEL selector = @selector(_setContentOffsetAnimationDuration:); | |
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[scrollView methodSignatureForSelector:selector]]; | |
[invocation setSelector:selector]; | |
[invocation setTarget:scrollView]; | |
[invocation setArgument:&duration atIndex:2]; | |
[invocation invoke]; | |
[scrollView setContentOffset:contentOffset animated:YES] |
Some notes on why Go works for me and why it might work for you if you're looking for another language to add to your repetoire. Goes without saying that this reflects my personal taste.
Go features that I particularly like
- Multicore is the future so I like that Go has concurrency built right into the core. Goroutines and channels provide a very accessible metaphor for thinking about concurrent programming. They're supported by language features that really make Go shine in this area. The select statement, for example, makes it easy to listen to and synchronise events from different concurrent threads.
- Provides both pointers and value types, but the pointers are safe and managed. Automatic memory management means its safe to return a pointer to a local variable.
- Interfaces in Go are smooth and unobtrusive. They automatically apply to anything with the right function signature so you can define interfaces that are satisfied by 3rd party code without you having to change it.
- Errors are signale
There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.
So, these are the different settings we are going to compare:
- Go HTTP standalone (as the control group)
- Nginx proxy to Go HTTP
- Nginx fastcgi to Go TCP FastCGI
- Nginx fastcgi to Go Unix Socket FastCGI
- (CGPoint)targetContentOffsetForProposedContentOffset:(CGPoint)proposedContentOffset withScrollingVelocity:(CGPoint)velocity | |
{ | |
CGFloat offSetAdjustment = MAXFLOAT; | |
CGFloat horizontalCenter = (CGFloat) (proposedContentOffset.x + (self.collectionView.bounds.size.width / 2.0)); | |
CGRect targetRect = CGRectMake(proposedContentOffset.x, 0.0, self.collectionView.bounds.size.width, self.collectionView.bounds.size.height); | |
NSArray *array = [self layoutAttributesForElementsInRect:targetRect]; | |
for (UICollectionViewLayoutAttributes *layoutAttributes in array) | |
{ |
+ (void)describePreferredFonts | |
{ | |
static NSArray *textStyles; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
textStyles = @[UIFontTextStyleHeadline, | |
UIFontTextStyleSubheadline, | |
UIFontTextStyleBody, | |
UIFontTextStyleFootnote, | |
UIFontTextStyleCaption1, |
Hi there!
The docker cheat sheet has moved to a Github project under https://github.com/wsargent/docker-cheat-sheet.
Please click on the link above to go to the cheat sheet.