This file contains 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/sh | |
# /etc/cron.daily/house-cleaning | |
# RGO - not commented in rc.M | |
# Update all the shared library links: | |
#if [ -x /sbin/ldconfig ]; then | |
# echo "Updating shared library links: /sbin/ldconfig &" | |
# /sbin/ldconfig & | |
#fi |
This file contains 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
// Tip: You can go to any result in preview by pressiong ctrl+alt+[result number] | |
CmdUtils.makeSearchCommand({ | |
name: ["rails","rails-search"], | |
homepage: "http://rafagarcia.net/", | |
author: { name: "Rafa Garcia", email: "[email protected]"}, | |
license: "GPL", | |
url: "http://apidock.com/rails/search/?query={QUERY}", | |
description: _("Searches Ruby on Rails terms in Apidock.com"), | |
icon: "http://apidock.com/images/rails_icon_16.png", | |
parser: { |
This file contains 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
# Show maintenance page if it exists | |
ErrorDocument 503 /system/maintenance.html | |
RewriteEngine On | |
RewriteCond %{REQUEST_URI} !\.(css|gif|jpg|png)$ | |
RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f | |
RewriteCond %{SCRIPT_FILENAME} !maintenance.html | |
RewriteRule ^.*$ - [redirect=503,last] |
This file contains 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
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} \.svn | |
RewriteRule ^.*$ - [F] |
This file contains 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
# Create and apply patch with subversion | |
svn diff > ~/fix_ugly_bug.diff | |
patch -p0 -i ~/fix_ugly_bug.diff |
This file contains 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 ContactController < ApplicationController | |
def index | |
# render index.html.erb | |
end | |
def create | |
@contact = Contact.new(params[:contact]) | |
if @contact.valid? | |
Notifications.deliver_contact(params[:contact]) | |
#flash[:notice] = 'Email enviado correctamente' |
This file contains 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 Contact | |
include Validateable | |
attr_accessor :name,:phone, :email, :body | |
def initialize(options = {}) | |
unless options.nil? | |
@name = options[:name] if options[:name] | |
@email = options[:email] if options[:email] |
This file contains 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
# From http://www.neeraj.name/blog/articles/810-validating-non-activerecord-models-in-rails-2-2 | |
# Modified as said comment 1 - (changed self_and_descendents_from_active_record by self_and_descendants_from_active_record) | |
module Validateable | |
[:save, :save!, :update_attribute].each{|attr| define_method(attr){}} | |
def method_missing(symbol, *params) | |
if(symbol.to_s =~ /(.*)_before_type_cast$/) | |
send($1) | |
end |
This file contains 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
# You need to call the next and previous records. Just put the following in your model. | |
# From http://snippets.dzone.com/posts/show/7163 | |
def next | |
self.class.find :first, | |
:conditions => ["created_at > ? ",self.created_at], | |
:order => "created_at DESC" | |
end | |
def previous | |
self.class.find :first, |
This file contains 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
FORK - PUSH - PULL - KEEPING THE TRACK | |
====================================== | |
FORK | |
==== | |
Le doy a fork en el repositorio y luego uso "Your clone URL". | |
$ git clone [email protected]:rgo/drgtest.git | |