FridayHug.com http://fridayhug.com
The Smallest Rails App http://thesmallestrailsapp.com
%w(action_controller/railtie coderay).each &method(:require)| #!/usr/bin/env ruby | |
| # | |
| # A complete URL-shortening web application, written in Ruby/Sinatra. Run it | |
| # from the command line, and then visit http://localhost:4567/ | |
| # | |
| # Or to run it under apache/passenger, you'll need a config.ru file with the | |
| # following contents: | |
| # | |
| # require 'tinyurl' | |
| # run Sinatra::Application |
| // ---------------------------------------------------------- | |
| // A short snippet for detecting versions of IE in JavaScript | |
| // without resorting to user-agent sniffing | |
| // ---------------------------------------------------------- | |
| // If you're not in IE (or IE version is less than 5) then: | |
| // ie === undefined | |
| // If you're in IE (>=5) then you can determine which version: | |
| // ie === 7; // IE7 | |
| // Thus, to detect IE: | |
| // if (ie) {} |
| #!/usr/bin/ruby | |
| require 'yaml' | |
| # DATA is a little-used feature of the Ruby language; it's a file handle | |
| # whose contents are everything in the current file after the __END__. | |
| # YAML is "Yet Another Markup Language". | |
| data = YAML.load(DATA) | |
| def url_for(entry_num) |
FridayHug.com http://fridayhug.com
The Smallest Rails App http://thesmallestrailsapp.com
%w(action_controller/railtie coderay).each &method(:require)| git :init | |
| git add: "." | |
| git commit: %Q{ -m 'Initial commit' } | |
| # Twitter bootstrap baby | |
| gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git' | |
| # Incase you want less | |
| gem 'less-rails' | |
| # jQuery is the win | |
| gem 'jquery-rails' |
| # coding: utf-8 | |
| # This is a Rails init template | |
| # Usage | |
| # | |
| # $ rails new app_name -d postgresql -m https://raw.github.com/gist/3303948 --skip-bundle | |
| # | |
| # remove files | |
| run "rm README.rdoc" | |
| run "touch README.md" |
| ## Rails App Template | |
| ## Updated for Rails 3.2.8 | |
| ## Updated on 9/24/12 | |
| ## Run using $ rails new [appname] -JT -m https://raw.github.com/gist/960988/template.rb | |
| ## Gems | |
| # General | |
| gem 'rake', '0.9.2.2' | |
| # Warden and Devise for security |
| # add gems | |
| gem 'whenever' | |
| gem 'kaminari' | |
| gem 'hpricot' | |
| gem 'ruby_parser' | |
| gem 'jquery-rails' | |
| gem "jquery-ui-rails" | |
| gem 'bcrypt-ruby', '~> 3.0.0' | |
| gem "rspec-rails", :group => [ :development, :test ] | |
| gem "ffaker", :group => :test |
| # Helpers | |
| def git_update(message) | |
| git :add => ".", :commit => "-m '#{message}'" | |
| end | |
| def git_remove(file) | |
| git :rm => file | |
| end |
| # Update, upgrade and install development tools: | |
| sudo apt-get update | |
| sudo apt-get -y upgrade | |
| sudo apt-get -y install build-essential git-core libssl-dev libsqlite3-dev curl nodejs nginx | |
| # Install rbenv | |
| git clone git://github.com/sstephenson/rbenv.git ~/.rbenv | |
| # Add rbenv to the path: | |
| echo 'export RBENV_ROOT=~/.rbenv' >> ~/.bash_profile |