This file contains hidden or 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
| <table> | |
| <% cache do %> | |
| <% @posts.each do |post| %> | |
| <tr> | |
| <td><strong><%= post.title %></strong></td> | |
| </tr> | |
| <tr> | |
| <td><em>Posted: <%= post.created_at.strftime('%a %d %B %Y - %H:%M') %></em></td> | |
| </tr> | |
| <tr> |
This file contains hidden or 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 | |
| set -e | |
| # Feel free to change any of the following variables for your app: | |
| TIMEOUT=${TIMEOUT-60} | |
| APP_ROOT=/home/you/apps/app_name/current | |
| PID=$APP_ROOT/tmp/pids/unicorn.pid | |
| CMD="cd $APP_ROOT; bundle exec unicorn -D -c $APP_ROOT/config/unicorn.rb -E production" | |
| AS_USER=andy | |
| set -u |
This file contains hidden or 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
| root = "/home/you/apps/appname/current" | |
| working_directory root | |
| pid "#{root}/tmp/pids/unicorn.pid" | |
| stderr_path "#{root}/log/unicorn.log" | |
| stdout_path "#{root}/log/unicorn.log" | |
| listen "/tmp/unicorn.your_user_name.sock" | |
| worker_processes 2 | |
| timeout 30 |
This file contains hidden or 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
| upstream unicorn { | |
| server unix:/tmp/unicorn.your_user.sock fail_timeout=0; | |
| } | |
| server { | |
| listen 80 default deferred; | |
| # server_name example.com; | |
| root /home/andy/apps/you/current/public; | |
| location ^~ /assets/ { |
This file contains hidden or 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 "bundler/capistrano" | |
| server "176.xx.xx.xx", :web, :app, :db, primary: true | |
| set :application, "your app" | |
| set :user, "your user" | |
| set :deploy_to, "/home/#{user}/apps/#{application}" | |
| set :deploy_via, :remote_cache | |
| set :use_sudo, false |
This file contains hidden or 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' | |
| require 'find' | |
| require 'rdiscount' | |
| def get_files(path) | |
| dir_list_array = Array.new | |
| Find.find(path) do |f| | |
| dir_list_array << File.basename(f, ".*") if !File.directory?(f) | |
| end |
This file contains hidden or 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
| <ul> | |
| <% @arr.each do |page| %> | |
| <li><a href="/view/<%=page%>"><%=formatter(page) %></a></li> | |
| <% end %> | |
| </ul> |
This file contains hidden or 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
| helpers do | |
| def formatter(page) | |
| formatted = "" | |
| formatted = page.gsub(/[-]/, ' ').capitalize | |
| return formatted | |
| end | |
| end |
This file contains hidden or 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
| get '/about' do | |
| #if you don't want to use Markdown for pages, do this: | |
| #erb :"pages/about" | |
| #Then create about.erb in views/pages | |
| markdown :"pages/about", :layout_engine => :erb | |
| end |
This file contains hidden or 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
| not_found do | |
| erb :missing | |
| end |