This file contains 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
ENV: | |
rvm-ruby 1.9.2 => install dir => gem env | grep 'INSTALLATION DIRECTORY' => rvm-ruby install dir_path | |
rails 3.0.7 | |
CAUSE: | |
run scaffold generator: rails g scaffold modelname column:string ... | |
Fix Steps: | |
1) ensure openssl has been installed => which openssl => /usr/bin/ssl | |
This file contains 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
# | |
# RVM profile | |
# | |
# /etc/profile.d/rvm.sh # sh extension required for loading. | |
# | |
if [ -n "${BASH_VERSION:-}" -o -n "${ZSH_VERSION:-}" ] ; then | |
# Load user rvmrc configurations, if exist | |
for file in /etc/rvmrc "$HOME/.rvmrc" ; do | |
[[ -s "$file" ]] && source $file |
This file contains 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
if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm') | |
begin | |
rvm_path = File.dirname(File.dirname(ENV['MY_RUBY_HOME'])) | |
rvm_lib_path = File.join(rvm_path, 'lib') | |
$LOAD_PATH.unshift rvm_lib_path | |
require 'rvm' | |
RVM.use_from_path! File.dirname(File.dirname(__FILE__)) | |
rescue LoadError | |
# RVM is unavailable at this point. | |
raise "RVM ruby lib is currently unavailable." |
This file contains 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
#!/bin/sh | |
# => /etc/init.d/nginx | |
# => sudo chmod +x /etc/init.d/nginx | |
# => make it start when the server run: /sbin/chkconfig nginx on | |
# => to check it: /sbin/chkconfig --list nginx | |
# nginx - this script starts and stops the nginx daemin | |
# Taken from http://www.hikaro.com | |
# chkconfig: - 85 15 | |
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \ | |
# proxy and IMAP/POP3 proxy server |
This file contains 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
$ ruby -e 'exit' | |
$ echo $? | |
0 | |
$ ruby -e 'exit 1' | |
$ echo $? | |
1 | |
$ ruby -e 'abort "oh no"' | |
oh no | |
$ echo $? | |
1 |
This file contains 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
require 'sinatra' | |
# Set the version of the API being run here | |
# | |
MAJOR_VERSION = 1 | |
MINOR_VERSION = 0 | |
helpers do | |
def version_compatible?(nums) | |
return MAJOR_VERSION == nums[0].to_i && MINOR_VERSION >= nums[1].to_i |
This file contains 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
# config.middleware.insert_after "ActionController::ParamsParser", "Rack::PageGen", :base_dir => '/tmp', :regular => :settings | |
# encoding: utf-8 | |
module Rack | |
class PageGen | |
attr_reader :options | |
def initialize(app, options = {}) | |
@app = app |
This file contains 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
$ cd /usr/src | |
$ wget http://nginx.org/download/nginx-0.8.52.tar.gz | |
$ tar xzvf ./nginx-0.8.52.tar.gz | |
$ rm ./nginx-0.8.52.tar.gz | |
$ gem install s3sync capistrano capistrano-ext passenger --no-ri --no-rdoc | |
$ passenger-install-nginx-module | |
# Automatically download and install Nginx? 2. No: I want to customize my Nginx installation | |
# Where is your Nginx source code located?: /usr/src/nginx-0.8.52 | |
# Where do you want to install Nginx to?: /opt/nginx |
This file contains 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
+----------+ | |
| | | |
| User | | |
| | | |
+----------+ | |
^ | |
| | |
(B) | |
+----+------+ Client Identifier +---------------+ | |
| +----(A)--- & Redirect URI ------>| | |
This file contains 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
module Rack | |
class Callbacks < ::Array | |
DUMMY_APP = proc {|env| } | |
def initialize(app, &block) | |
@app = app | |
instance_eval(&block) if block_given? | |
end | |
def use(middleware, *args, &block) |
OlderNewer