application.rb中
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Gcp
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake …Run Code Online (Sandbox Code Playgroud) 我一直在玩这些模型.
我正在使用设计
我的架构:
create_table "complaints", force: :cascade do |t|
t.string "title"
t.text "complaint_info"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "user_id"
end
add_index "complaints", ["user_id"], name: "index_complaints_on_user_id", using: :btree
create_table "users", force: :cascade do |t|
...
end
Run Code Online (Sandbox Code Playgroud)
投诉模式:
class Complaint < ActiveRecord::Base
belongs_to :user
validates :title, presence: true
end
Run Code Online (Sandbox Code Playgroud)
用户型号:
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
has_many :complaints
end …Run Code Online (Sandbox Code Playgroud) 我正在关注需要我快速安装的MEAN堆栈教程:
我运行这个:
npm install -g express-generator
这是我的结果:
username@username-Inspiron-3521:~$ npm install -g express-generator
/home/username/npm/bin/express -> /home/username/npm/lib/node_modules/express-generator/bin/express
express-generator@4.13.1 /home/username/npm/lib/node_modules/express-generator
??? sorted-object@1.0.0
??? mkdirp@0.5.1 (minimist@0.0.8)
??? commander@2.7.1 (graceful-readlink@1.0.1)
Run Code Online (Sandbox Code Playgroud)
但是当我这样做的时候
express --ejs flapper-news
The program 'express' is currently not installed. You can install it by typing:
sudo apt-get install node-express
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
谢谢你的时间.
编辑
当我做 npm install
username@username-Inspiron-3521:~/Documents/mean/flapper_news$ npm install
npm ERR! install Couldn't read dependencies
npm ERR! Linux 3.16.0-51-generic
npm ERR! argv "/home/username/local/bin/node" "/home/username/local/bin/npm" "install"
npm ERR! node v4.2.1
npm ERR! npm v2.14.7
npm …Run Code Online (Sandbox Code Playgroud) 我目前正在尝试以固定的价格制作“立即购买”按钮。
用户付款后,我想将它们重定向到根URL并向他们发送带有附件PDF文件的电子邮件。
我一直在研究如何使用Paypal创建简单的结帐,但是没有成功,我发现使用了多年的教程已经过时了,其中一些代码已被弃用。
我已经尝试过使用BRAINTREE,它在测试/沙盒中效果很好,但是由于我目前居住在波多黎各,所以我无法创建生产帐户(这限制了我在支付网关上的选择)。
到目前为止我做了什么
跟随教程
我创建了一个支架的products使用name和unit_price
在我的product模型中:
# This defines the paypal url for a given product sale
def paypal_url(return_url)
values = {
:business => YOUR_MERCHANT_EMAIL,
:cmd => '_cart',
:upload => 1,
:return => return_url,
:invoice => UNIQUE_INTEGER
}
values.merge!({
"amount_1" => unit_price,
"item_name_1" => name,
"item_number_1" => id,
"quantity_1" => '1'
})
# This is a paypal sandbox url and should be changed for production.
# Better define this url in …Run Code Online (Sandbox Code Playgroud) 我一直在关注 Facebook 的 ReactJS 教程
我安装了npm install -g create-react-app https://www.npmjs.com/package/react-scripts并用它创建了应用程序
但现在我很困惑如何将我的应用程序部署到例如数字海洋?我知道我可以用来pm2运行节点服务器,但我不知道它是如何npm start工作的,因为它只是在 package.json 中运行它
{
"name": "hello-world",
"version": "0.1.0",
"private": true,
"devDependencies": {
"react-scripts": "0.7.0"
},
"dependencies": {
"babel-preset-es2015": "^6.18.0",
"babel-preset-react": "^6.16.0",
"express": "^4.14.0",
"mongoose": "^4.6.8",
"react": "^15.3.2",
"react-dom": "^15.3.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
Run Code Online (Sandbox Code Playgroud)
"start": "react-scripts start"它实际上从那里开始是什么?
另外,它说要构建您的应用程序以供部署使用npm run build,只会给我一个名为的文件夹build,但我找不到任何可以运行的内容node。
我正在尝试为某种类型的IDE尝试VIM,我已经安装了vimrc,因为它看起来很不错.
我缺少的是linting配置语法错误,什么不是,某种intellisense(我认为vim-javascript的确如此).
根据我的阅读,vim-pathogen是安装vim特定插件的方法.
我已经按照vim-javascript中的文档介绍了如何使用病原体进行安装.我注意到安装后我看到文字颜色不同但我仍然没有得到任何类型的自动完成.
我尝试将配置添加到我的.vimrc文件中,但我不认为我做得对.
这是它的样子:
set runtimepath+=~/.vim_runtime
execute pathogen#infect()
source ~/.vim_runtime/vimrcs/basic.vim
source ~/.vim_runtime/vimrcs/filetypes.vim
source ~/.vim_runtime/vimrcs/plugins_config.vim
source ~/.vim_runtime/vimrcs/extended.vim
let g:javascript_plugin_jsdoc = 1
let g:javascript_plugin_ngdoc = 1
let g:javascript_plugin_flow = 1
set foldmethod=syntax
try
source ~/.vim_runtime/my_configs.vim
catch
endtry
Run Code Online (Sandbox Code Playgroud) javascript ×2
node.js ×2
reactjs ×2
angular ×1
angular-cli ×1
apollo ×1
devise ×1
express ×1
heroku ×1
mean-stack ×1
npm ×1
paypal ×1
react-apollo ×1
ruby ×1
typescript ×1
vim ×1
vim-plugin ×1