$ curl -sSL https://get.docker.com/ubuntu/ | sudo sh
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 ubuntu:14.04 | |
| MAINTAINER kevinclcn@gmail.com | |
| ENV https_proxy <https proxy> | |
| ENV http_proxy <http proxy> | |
| ENV LANG en_US.UTF-8 | |
| RUN apt-get -qy install git curl | |
| RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 && curl -sSL https://get.rvm.io | bash -s stable |
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
| # How to find out where a method comes from. | |
| # Learned this from Dave Thomas while teaching Advanced Ruby Studio | |
| # Makes the case for separating method definitions into | |
| # modules, especially when enhancing built-in classes. | |
| module Perpetrator | |
| def crime | |
| end | |
| end | |
| class Fixnum |
局部变量,实例变量,self都是绑定在对象上的名字,我们简称为绑定(binding)。所有绑定都有一个寄居场所,我们称为作用域(scope)。假设你是一个调试器,你时刻都处于一个作用域中,上下左右都是绑定: 局部变量,实例变量,全局变量,常亮,还有当前对象self。只有当你遇到三个关键字时,才会进入一个新作用域。
这三个改变作用域的关键字, 分别是module,class和def。我们称为作用域的门(scope gate)。
在Java等其他语言里,一个作用域内可以看到外围作用域内的变量,但Ruby不同,一个作用域内只能看到当前作用域内的变量。也就是说,变量不能跨作用域查找。
比如:
mkdir -p /usr/local/etc/nginx/sites-{enabled,available}
File locations:
nginx.confto/usr/local/etc/nginx/defaultanddefault-sslto/usr/local/etc/nginx/sites-availablehomebrew.mxcl.nginx.plistto/Library/LaunchDaemons/
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
| include Rails.application.routes.url_helpers | |
| default_url_options[:host] = "localhost" |
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
| import com.google.common.cache.CacheBuilder; | |
| import org.slf4j.Logger; | |
| import org.slf4j.LoggerFactory; | |
| import org.springframework.cache.CacheManager; | |
| import org.springframework.cache.annotation.CachingConfigurer; | |
| import org.springframework.cache.annotation.EnableCaching; | |
| import org.springframework.cache.guava.GuavaCache; | |
| import org.springframework.cache.interceptor.CacheErrorHandler; | |
| import org.springframework.cache.interceptor.CacheResolver; | |
| import org.springframework.cache.interceptor.KeyGenerator; |
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
| import com.google.common.cache.CacheBuilder; | |
| import org.springframework.cache.Cache; | |
| import org.springframework.cache.annotation.EnableCaching; | |
| import org.springframework.cache.guava.GuavaCache; | |
| import org.springframework.context.annotation.Bean; | |
| import org.springframework.context.annotation.Configuration; | |
| import java.util.concurrent.TimeUnit; | |
| @Configuration |
OlderNewer