Skip to content

Instantly share code, notes, and snippets.

View manchunlam's full-sized avatar

Man Chun Lam manchunlam

View GitHub Profile
@manchunlam
manchunlam / tech-questions.md
Created June 23, 2016 19:57 — forked from dyoung522/tech-questions.md
Technical Interview Questions

Technical Interview Questions

General

  • In as much detail as you like, explain what happens when I type "google.com" into my browser's address bar and press enter.
  • Explain the difference between dynamic vs. static programming languages? What are the advantages/disadvantages of each?
  • What's something you love/hate about your favorite programming language?
  • What tools do you use for your day to day work? Language, IDEs/editors, version control, build systems, provisioning, etc.?
  • What's the difference between an class vs. an object?
  • What is inheritance? What are some alternate ways to reuse logic without using it? What are some downsides to it?
@manchunlam
manchunlam / gist:a949ef58943d21e08beb
Last active August 29, 2015 14:27 — forked from analytically/gist:5760207
Ansible /etc/network/interfaces template
# {{ ansible_managed }}
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
{% if ansible_interfaces|length > 2 %}
@manchunlam
manchunlam / Gemfile
Last active August 29, 2015 14:25 — forked from mjquinlan2000/Gemfile
Forward Multipart Request as IO Object
# Make sure to add this to your Gemfile
gem 'faraday'
@manchunlam
manchunlam / upgrade.md
Last active August 29, 2015 14:14
Graph API Upgrade

Graph API Version Upgrade

Table of Contents

  1. [Facebook App and Graph API Versioning] (#i-facebook-app-and-graph-api-versioning)
  2. [Graph (Platform) API Changelog v1.0 to v2.0] (#ii-graph-platform-api-changelog-v1-0-to-v2-0)
    1. App-Scoped User ID
    2. [New Permission to Get a User's Friends]
# SQLite version 3.x
# gem install sqlite3-ruby (not necessary on OS X Leopard)
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
N.B. This all assumes that you currently connect to the VPN through a VirtualBox Ubuntu machine. If you don't, no problem, but you're gonna have to make it work with whatever your setup is!
IN YOUR VBox VM
1. sudo apt-get install openconnect
2. Make an executable shell script in your home directory:
#!/bin/bash
openconnect -u yourusername_us https://myaccess.oraclevpn.com/
3. Try running it with sudo. Make sure it connects. Tweak until it does.
4. Shut down your VBox VM.
<!doctype html>
<html lang="en">
<head>
<title>Test Execute Order</title>
</head>
<body>
<script src="//requirejs.org/docs/release/1.0.1/minified/require.js"></script>
<script>
require.config({

ruby-1.9.3-p484 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p484 with the railsexpress patchsets: https://github.com/skaes/rvm-patchsets

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@manchunlam
manchunlam / i18n.md
Last active December 21, 2015 13:19
Platform UI i18n

config/i18n-js.yml

translations:
  -
    # This key must match exactly
    file: 'public/javascripts/platform_ui/i18n/translations.js'

    # List the translation keys you want exported to JS here.
 # The leading * indicates all locales. The first two sections

Controller Filters

The Rails REST implementation dictates the default seven actions for your controllers, but frequently we want to share functionality across multiple actions or even across controllers. Controller filters are the easiest way to do that.

Before, After, and Around

There are three types of filters implemented in Rails:

  • a before_filter runs before the controller action
  • an after_filter runs after the controller action