A proof of concept of having Sinatra like routes inside your controllers.
Since the router is gone, feel free to remove config/routes.rb
.
Then add the file below to lib/action_controller/inline_routes.rb
inside your app.
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> | |
<title>Render Multiple Outlets</title> | |
<script src="js/vendor/jquery.js"></script> | |
<script src="js/vendor/handlebars.js"></script> | |
<script src="js/vendor/ember.js"></script> | |
<script src="js/vendor/ember-data.js"></script> | |
</head> |
scope '/api' do | |
resources :users, except: [:edit] | |
end | |
root to: 'ember#index' | |
get '*path' => 'ember#index' |
#!/usr/bin/env ruby | |
require "date" | |
class Fixnum | |
Date::MONTHNAMES[1..-1].each_with_index do |month, index| | |
define_method month.downcase do |year| | |
Date.new(year, index+1, self) | |
end | |
end | |
end |
You wrote:
= hb 'if content.condition1' do
= hb 'if content.condition2' do
%p Some paragraph
= hb 'else'
%p another paragraph
= hb 'else'
%p third paragraph
# Five lines of code that will make your underscore + CoffeeScript use cleaner. | |
# Creates an underscore function for each function in to_reverse with R (short for Reversed) appended to the name. | |
# The R version moves the function argument (first argument in normal underscore) to the end, | |
# so you can write: | |
$(window).scroll _.throttleR 500, -> | |
console.log "This print's at most every 500ms" | |
# Instead of: | |
$(window).scroll _.throttle -> | |
console.log "This prints at most every 500ms too" |
module GGeocode | |
### ref: http://code.google.com/apis/maps/documentation/geocoding/ | |
GGeocode::Version = '0.0.3' | |
def GGeocode.version | |
GGeocode::Version | |
end | |
require 'net/http' |
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
wget http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem | |
wget http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem | |
gem install linecache19-0.5.13.gem | |
gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=$HOME/.rvm/src/ruby-1.9.3-p0 | |
OR if Falcon the last one is use the one below (or whatever) | |
gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=$HOME/.rvm/src/ruby-1.9.3-p0-falcon | |
This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.
You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf
using homebrew.