Skip to content

Instantly share code, notes, and snippets.

View chourobin's full-sized avatar

Robin Chou chourobin

View GitHub Profile

Keybase proof

I hereby claim:

  • I am chourobin on github.
  • I am robinchou (https://keybase.io/robinchou) on keybase.
  • I have a public key ASBUj_uuP1sOsaQ2FaG1ljzbnugx4PjNN9xIu8gFrpYvuAo

To claim this, I am signing this object:

@chourobin
chourobin / index.js
Created June 22, 2017 20:18 — forked from mrzmyr/index.js
React Native - Detect Double Tap
var Index = React.createClass({
getInitialState: function () {
return {
lastPress: 0
}
},
onPress: function () {
var delta = new Date().getTime() - this.state.lastPress;
@chourobin
chourobin / MLWAsyncAVPlayer.h
Created June 20, 2017 04:23 — forked from k06a/MLWAsyncAVPlayer.h
Awesome optimized AVPlayer for smooth scrolling AVPlayerLayer inside UICollectionView/UITableView (tested on iOS10+)
#import <AVFoundation/AVFoundation.h>
@interface MLWAsyncAVPlayer : AVPlayer
@end
//
// ViewController.m
// AVPlayerCaching
//
// Created by Anurag Mishra on 5/19/14.
// Sample code to demonstrate how to cache a remote audio file while streaming it with AVPlayer
//
#import "ViewController.h"
#import <AVFoundation/AVFoundation.h>
@chourobin
chourobin / RNfontWeights.js
Created April 17, 2017 14:36 — forked from knowbody/RNfontWeights.js
React Native Font Weight Cheatsheet iOS
{ fontWeight: '100' }, // Thin
{ fontWeight: '200' }, // Ultra Light
{ fontWeight: '300' }, // Light
{ fontWeight: '400' }, // Regular
{ fontWeight: '500' }, // Medium
{ fontWeight: '600' }, // Semibold
{ fontWeight: '700' }, // Bold
{ fontWeight: '800' }, // Heavy
{ fontWeight: '900' }, // Black
@chourobin
chourobin / .eslintrc
Last active October 27, 2018 00:30
React Native General Eslint File
{
"parser": "babel-eslint",
"env": {
"browser": true
},
"plugins": [
"babel",
"react",
"react-native"
],
@chourobin
chourobin / 0-bridging-react-native-cheatsheet.md
Last active December 18, 2024 16:22
React Native Bridging Cheatsheet
@chourobin
chourobin / StateMachine.swift
Created November 21, 2016 15:36 — forked from jemmons/StateMachine.swift
A Simple Swift State Machine
import Foundation
class StateMachine <P: StateMachineDelegateProtocol> {
private unowned let delegate: P
private var _state: P.StateType {
didSet{
delegate.didTransitionFrom(from: oldValue, to: _state)
}
@chourobin
chourobin / UIButton+VerticalLayout.h
Created August 23, 2016 18:11 — forked from r3econ/UIButton+VerticalLayout.h
UIButton category for centering title label and image vertically. The text label is placed below the image.
@interface UIButton (VerticalLayout)
- (void)centerVerticallyWithPadding:(float)padding;
- (void)centerVertically;
@end
@chourobin
chourobin / gist:7ac64b28cfe0fa85f103
Created November 12, 2015 04:59
Variable-height UITableView tableHeaderView with autolayout
// in a UITableViewController (or any other view controller with a UITableView)
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
{
UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, size.width, 0)];
header.translatesAutoresizingMaskIntoConstraints = NO;
// [add subviews and their constraints to header]
NSLayoutConstraint *headerWidthConstraint = [NSLayoutConstraint