Skip to content

Instantly share code, notes, and snippets.

View albertoperdomo's full-sized avatar

Alberto Perdomo albertoperdomo

View GitHub Profile
# This plugin will deploy your app using capistrano.
# If the build fails the app won't de be deployed and if it passes it will try to deploy to a list of stages you can supply.
# It will send an email notifying if it was successful or not and a special artifact with the capistrano output will be created.
#
# Configuration
# In your project's cruise_config.rb file:
#
# Set the email addresses which should be notified about deployment
# project.cap_deployer.emails = ['[email protected]']
#
set nocompatible
set tabstop=2
set shiftwidth=2
set hlsearch
set ignorecase
set ttyfast
set autoindent
set smartindent
set smarttab
set expandtab
@albertoperdomo
albertoperdomo / .gitconfig
Created June 22, 2009 15:12
.gitconfig
#Put this at the end of your file:
[alias]
pu = !"git fetch origin -v; git fetch upstream -v; git merge upstream/master"
[color]
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
@albertoperdomo
albertoperdomo / Setup a new rails server
Created September 1, 2009 19:02
Install a fresh rails server
# Login and change root password
# create the user account you are going to use to connect
adduser myuser
# add the user to sudoers
visudo
#add a line like this at the end
myuser ALL=(ALL) ALL
jQuery Visualize Plugin: Accessible Charts & Graphs from Table Elements using HTML 5 Canvas
http://www.filamentgroup.com/lab/jquery_visualize_plugin_accessible_charts_graphs_from_tables_html5_canvas/
Bluff is a JavaScript port of the Gruff graphing library for Ruby.
http://bluff.jcoglan.com/
Open Flash Chart II Plugin for Ruby on Rails - Graphs (we have used this before for interactive charts)
http://pullmonkey.com/projects/open_flash_chart2/
Interactive JS charts for your website (free for personal use):
# This works on Ruby 1.8.7 but doesn't work on Ruby 1.8.6 (See backtrace further down)
require 'net/ftp'
require 'fileutils'
URL = 'XXX.XXX.XXX.XXX'
username = 'XXXXXXXXXX'
passwd = "XXXXXXXXX"
directory = '/out/archive/'
Before("@culerity,@celerity,@javascript") do |scenario|
unless @env_rvm_jruby
@env_rvm_jruby = {}
require 'yaml'
rvm_info = YAML::load(`bash -l -c 'source ~/.rvm/scripts/rvm; rvm jruby ; rvm info'`)
rvm_info['environment'].each do |k, v|
@env_rvm_jruby[k] = v
end
@env_jruby_path = rvm_info['binaries']['ruby'].gsub(%r{^(.*)/ruby$}, '\1')
end
@albertoperdomo
albertoperdomo / ci.rake
Created April 16, 2010 22:57
Sample rails rake task for continous integration and deployment
namespace :ci do
task :copy_yml do
sh "cp #{Rails.root}/config/example_database.yml #{Rails.root}/config/database.yml"
end
desc "Prepare for CI and run entire test suite"
task :build do
Rake::Task['db:migrate'].invoke
Rake::Task['db:test:prepare'].invoke
Rake::Task['test:units'].invoke
## I18n backends benchmarks
#
# All these benchmarks were performed using REE with the suite at
# at http://github.com/svenfuchs/i18n/tree/master/benchmark/run.rb
#
# When compared to ActiveRecord backend, Redis and Tokyo
# just cannot store procs. All other tests pass.
#
# Used rufus-tokyo (1.0.7) and redis (2.0.0) as gems and N = 10.
$(function(){
$("select#search_country_id").change(function(){
$("img#spinner_city_id").show();
$("select#search_city_id").disable();
$.getJSON("/cities.json",{country_id: $(this).val(), ajax: 'true'}, function(j){
var options = '';
for (var i = 0; i < j.length; i++) {
options += '<option value="' + j[i]["city"]["id"] + '">' + j[i]["city"]["name"] + '</option>';
}
$("select#search_city_id").html(options);