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
# Update | |
apt-get update | |
apt-get dist-upgrade | |
# Install Apache + PHP5 + Ruby + Passenger | |
apt-get install libapache2-mod-passenger php5 passenger ssh build-essential apache2 apache2-mpm-prefork apache2-prefork-dev ruby1.8-dev irb libopenssl-ruby libreadline-ruby rdoc ri ruby ruby-dev | |
sudo a2enmod rewrite | |
# Install git | |
apt-get install git-core git-svn |
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
# How to give your devise controllers all the same layout (e.g. "authentication" below) | |
class ApplicationController < ActionController::Base | |
layout :setup_layout | |
protected | |
def setup_layout | |
devise_controller? ? "authentication" : "application" | |
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
$(function () { | |
var toc = $("<ul>").css("margin-bottom", "20px !important"); | |
$("div.main div.wikistyle h2").each(function() { | |
var id = $(this).text().replace(/\s+/g, "_").replace(/[^0-9a-zA-Z_.-]/g, "") | |
$(this).attr("id", id) | |
toc.append( | |
$("<li>").append($("<b>").append($("<a>").attr("href", "#" + id).text($(this).text()))) | |
) | |
}); | |
$("div.wikistyle").prepend(toc).prepend($("<h2>").text("Table of Contents")); |
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
#Newbie programmer | |
def factorial(x): | |
if x == 0: | |
return 1 | |
else: | |
return x * factorial(x - 1) | |
print factorial(6) | |
#First year programmer, studied Pascal |
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/bash | |
## | |
# Deployment para Tomcat usando Git | |
## | |
# Configuração | |
WAR_DIR="/home/user/NetBeansProjects/project/dist" | |
WAR_FILE="project.war" | |
GIT_LOCAL="/home/user/git/project" | |
if [ "$1" = "root" ] ; then |
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" |
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
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
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
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 |