Skip to content

Instantly share code, notes, and snippets.

View joe11051105's full-sized avatar

Joe Wang joe11051105

View GitHub Profile
#!/bin/bash
# Install docker in ubuntu 14.04
# Update your apt sources
sudo apt-get update
sudo apt-get install --assume-yes apt-transport-https ca-certificates
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo touch /etc/apt/sources.list.d/docker.list
sudo chmod 777 /etc/apt/sources.list.d/docker.list
echo 'deb https://apt.dockerproject.org/repo ubuntu-trusty main' >> /etc/apt/sources.list.d/docker.list
@joe11051105
joe11051105 / .babelrc
Created May 24, 2016 14:29 — forked from c9s/.babelrc
webpack + babel + typescript + es6 - total solutions!
{
"presets": ["es2015"],
"plugins": ["transform-runtime"]
}
@joe11051105
joe11051105 / introrx.md
Created May 25, 2016 01:41 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@joe11051105
joe11051105 / README.md
Created May 26, 2016 14:22 — forked from philipz/README.md
Docker Network Alias

Reference

docker network create lb
docker run -d --name nginx1  --net lb --net-alias nginx nginx
docker run -d --name nginx2  --net lb --net-alias nginx nginx
docker run -d --name nginx-lb -p 80:80 -v $(pwd):/data --net lb nginx
docker exec -ti nginx-lb bash

1. In the nginx-lb console

@joe11051105
joe11051105 / application_controller.rb
Created June 29, 2016 13:23 — forked from scottwb/application_controller.rb
Get a list of all the filters on a given Rails 3 controller.
# Add these methods to your ApplicationController. Then, any controller
# that inherits from it will have these methods and can programmatically
# determine what filters it has set.
class ApplicationController < ActionController::Base
def self.filters(kind = nil)
all_filters = _process_action_callbacks
all_filters = all_filters.select{|f| f.kind == kind} if kind
all_filters.map(&:filter)
end
@joe11051105
joe11051105 / 2016 書單.md
Last active August 17, 2016 13:58
2016 需看完書籍

2016 書單

  • Docker 錦囊妙計
  • 建構微服務:設計細微化的系統
  • 從車庫的舊 PC 到百萬台伺服器:巨型網站成長從無到無限大,技術架構大揭祕
  • 克服團隊領導的 5 大障礙:洞悉人性、解決衝突的白金法則
  • Kubernetes 權威指南(從Docker到Kubernetes實踐全接觸)
  • 微服務架構與實踐
  • DevOps 實戰:VMware 管理員運維方法、工具及最佳實踐
  • Docker 源碼分析
@joe11051105
joe11051105 / database_cleaner.rb
Created November 10, 2016 06:16 — forked from jsteiner/database_cleaner.rb
Database Cleaner
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each) do
DatabaseCleaner.strategy = :transaction
end
config.before(:each, js: true) do

Part1 Software Engineering Basics

  • How to create a Git remote branch? And how to delete it?
  • What is git rebase and how can it be used to resolve conflicts in a feature branch before merge?
  • What is Git Flow and GitHub Flow ? Briefly describe how it works.

Part2 Web Development Basics

  • List at least 3 HTTP response codes, and describe their meanings.
  • What is JSON format? What are the benefits of using it?
@joe11051105
joe11051105 / gist:00ced47ea536ea506a9a46d8862c7fc0
Created February 21, 2017 09:33 — forked from pbiggar/gist:3166676
Sample circle.yml file
########################
# Customize the test machine
########################
machine:
# Set the timezeone - any value from /usr/share/zoneinfo/ is valid here
timezone:
America/Los_Angeles
# Version of ruby to use
@joe11051105
joe11051105 / base_controller.rb
Created May 17, 2017 07:37 — forked from dhoelzgen/base_controller.rb
CORS in Rails 4 APIs
class API::V1::BaseController < ApplicationController
skip_before_filter :verify_authenticity_token
before_filter :cors_preflight_check
after_filter :cors_set_access_control_headers
def cors_set_access_control_headers
headers['Access-Control-Allow-Origin'] = '*'
headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'