Skip to content

Instantly share code, notes, and snippets.


Robin Chou chourobin

View GitHub Profile
chourobin / index.js
Created Jun 22, 2017 — forked from mrzmyr/index.js
React Native - Detect Double Tap
View index.js
var Index = React.createClass({
getInitialState: function () {
return {
lastPress: 0
onPress: function () {
var delta = new Date().getTime() - this.state.lastPress;
chourobin / MLWAsyncAVPlayer.h
Created Jun 20, 2017 — forked from k06a/MLWAsyncAVPlayer.h
Awesome optimized AVPlayer for smooth scrolling AVPlayerLayer inside UICollectionView/UITableView (tested on iOS10+)
View MLWAsyncAVPlayer.h
#import <AVFoundation/AVFoundation.h>
@interface MLWAsyncAVPlayer : AVPlayer
View AVPlayerCaching.m
// 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 / RNfontWeights.js
Created Apr 17, 2017 — forked from knowbody/RNfontWeights.js
React Native Font Weight Cheatsheet iOS
View RNfontWeights.js
{ 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 / StateMachine.swift
Created Nov 21, 2016 — forked from jemmons/StateMachine.swift
A Simple Swift State Machine
View StateMachine.swift
import Foundation
class StateMachine <P: StateMachineDelegateProtocol> {
private unowned let delegate: P
private var _state: P.StateType {
delegate.didTransitionFrom(from: oldValue, to: _state)
chourobin / UIButton+VerticalLayout.h
Created Aug 23, 2016 — forked from r3econ/UIButton+VerticalLayout.h
UIButton category for centering title label and image vertically. The text label is placed below the image.
View UIButton+VerticalLayout.h
@interface UIButton (VerticalLayout)
- (void)centerVerticallyWithPadding:(float)padding;
- (void)centerVertically;
chourobin / gist:7ac64b28cfe0fa85f103
Created Nov 12, 2015 — forked from marcoarment/gist:1105553afba6b4900c10
Variable-height UITableView tableHeaderView with autolayout
View gist:7ac64b28cfe0fa85f103
// 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
View The Technical Interview Cheat

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
View gist:134b938a5b06308f29f0
# encoding : utf-8
require 'openssl'
require 'digest/sha1'
require 'base64'
module Aws
extend self
def signed_url(path, expire_date)
digest ='sha1')
can_string = "GET\n\n\n#{expire_date}\n/#{S3_BUCKET}/#{path}"
View carrier_wave.rb
# NullStorage provider for CarrierWave for use in tests. Doesn't actually
# upload or store files but allows test to pass as if files were stored and
# the use of fixtures.
class NullStorage
attr_reader :uploader
def initialize(uploader)
@uploader = uploader
You can’t perform that action at this time.