Some CoffeeScript (verbosely commented for clarity)
# Override Rails handling of confirmation
$.rails.allowAction = (element) ->
# The message is something like "Are you sure?"
message = element.data('confirm')
Tested on: Rails 3.1, Mongoid 2.0.1, pg 0.12.0 gem | |
Migrate from Mongo to PG | |
1. remove mongoid gem | |
2. add pg gem | |
3. in application.rb re-add ActiveRecord | |
4. for all models | |
- inherit from ActiveRecord::Base | |
- get rid of Mongoid:Document line | |
- make migrations and put fields there |
class Api::RegistrationsController < Api::BaseController | |
respond_to :json | |
def create | |
user = User.new(params[:user]) | |
if user.save | |
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201 | |
return | |
else |
require 'active_record' | |
require 'yaml' | |
require 'mysql' | |
require 'logger' | |
task :default => :migrate | |
desc "Migrate the database through scripts in db/migrate. Target specific version with VERSION=x" | |
task :migrate => :environment do | |
ActiveRecord::Migrator.migrate('db/migrate', ENV["VERSION"] ? ENV["VERSION"].to_i : nil ) |
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: nginx | |
# Required-Start: $local_fs $remote_fs $network $syslog | |
# Required-Stop: $local_fs $remote_fs $network $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the nginx web server | |
# Description: starts nginx using start-stop-daemon |
Note that this validation runs both after the file is uploaded and after CarrierWave has processed the image. If your base uploader includes a filter to resize the image then the validation will be run against the resized image, not the original one that was uploaded. If this causes a problem for you, then you should avoid using a resizing filter on the base uploader and put any specific size requirements in a version instead.
So instead of this:
require 'carrierwave/processing/mini_magick'
#!/bin/bash | |
echo "Updating Packages..." | |
apt-get -qq -y update | |
echo "Installing Vim..." | |
apt-get -qq -y install vim-gnome | |
echo "Installing Utilities..." | |
apt-get -qq -y install curl bison build-essential zlib1g-dev libssl-dev libreadline5-dev libxml2-dev |
111 o.......在已有窗口中打开文件、目录或书签,并跳到该窗口 .....|NERDTree-o| | |
112 go......在已有窗口中打开文件、目录或书签,但不跳到该窗口 .....|NERDTree-go| | |
113 t.......在新Tab中打开选中文件/书签,并跳到新Tab .....|NERDTree-t| | |
114 T.......在新Tab中打开选中文件/书签,但不跳到新Tab .....|NERDTree-T| | |
115 i.......split一个新窗口打开选中文件,并跳到该窗口 .....|NERDTree-i| | |
116 gi......split一个新窗口打开选中文件,但不跳到该窗口 .....|NERDTree-gi| | |
117 s.......vsp一个新窗口打开选中文件,并跳到该窗口 .....|NERDTree-s| | |
118 gs......vsp一个新窗口打开选中文件,但不跳到该窗口 .....|NERDTree-gs| | |
119 !.......执行当前文件 .....|NERDTree-!| | |
120 O.......递归打开选中结点下的所有目录 .....|NERDTree-O| |
推荐几个个人必看的: | |
1. http://perfectionkills.com/ | |
2. http://davidwalsh.name/ | |
3. http://ejohn.org/ | |
4. http://www.nczonline.net/ | |
他们分别是 prototype, mootools, jquery, yui 的团队核心成员,文章质量都很高,并且比较活跃。 |
Installing Ruby Enterprise Edition, Apache, MySQL, and Passenger for deploying Rails 3.0 applications.
Get a Linode, and set it up with Ubuntu 10.04 LTS so that you have till April 2013 to get updates. Once the Linode is formatted, boot it and continue on.
Set up an 'A' record in your DNS, pointing to the IP of your Linode. I'm using demo.napcs.com
here.