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
| <?php | |
| $useCache = true; | |
| if ($useCache){ | |
| if (isset($_SERVER['REQUEST_URI']) && $_SERVER['REQUEST_URI']!="/"){ | |
| $cacheName=str_replace('/','-',$_SERVER['REQUEST_URI']); | |
| $cacheName = substr($cacheName,1); | |
| }else{ | |
| $cacheName='site-index.html'; | |
| } | |
| $cacheFile = "cache/{$cacheName}"; |
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
| set :application, "myapp" | |
| set :keep_releases, 5 | |
| # git options | |
| set :scm, "git" | |
| set :repository, "git://github.com/georgeguimaraes/myapp.git" | |
| set :branch, "master" | |
| set :deploy_via, :remote_cache | |
| # deploy credentials |
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
| // http://www.learningjquery.com/2008/08/quick-tip-dynamically-add-an-icon-for-external-links | |
| $(document).ready(function() { | |
| $('#extlinks a').filter(function() { | |
| return this.hostname && this.hostname !== location.hostname; | |
| }).after(' <img src="/images/external.png" alt="external link"/>'); | |
| }); |
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
| # Removendo porcarias | |
| run "rm README" | |
| run "rm public/index.html" | |
| run "rm public/favicon.ico" | |
| run "rm public/robots.txt" | |
| # Git | |
| git :init | |
| file(".gitignore") do | |
| <<-EOF |
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
| class ApplicationController < ActionController::Base | |
| before_filter :set_application | |
| private | |
| def set_current_account | |
| @current_account = Account.find_by_subdomain(request.subdomains.first) | |
| end | |
| end | |
| class CustomersController < ApplicationController |
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 'time' | |
| def average_time_of_day(times) | |
| clean = Array.new | |
| times.each do |t| | |
| parsed = Time.parse(t) | |
| parsed += (60*60*24) if parsed < Time.now | |
| clean.push(parsed) | |
| end | |
| clean[ (clean.count / 2.0).ceil - 1 ].strftime("%I:%M%p") | |
| 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
| PS1="\\w:\$(git branch 2>/dev/null | grep '^*' | colrm 1 2)\$ " |
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
| run 'gem sources -a http://gemcutter.org' | |
| git :init | |
| file '.gitignore', <<TXT | |
| log/*.log | |
| tmp/**/* | |
| db/*.sqlite3 | |
| .DT_Store | |
| TXT |
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
| Rails CMS alternatives | |
| ====================== | |
| Active projects: | |
| --------------- | |
| adva-cms | |
| repo: http://github.com/svenfuchs/adva_cms/ | |
| site: http://adva-cms.org/ | |
| Last update: 11/24/09 | |
| "the cutting edge Rails CMS platform" |