class App < Sinatra::Base
register 'sinatra/jstsupport'
serve_jst '/jst.js'
end
This serves all JST files found in /views/**/*.jst.*
as /jst.js
.
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." |
$ ruby -e 'exit' | |
$ echo $? | |
0 | |
$ ruby -e 'exit 1' | |
$ echo $? | |
1 | |
$ ruby -e 'abort "oh no"' | |
oh no | |
$ echo $? | |
1 |
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 |
$ 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 |
+----------+ | |
| | | |
| User | | |
| | | |
+----------+ | |
^ | |
| | |
(B) | |
+----+------+ Client Identifier +---------------+ | |
| +----(A)--- & Redirect URI ------>| | |
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) |
[ -f ~/.git-bash-completion.sh ] && . ~/.git-bash-completion.sh | |
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session. | |
[[ -s /Users/jcrt/.rvm/scripts/rvm ]] && source /Users/jcrt/.rvm/scripts/rvm | |
function git_branch { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return; | |
echo "("${ref#refs/heads/}") "; | |
} |
#!/bin/bash | |
# | |
# DESCRIPTION: | |
# | |
# Set the bash prompt according to: | |
# * the branch/status of the current git repository | |
# * the branch of the current subversion repository | |
# * the return value of the previous command | |
# | |
# USAGE: |
error do | |
exception = request.env['sinatra.error'] | |
Hoptoad::Notifier.send_error exception, params, request.env if %w(staging production).include?(ENV['RACK_ENV']) | |
erb :five_hundred | |
end |