This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo apt-get install build-essential libsqlite3-dev zlib1g-dev libncurses5-dev libgdbm-dev libbz2-dev libreadline5-dev libssl-dev libdb-dev | |
| wget http://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz | |
| tar -xzf Python-2.7.9.tgz | |
| cd Python-2.7.9 | |
| ./configure --prefix=/usr --enable-shared | |
| make | |
| sudo make install | |
| cd .. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var gulp = require('gulp'); | |
| var browserify = require('browserify'); | |
| var reactify = require('reactify'); | |
| var del = require('del'); | |
| var source = require('vinyl-source-stream'); | |
| var sass = require('gulp-sass'); | |
| var sourcemaps = require('gulp-sourcemaps') | |
| var paths = { | |
| SCSS: ['app/css/**/*.scss'], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def new | |
| @form = flash[:new_fund_password_form] || NewFundPasswordForm.new | |
| end | |
| def create | |
| @form = NewFundPasswordForm.new(new_fund_password_params) | |
| if @form.save | |
| flash[:notice] = I18n.t('fund_passwords.new.success') | |
| redirect_to account_path | |
| else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 线程池最小为 1,最大为 8 | |
| threads 1, 8 | |
| # 进程池大小为 3,即应用服务器的 CPU 数 + 1 | |
| workers 3 | |
| # == 线程安全性: | |
| # | |
| # - ActiveRecord 会通过连接池保证线程安全,在没有 preload_app 时,不需要重新连接。 | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Verify Git is installed: | |
| if [ ! $(which git) ]; then | |
| echo "Git is not installed, can't continue." | |
| exit 1 | |
| fi | |
| if [ -z "${RBENV_ROOT}" ]; then | |
| RBENV_ROOT="$HOME/.rbenv" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| install_package "yaml-0.1.5" "http://pyyaml.org/download/libyaml/yaml-0.1.5.tar.gz#24f6093c1e840ca5df2eb09291a1dbf1" --if needs_yaml | |
| install_package "openssl-1.0.1e" "https://www.openssl.org/source/openssl-1.0.1e.tar.gz#66bf6f10f060d561929de96f9dfe5b8c" mac_openssl --if has_broken_mac_openssl | |
| install_package "ruby-2.1.0" "http://ruby.taobao.org/mirrors/ruby/ruby-2.1.0.tar.gz" ldflags_dirs standard verify_openssl |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Verify Git is installed: | |
| if [ ! $(which git) ]; then | |
| echo "Git is not installed, can't continue." | |
| exit 1 | |
| fi | |
| if [ -z "${RBENV_ROOT}" ]; then | |
| RBENV_ROOT="$HOME/.rbenv" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 | |
| sudo sh -c "echo deb http://get.docker.io/ubuntu docker main\ | |
| > /etc/apt/sources.list.d/docker.list" | |
| sudo apt-get update | |
| # install the backported kernel | |
| sudo apt-get install linux-image-generic-lts-raring linux-headers-generic-lts-raring | |
| sudo apt-get install lxc-docker |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| >>> from collections import defaultdict | |
| >>> d = defaultdict(lambda: []) | |
| >>> d | |
| defaultdict(<function <lambda> at 0x1004999b0>, {}) | |
| >>> d['a'].append(1) | |
| >>> d | |
| defaultdict(<function <lambda> at 0x1004999b0>, {'a': [1]}) | |
| >>> d['b'] | |
| [] | |
| >>> d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 2.0.0-p247 :001 > h = Hash.new([]) | |
| => {} | |
| 2.0.0-p247 :002 > h[:a] << 1 | |
| => [1] | |
| 2.0.0-p247 :003 > h | |
| => {} | |
| 2.0.0-p247 :004 > h[:a] | |
| => [1] | |
| 2.0.0-p247 :005 > h | |
| => {} |