Skip to content

Instantly share code, notes, and snippets.

View pragmaticivan's full-sized avatar
Permanent 418 status code.

Ivan Santos pragmaticivan

Permanent 418 status code.
View GitHub Profile
#...
set :app_path, "#{deploy_to}/#{current_path}"
#...
desc "Deploys the current version to the server."
task :deploy => :environment do
deploy do
#...
// Generated on <%= (new Date).toISOString().split('T')[0] %> using <%= pkg.name %> <%= pkg.version %>
(function () {
"use strict";
module.exports = function (grunt) {
// Project Configuration
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
# Support for Rspec / Capybara subdomain integration testing
# Make sure this file is required by spec_helper.rb
#
# Sample subdomain test:
# it "should test subdomain" do
# switch_to_subdomain("mysubdomain")
# visit root_path
# end
DEFAULT_HOST = "lvh.me"
# Support for Rspec / Capybara subdomain integration testing
# Make sure this file is required by spec_helper.rb
# (e.g. save as spec/support/subdomains.rb)
def switch_to_subdomain(subdomain)
# lvh.me always resolves to 127.0.0.1
hostname = subdomain ? "#{subdomain}.lvh.me" : "lvh.me"
Capybara.app_host = "http://#{hostname}"
end

Install Postgresql on Mountain Lion

Based on: http://coderwall.com/p/1mni7w

brew install postgresql
initdb /usr/local/var/postgres -E utf8
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/postgresql/9.1.4/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
@pragmaticivan
pragmaticivan / deploy.rb
Created February 20, 2013 18:14 — forked from reu/deploy.rb
# Bundler Integration
require "bundler/capistrano"
# Application Settings
set :application, "yourapplicationname"
set :user, "serveruser"
set :deploy_to, "/home/#{user}/rails-applications/#{application}"
set :rails_env, "production"
set :use_sudo, false
set :keep_releases, 3
@pragmaticivan
pragmaticivan / .gitignore
Created November 18, 2012 02:31 — forked from redoPop/.gitignore
Template .gitignore file for WordPress projects
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@pragmaticivan
pragmaticivan / movie.php
Created March 31, 2012 21:59
Movie Helper
class MovieHelper {
/**
* Armazena a opção de hospedagem do video (VIMEO ou Youtube)..
*
* @access public
* @var string
*/
private $location;
@pragmaticivan
pragmaticivan / controller.php
Created May 18, 2011 14:33
Possibilidade de array no only e except para as before actions
/**
* Executa os métodos adicionados no before e after action.
*
* @param array $methods
* @return void
*/
private function execute_methods($methods) {
foreach ($methods as $key => $value) {
if (is_array($value)) {
if (isset($value['only'])) {