Skip to content

Instantly share code, notes, and snippets.

View chourobin's full-sized avatar

Robin Chou chourobin

View GitHub Profile

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.
# encoding : utf-8
require 'openssl'
require 'digest/sha1'
require 'base64'
module Aws
extend self
def signed_url(path, expire_date)
digest = OpenSSL::Digest::Digest.new('sha1')
can_string = "GET\n\n\n#{expire_date}\n/#{S3_BUCKET}/#{path}"
# 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
end
var QcValueConverter = {
tensionFromQcValue: function(qcValue) {
return (qcValue - 30.0) * 3.62 + 194.0;
},
qcValueFromTension: function(tension) {
return (tension - 194.0) / 3.62 + 30.0;
},
frictionFromQcValue: function(qcValue) {
@chourobin
chourobin / text-color.css
Created May 10, 2014 20:16
CSS Change text color animation
.site_title {
color: #f35626;
background-image: -webkit-linear-gradient(92deg,#f35626,#feab3a);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
-webkit-animation: hue 60s infinite linear;
}
@chourobin
chourobin / mac_setup.md
Created May 8, 2014 19:44
Setup instructions for new Mac
  1. Install Xcode
  2. Install Command Line Tools
  3. Install Homebrew
  4. Install Rbenv w/ Ruby
  5. Install NVM for Node.js & coffee-script

Apps:

  • Dropbox
  • Skydrive
  • Google Drive
@chourobin
chourobin / ansible.md
Created May 8, 2014 19:43
Instructions for setting up ansible
@chourobin
chourobin / macros.m
Last active August 29, 2015 14:00
iOS screen size macro
#define __IS_IPHONE_5 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON )
#define __IPHONE_OS_VERSION_MIN_REQUIRED
#define __IPHONE_OS_VERSION_MAX_ALLOWED
@chourobin
chourobin / push_collision.m
Created April 28, 2014 14:06
Example using pan gestures and push collision
UIView *view = [panGesture view];
if (panGesture.state == UIGestureRecognizerStateBegan) {
self.collectionView.panGestureRecognizer.enabled = NO;
self.offsetY = view.frame.origin.y;
} else if (panGesture.state == UIGestureRecognizerStateBegan || panGesture.state == UIGestureRecognizerStateChanged)
{
CGPoint translation = [panGesture translationInView:[view superview]];
if (view.frame.origin.y <= 0 && translation.y < 0) {
return;
@chourobin
chourobin / dash_mux_service.conf
Last active August 29, 2015 13:57
Upstart script for nsq applications
description "dash_mux_service"
start on filesystem or runlevel [2345]
stop on runlevel [!2345]
limit nofile 50000 50000
respawn
respawn limit 10 5
pre-start script