1.Inside your Gemfile add the following:
gem “cocoon”
2.Add the following to application.js so it compiles to the asset pipeline:
//= require cocoon
3.model文件中添加(一级)
accepts_nested_attributes_for :tasks, allow_destroy: true
Every day to be a little better
1.Inside your Gemfile add the following:
gem “cocoon”
2.Add the following to application.js so it compiles to the asset pipeline:
//= require cocoon
3.model文件中添加(一级)
accepts_nested_attributes_for :tasks, allow_destroy: true
1.在view表单中添加下拉单, :multiple => true, 选择一个数组
1 | <div class="control-group"> |
1.添加Gemfile (bundle install)
group :development
gem ‘capistrano’, ‘2.12.0’
gem ‘capistrano-rbenv’, ‘1.0.1’
end
2.运行 $ capify . (会生成两个文件)
$ capify .
capify .
[skip] ‘./Capfile’ already exists
[skip] ‘./config/deploy.rb’ already exists
[done] capified!
会生成两个关键性的文件: Capfile , config/deploy.rb
下面是一个完整的 部署脚本( config/deploy.rb )的例子, 修改其中的 用户名,端口号, 目标服务器的域名 , 服务器的启动方式, 就可以直接运行了.:
require ‘capistrano-rbenv’
load ‘deploy/assets’
SSH_USER = ‘你的用户名’
SSH_PORT = ‘你的端口号’
server = “目标服务器的域名或者ip”
FOLDER_IN_REMOTE_SERVER = ‘远程服务器上的目标文件夹’
ssh_options[:port] = SSH_PORT
set :rake, “bundle exec rake”
set :application, “app name”
set :repository, “.”
set :scm, :none
set :deploy_via, :copy
role :web, server
role :app, server
role :db, server, :primary => true
role :db, server
set :deploy_to, FOLDER_IN_REMOTE_SERVER
default_run_options[:pty] = true
set :user, SSH_USER
namespace :deploy do
task :start do
run “cd #{release_path} && bundle exec thin start -C config/thin.yml”
end
task :stop do
run “cd #{release_path} && bundle exec thin stop -C config/thin.yml”
end
task :restart, :roles => :app, :except => { :no_release => true } do
db_migrate
stop
sleep 2
start
end
task :db_migrate do
run “cd #{release_path} && bundle install”
run “cd #{release_path} && bundle exec rake db:migrate RAILS_ENV=production”
end
namespace :assets do
task :precompile do
#run “bundle install”
#run “cd #{release_path} && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile “
end
end
end
desc “Copy database.yml to release_path”
task :cp_database_yml do
puts “=== executing my customized command: “
run “cp -r #{shared_path}/config/* #{release_path}/config/“
run “ln -s #{shared_path}/files #{release_path}/public/files”
run “rm #{release_path}/public/uploads -rf”
run “ln -s #{shared_path}/public/uploads #{release_path}/public/uploads”
puts “=== done (executing my customized command)”
end
before “deploy:assets:precompile”, :cp_database_yml
#after “deploy”, “deploy:restart”
第一次运行时,要先 配置好目标服务器上的文件夹.
$ cap deploy:setup
注意: 这里让它创建基本的目标文件夹目录层次就可以:
/opt/app:
current (这是个软链接 soft link, )-> /opt/app/releases/20150518030114/
releases/
shared/
assets
config
files
log
pids
public
system
为 shared 目录下,增加各种配置文件,它们只需要被配置一遍。例如:
config/thin.yml # 服务器的配置
config/database.yml # 数据库的配置
config/log4r.yml # 日志文件的配置
config/settings.yml # 系统的配置
配置好ruby环境, mysql, thin, nginx 等
开始部署
$ bundle exec cap deploy.
这个命令会执行下面的过程:
准备启动服务器:
安装各种新增的rubygem
做必要的数据库迁移
配置各种文件
修改上传文件夹的softlink
其他,每次使用裸代码做部署的时候,都要人肉做的事情. (修改保存日志的路径, 修改 rails server的配置, )
编译,压缩 js/ css
重启 服务器( $ nginx -s reload, $ kill -9 xxx , $ thin start -C config/thin.yml)
正常来说只要按照阿里云给的说明配置就可以了 但是会遇到很多神奇的坑
如下:
1.Nginx配置的时候要在服务器上查询 使用的Nginx文件位置
which nginx
2.遇到ssl不识别的问题就要重新编译
1 | $./configure –prefix=/usr/local/nginx/ –with-http_ssl_module |
注意:1)在编译之前需要将Nginx先停掉
如果Nginx文件已经配置完无法停掉时,就将ssl相关代码注释掉之后再编译
2)编译需要有源代码的情况下
如果没有就要去官网上下载一个
用命令下载并解压下下来的tar.gz文件
1 | $wget 网址 |
3.端口必须用443
1.npm install vuex –verbose
2.将App.vue 更名为 main.vue
3.将main.js中引用文件改成main.vue
4.新建views 和 vuex 文件夹。并将vuex中文件导入
5.测试
在main.vue 中引用 然后用mounted函数console.info
1.在远程(coding.net/github)上面先建立一个项目
2.安装cli
npm install -g vue-cli
3.建立vue.js项目
vue init webpack 文件名
4.npm install
5.git init
git add .
git commit -m”init commit”
git remote add origin 远程网址
git pull origin master
git push -u origin master
6.添加Gemfile
1 | source 'https://ruby.taobao.org/' |
然后bundle
7.添加deploy文件 capify .
7.添加deploy.rb里面脚本内容
8.cap deploy:setup
9.cap deploy
10.到远程配置Nginx
进到/etc/nginx-1.11.10/conf/nginx.conf 里面
更改server下面的listen端口号
更改server下面的location的root
本地运行vue项目
1.npm install
2.npm run dev
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithWebRoute:@"interface/categories"]]];
NSData *response = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
NSError *error;
responseHash = [NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableLeaves error:&error];
ps:stringWithWebRoute 是一个自定义的方法
+(NSString)stringWithWebRoute:(NSString)route
{
return [NSString stringWithRoute:route domainName:WEB_SERVER andId:YES];
}
后面接的是web接口的地址
self.navigation = (CustomNavigationController*) self.navigationController;
查看navigation是否为空
po self.navigation
ps:一般在ios webview中没有特殊报错,但是又无法实现功能时
经常是navigation为空,在(void)viewDidLoad中声明一下就好了
Markdown 是一种轻量级的「标记语言」,它的优点很多,目前也被越来越多的写作爱好者,撰稿者广泛使用。看到这里请不要被「标记」、「语言」所迷惑,Markdown 的语法十分简单。常用的标记符号也不超过十个,这种相对于更为复杂的HTML 标记语言来说,Markdown 可谓是十分轻量的,学习成本也不需要太多,且一旦熟悉这种语法规则,会有一劳永逸的效果。
授权秘钥:
GBPduHjWfJU1mZqcPM3BikjYKF6xKhlKIys3i1MU2eJHqWGImDHzWdD6xhMNLGVpbP2M5SN6bnxn2kSE8qHqNY5QaaRxmO3YSMHxlv2EYpjdwLcPwfeTG7kUdnhKE0vVy4RidP6Y2wZ0q74f47fzsZo45JE2hfQBFi2O9Jldjp1mW8HUpTtLA2a5/sQytXJUQl/QKO0jUQY4pa5CCx20sV1ClOTZtAGngSOJtIOFXK599sBr5aIEFyH0K7H4BoNMiiDMnxt1rD8Vb/ikJdhGMMQr0R4B+L3nWU97eaVPTRKfWGDE8/eAgKzpGwrQQoDh+nzX1xoVQ8NAuH+s4UcSeQ==
工具茫茫多
标题有六级
由 # 组成
类比于 h1 ~ h6
1 | # 这是一级标题(H1,通常用于文档标题) |
注:在#后加一个空格再跟标题
写文章时,我们常常希望能够首行缩进,这时可以在段首加入 
或 
来输入一个空格.加入 
来输入两个空格。这里的空格是英文状态的空格,英文状态的两个空格相当于中文状态的一个空格
添加空行可以结束先前的格式状态。个人建议在改变格式时,均添加一个空行
文本
1 | >引用状态 |
效果
引用状态
换行的时候 结尾要加上 两个空格。
斜体:使用 两个星号 **
中间夹杂的就是 斜体, 例如:斜体
粗体: 使用 四个星号 ****
中间夹杂的就是 粗体, 例如:粗体
使用 + - *
都表示无序列表
注:后面也需要跟一个空格
例如:
使用 1. 2. 3.
可以表示有序列表
注:后面也需要跟一个空格
例如:
使用 >
表示引用
海明威曾经写过:我可以被杀死,但是不可以被打败
默认对齐 | 居左对齐 | 居中对齐 | 居右对齐 |
---|---|---|---|
窗前 | 明月 | 光 | , |
疑是 | 地上 | 霜 | , |
姓名 | 性别 | 年纪 | 班级 |
---|---|---|---|
张三 | 男 | 29 | 0830 |
李四 | 女 | 28 | 0830 |
时间 | 地点 | 人物 | 事件事件事件事件事件事件事件 |
---|---|---|---|
上午 | 北京 | 我 | 吃面 |
注:表格开始与结尾都需要一行空行
插入代码的方式有两种
1 |
|
许多 MarkDown 编辑器中直接按原图大小显示图片,造成版面凌乱。使用该命令<img src="图片地址" width="图片显示宽度" height="显示高度" alt="图片名称"/>
设置图片大小,再用<div style="text-align:center"></div>
命令包裹达到居中效果。
简书 http://www.jianshu.com/
github https://github.com/