Skip to content

Instantly share code, notes, and snippets.

View xpepper's full-sized avatar
💭
😏

Pietro Di Bello xpepper

💭
😏
View GitHub Profile
@xpepper
xpepper / capistrano_rails_guide.md
Created March 22, 2012 23:10 — forked from jrochkind/gist:2161449
A Capistrano Rails Guide

A Capistrano Rails Guide

by Jonathan Rochkind, http://bibwild.wordpress.com

why cap?

Capistrano automates pushing out a new version of your application to a deployment location.

I've been writing and deploying Rails apps for a while, but I avoided using Capistrano until recently. I've got a pretty simple one-host deployment, and even though everyone said Capistrano was great, every time I tried to get started I just got snowed under not being able to figure out exactly what I wanted to do, and figured I wasn't having that much trouble doing it "manually".

Continued from I'm learning vim. Here's how I'm doing it, by Chris Geihsler

I've committed to learning vim to become more productive without the crutch of an expensive tool and to decouple myself from a specific OS.

Here's what I've done so far:

@xpepper
xpepper / issues_with_modules.md
Created December 1, 2012 20:44 — forked from ryanb/issues_with_modules.md
Points on how modules can make code difficult to read.

My issues with Modules

In researching topics for RailsCasts I often read code in Rails and other gems. This is a great exercise to do. Not only will you pick up some coding tips, but it can help you better understand what makes code readable.

A common practice to organize code in gems is to divide it into modules. When this is done extensively I find it becomes very difficult to read. Before I explain further, a quick detour on instance_eval.

You can find instance_eval used in many DSLs: from routes to state machines. Here's an example from Thinking Sphinx.

class Article < ActiveRecord::Base
#!/usr/bin/env ruby
require 'benchmark'
REGEXPS = [
/^no such file to load -- (.+)$/i,
/^Missing \w+ (?:file\s*)?([^\s]+.rb)$/i,
/^Missing API definition file in (.+)$/i,
/^cannot load such file -- (.+)$/i,
]
@xpepper
xpepper / pr.md
Created March 25, 2013 12:03 — forked from piscisaureus/pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@xpepper
xpepper / devise.it.yml
Last active December 31, 2015 22:19 — forked from fuzziness/devise.it.yml
# Italian translation for Devise 3.2
# Date: 2013-20-12
# Author: xpepper
# Note: Thanks to fuzziness (https://gist.github.com/fuzziness/5262777)
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
it:
devise:
confirmations:
confirmed: "Il tuo account è stato correttamente confermato. Ora sei collegato."
@xpepper
xpepper / Install PostgreSQL 9 in Mac OSX via Homebrew.txt
Last active February 8, 2022 03:12 — forked from lxneng/gist:741932
Install PostgreSQL 9 in Mac OSX via Homebrew
install PostgreSQL 9 in Mac OSX via Homebrew
Mac OS X Snow Leopard
System Version: Mac OS X 10.6.5
Kernel Version: Darwin 10.5.0
Install notes for PostgreSQL 9.0.1 install using Homebrew:
sh-3.2# brew install postgresql
# Directly copied from eycap-0.5.2 (thanks!)
#
# With these tasks you can:
# - dump your production database and save it in shared_path/db_backups
# - dump your production into your local database (clone_to_local)
#
# Tested and fixed by fjguzman
Capistrano::Configuration.instance(:must_exist).load do
namespace :db do
desc "Backup the database"
namespace :db do
task :backup do
on roles(:db) do |host|
backup_path = "#{fetch(:deploy_to)}/backups"
execute :mkdir, "-p #{backup_path}"
basename = 'database'
username, password, database, host = get_remote_database_config(fetch(:stage))
debug "#{username}, #{password}, #{database}"
@xpepper
xpepper / deploy.rb
Created January 9, 2014 23:08 — forked from mm53bar/deploy.rb
require File.join(File.dirname(__FILE__), 'deploy/nginx')
require File.join(File.dirname(__FILE__), 'deploy/log')
default_run_options[:pty] = true
set :ssh_options, { :forward_agent => true }
set :application, "appname"
set :repository, "git@giturl"
set :scm, :git