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/
mkdir -p /usr/local/etc/nginx/sites-{enabled,available}
File locations:
nginx.conf to /usr/local/etc/nginx/default and default-ssl to /usr/local/etc/nginx/sites-availablehomebrew.mxcl.nginx.plist to /Library/LaunchDaemons/The normal controller/view flow is to display a view template corresponding to the current controller action, but sometimes we want to change that. We use render in a controller when we want to respond within the current request, and redirect_to when we want to spawn a new request.
The render method is very overloaded in Rails. Most developers encounter it within the view template, using render :partial => 'form' or render @post.comments, but here we'll focus on usage within the controller.
| class ActionDispatch::Routing::Mapper | |
| def draw(routes_name) | |
| instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb"))) | |
| end | |
| end | |
| BCX::Application.routes.draw do | |
| draw :api | |
| draw :account | |
| draw :session |
| # Speed things up by not loading Rails env | |
| config.assets.initialize_on_precompile = false |
| directory = '~/Development/Work/gart360-web' | |
| url = 'http://gart.dev:3000' | |
| before { run "cd #{directory}" } | |
| run 'fs' | |
| tab do | |
| run "tlog" | |
| end |
| 1. install bakcup and whenever gem | |
| ``` | |
| gem 'backup' | |
| gem 'whenever' | |
| ``` | |
| 2. capistrano task(for uploading config file, put it to lib/capistrano/tasks/backup.rake) | |
| ``` | |
| namespace :backup do |
there are two ways to passing args to rake task
please refer to https://itshouldbeuseful.wordpress.com/2011/11/07/passing-parameters-to-a-rake-task/
$ rake say_hello[eddie], or rake say_hello name='eddie'
desc 'say hello'
task :say_hello1 do
name = ENV['name']
puts "Hello, #{name}."
end
| Snippets: | |
| jQuery.logThis = function( text ){ | |
| if( (window['console'] !== undefined) ){ | |
| console.log( text ); | |
| } | |
| } |
| public interface IRepository<T>: IDisposable where T : class | |
| { | |
| /// <summary> | |
| /// Gets all objects from database | |
| /// </summary> | |
| IQueryable<T> All(); | |
| /// <summary> | |
| /// Gets objects from database by filter. | |
| /// </summary> |