Skip to content

Instantly share code, notes, and snippets.

View tuchangwei's full-sized avatar

Changwei tuchangwei

View GitHub Profile
echo sha, contributor, date, message > log.csv
git log --date=local --pretty=format:'%h, %an, %ad, "%s"' >> log.csv
@tuchangwei
tuchangwei / introrx.md
Created November 7, 2016 08:42 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@tuchangwei
tuchangwei / TypeErasure.swift
Created March 3, 2016 02:10 — forked from gwengrid/TypeErasure.swift
Example of type erasure with Pokemon
class Thunder { }
class Fire { }
protocol Pokemon {
typealias PokemonType
func attack(move:PokemonType)
}
struct Pikachu: Pokemon {
typealias PokemonType = Thunder
@tuchangwei
tuchangwei / gist:d0e3186d123a63ac3b7e
Created December 29, 2015 04:15 — forked from iwasrobbed/gist:5528897
UICollectionView w/ NSFetchedResultsController & NSBlockOperation. Idea originated from Blake Watters (https://github.com/AshFurrow/UICollectionView-NSFetchedResultsController/issues/13)
- (void)controllerWillChangeContent:(NSFetchedResultsController *)controller
{
self.shouldReloadCollectionView = NO;
self.blockOperation = [[NSBlockOperation alloc] init];
}
- (void)controller:(NSFetchedResultsController *)controller didChangeSection:(id<NSFetchedResultsSectionInfo>)sectionInfo
atIndex:(NSUInteger)sectionIndex forChangeType:(NSFetchedResultsChangeType)type
{
__weak UICollectionView *collectionView = self.collectionView;
@tuchangwei
tuchangwei / SlideAnimatedTransitioning.h
Created December 29, 2015 04:15 — forked from visnup/SlideAnimatedTransitioning.h
iOS 7 screen edge gesture swipe from right to left (similar to edge swiping from left to right) on UINavigationController. *only* the edge swipe uses the custom transition; everything else uses default behaviors.
//
// SlideAnimatedTransitioning.h
// SwipeLeft
//
// Created by Visnu on 4/14/14.
// Copyright (c) 2014 Visnu Pitiyanuvath. All rights reserved.
//
#import <Foundation/Foundation.h>