Unsere Setup-Routine für eine Rails-App mit Nginx, Passenger, rvm auf einen Host Europe-VPS mit Ubuntu 10.4.
apt-get update
apt-get install -y build-essential bison openssl libreadline5 libreadline5-dev curl \
# These are my notes from the PragProg book on CoffeeScript of things that either | |
# aren't in the main CS language reference or I didn't pick them up there. I wrote | |
# them down before I forgot, and put it here for others but mainly as a reference for | |
# myself. | |
# assign arguments in constructor to properties of the same name: | |
class Thingie | |
constructor: (@name, @url) -> | |
# is the same as: |
Handle global ajax errors with jQuery: | |
$(document).ajaxError (xhr, status, error) => | |
console.log("Global ajaxError", arguments) | |
if xhr.status is 403 | |
window.location = "http://backend.myapp.com/login" | |
Handle individual jQuery ajax requests: | |
$.ajax( | |
url: url |
# Render Partials in ECO-Templates like in Rails-ERB | |
# | |
# usefull to clean up structure in spine.js and other js-mvc´s like backbone | |
# | |
# usage: | |
# <%- render_partial 'path/to/partial' %> .. will render ../spine-app/views/path/to/_partial.jst.eco | |
# <%- render_partial 'path/to/partial', foo: 'bar' %> .. will render ../spine-app/views/path/to/_partial.jst.eco .. locals = @foo | |
# | |
window.render_partial = ( path, options = {} ) -> | |
# add the leading underscore (like rails-partials) |
class App.Root extends Spine.Stack | |
controllers: | |
resources: App.Resources | |
users: App.Users | |
routes: | |
'/resources' : 'resources' | |
'/users' : 'users' | |
default: 'users' |