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
def get_images | |
require 'action_controller' | |
require 'action_controller/test_process.rb' | |
require 'mime/types' # gem install mime-types | |
@log = Array.new | |
@posts = WpaPost.find :all | |
@results = Array.new | |
# hacer un bucle recorriendo lo que sea que tiene las posibles imagenes. |
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
require 'rubygems' | |
require 'spider' # sudo gem install spider | |
Spider.start_at('http://localhost/') do |s| | |
# Limit the pages to just this domain. | |
s.add_url_check do |a_url| | |
a_url =~ %r{^http://localhost.*} | |
end | |
# Handle 404s. |
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
root@ip-10-224-81-194:/etc/chef# chef-client | |
/usr/lib/ruby/1.8/net/http.rb:2097:in `error!': 400 "Bad Request" (Net::HTTPServerException) | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.6.2/lib/chef/rest.rb:227:in `run_request' | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.6.2/lib/chef/rest.rb:90:in `post_rest' | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.6.2/lib/chef/client.rb:205:in `authenticate' | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.6.2/lib/chef/client.rb:70:in `run' | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.6.2/bin/chef-client:125 | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.6.2/bin/chef-client:119:in `loop' | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.6.2/bin/chef-client:119 | |
from /usr/bin/chef-client:19:in `load' |
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
def create | |
@roseta = Roseta.new(params[:roseta]) | |
if @roseta.save | |
flash[:notice] = 'Roseta creada.' | |
lastros = Roseta.find(:first,:order=>"id desc") | |
redirect_to :action => 'edit', :id => lastros.id | |
else | |
@errors = 'd' | |
render :action => 'new' | |
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
result = false or true # => true | |
result # => false | |
result = false || true # => true | |
result # => true |
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
Status: 500 Internal Server Error | |
uninitialized constant MysqlCompat::MysqlRes |
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
line = " Transferencia al C.Cost 9100000012 -594,00 15/03/10 traspas fundacio A.Mass\363" | |
regexp = /^(.+)\s+([-|\d|\.|,]+)\s+(\d+\/\d+\/\d+)\s+(.+)*$/ | |
line.match(regexp) # => 1min at 100% cpu usage |
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
# How to make this more legible? | |
# n and m are any natural number | |
n=1; m=12 | |
(n..m).map{ |i| ["%02d"%i,i] } | |
#=> [["01", 1], ["02", 2], ["03", 3], ["04", 4], ["05", 5], ["06", 6], ["07", 7], ["08", 8], ["09", 9], ["10", 10], ["11", 11], ["12", 12]] |
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
commit 2400f944f6b5d850c33158ae27f501e9ec8c1aba | |
Author: Albert Llop <mrsimo@gmail.com> | |
Date: Thu Aug 26 16:07:46 2010 +0200 | |
First steps into the Package module | |
Allows the installation of packages from a url. For example: | |
require 'geoffrey' | |
Geoffrey.package do |
OlderNewer