Skip to content

Instantly share code, notes, and snippets.

@ancorcruz
ancorcruz / route_spec_upgrade.sed
Created May 18, 2009 12:56
fix routing specs 1.1.12 to 1.2.6
/generation" do$/,/recognition" do$/{
s/> 1/> "1"/g
/"create"/,/$/{
s/== "/== \{:path => "/
s/"[[:space:]]*$/&, :method => :post\}/
}
/"update"/,/$/{
s/== "/== \{:path => "/
s/\/1"[[:space:]]*$/&, :method => :put\}/
}
@ancorcruz
ancorcruz / enhanced_feature
Created May 18, 2009 12:57
launch a cucumber feature
#!/bin/bash
cucumber -b --r features/support/env.rb -r features/support/enhanced.rb -r features/step_definitions --language es $1
@ancorcruz
ancorcruz / thinking_sphinx)
Created July 31, 2009 10:03
Thinking Sphinx init.d script
#!/bin/bash -e
### BEGIN INIT INFO
# Provides: thinking_sphinx
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/stop Sphinx daemon for Thinking Sphinx
### END INIT INFO
CONFIG_FILE=/etc/default/thinking_sphinx.conf
. $CONFIG_FILE || exit
@ancorcruz
ancorcruz / .gitconfig
Created November 21, 2009 16:43 — forked from albertoperdomo/.gitconfig
Colourify git output
#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
<% allowed_ranges ||= [] %>
<%= label :report_value, :allowed_range_id, "Rangos permitidos", :class => "label" %>
<%= select(:report_value, :allowed_range_id, allowed_ranges, {:prompt => "Seleccione un rango"},
{:onchange => "#{remote_function(:url => {:controller => "report_values", :action => "update_allowed_range_version", :report_id => report},
:with => "'allowed_range_id='+value")}"}) %>
##formtastic_datepicker_interface
module Formtastic
module DatePicker
protected
def datepicker_input(method, options = {})
format = options[:format] || ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS[:default] || '%d %b %Y'
string_input(method, datepicker_options(format, object.send(method)).merge(options))
end
# 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
@ancorcruz
ancorcruz / gist:557664
Created August 30, 2010 16:48
Instalación y configuración de servidor de comet
#Importante: resetear el single_access_token de los usuarios que no tengan
cd /var/www/apps/pareja10/current
script/console staging (o production)
User.find_each do |u|
unless u.single_access_token?
u.reset_single_access_token
u.save(false)
end
end
@ancorcruz
ancorcruz / Instructions.markdown
Created January 25, 2012 11:05 — forked from albertoperdomo/Instructions.markdown
Setting up a new machine

Setting up a new Mac for web development with Rails

This is my own howto to setup new machines, but you might find it helpful as well.

## General settings

  • In Finder -> Preferences set it to show your home folder, hard drives, external drives, filename extensions, etc.
  • Make Finder show Library: run chflags nohidden ~/Library/ within a terminal
  • Disable holding key pressed to display accents and enable repeat keys: defaults write -g ApplePressAndHoldEnabled -bool false
  • In Preferences->Dock Select "Scale Effect" in the "Minimize Using" field and deselect the "Animate Opening Applications" option.
@ancorcruz
ancorcruz / playing with irb
Created March 5, 2012 15:15
Ruby hash bug
1.9.3p0 :001 > h = Hash.new([])
=> {}
1.9.3p0 :002 > h[:a] << 1
=> [1]
1.9.3p0 :003 > h
=> {}
1.9.3p0 :004 > h[:a]
=> [1]
1.9.3p0 :005 > h[:b] = [2]
=> [2]