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
# Script to index words inside a text file. | |
# Words separated by spaces. | |
# Usage: ruby indexer.rb /path/to/file.txt | |
file_path = ARGV[0] || "votacion.txt" | |
WORDS_COUNT = {} | |
file = File.open(file_path, "r") | |
puts "Indexing #{file_path}" |
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
[etagwerker@bazinga current]$ rvm-prompt | |
ruby-1.9.2-p0 | |
[etagwerker@bazinga current]$ gem list | grep mysql2 | |
mysql2 (0.2.6) | |
[etagwerker@bazinga current]$ cat Gemfile | grep mysql2 | |
gem 'mysql2' | |
[etagwerker@bazinga current]$ rails c production | |
/home/etagwerker/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.3/lib/active_record/connection_adapters/mysql_adapter.rb:22:in `rescue in mysql_connection': !!! Missing the mysql2 gem. Add it to your Gemfile: gem 'mysql2' (RuntimeError) | |
from /home/etagwerker/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.3/lib/active_record/connection_adapters/mysql_adapter.rb:19:in `mysql_connection' |
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
# This is example contains the bare mininum to get nginx going with | |
# Unicorn or Rainbows! servers. Generally these configuration settings | |
# are applicable to other HTTP application servers (and not just Ruby | |
# ones), so if you have one working well for proxying another app | |
# server, feel free to continue using it. | |
# | |
# The only setting we feel strongly about is the fail_timeout=0 | |
# directive in the "upstream" block. max_fails=0 also has the same | |
# effect as fail_timeout=0 for current versions of nginx and may be | |
# used in its place. |
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
# See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete | |
# documentation. | |
worker_processes 2 | |
# Help ensure your application will always spawn in the symlinked | |
# "current" directory that Capistrano sets up. | |
working_directory "/home/deployer/myapp.com/current" | |
# listen on both a Unix domain socket and a TCP port, | |
# we use a shorter backlog for quicker failover when busy | |
listen "/tmp/myapp.com.sock", :backlog => 64 | |
listen 8080, :tcp_nopush => 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
result = %x[grep -r 'I18n.translate(' public/*] # this won't work in Windows | |
system("grep -r 'I18n.t(' public/*") # this won't either | |
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
grep_output = "" | |
Dir.glob("public/**/**").select {|file| File.file?(file)}.each do |file| | |
File.open(file, 'r').each_with_index do |line, index| | |
grep_output += line if line.include?('I18n.t(') || line.include?('I18n.translate(') | |
end | |
end | |
result = [] | |
result += grep_output.scan(/I18n\.t\('([\w+|\.+]+)'\)/) # captures I18n.t('a.key') | |
result += grep_output.scan(/I18n\.translate\('([\w+|\.+]+)'\)/) # captures I18n.t('a.key') | |
result += grep_output.scan(/I18n\.t\(\"([\w+|\.+]+)\"\)/) # captures I18n.t("a.key") |
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
<form accept-charset="UTF-8" action="https://checkout.dineromail.com/CheckOut" class="edit_order" id="checkout_form_confirm" method="post"><div style="margin:0;padding:0;display:inline"> | |
<input name="utf8" type="hidden" value="✓" /><input name="_method" type="hidden" value="put" /> | |
<input name="authenticity_token" type="hidden" value="cU5BTew+4ZG7RqlwY5LDwoULnGbFkF+H/hcXNdzf5no=" /></div> | |
<fieldset id="order_details"> | |
<div class="clear"></div> | |
<legend>Confirmar</legend> | |
<table class="index"> | |
<tbody id='line-items'> | |
<tr> | |
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
# Departamento Version 1.0 | |
class Departamento | |
include DataMapper::Resource | |
property :id, Serial | |
property :nombre, String, :index => true | |
end | |
# Then I run rackup with DataMapper.auto_upgrade!, which creates the tables with the structure above. |
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
window.Censo2010 = {}; | |
$(function(){ | |
Censo2010.CabecerasCollection = Backbone.Collection.extend({ | |
model: Censo2010.Cabecera, | |
url: function() { |
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
I [2011-06-26 21:56:53] INFO: resque-1.17.1 moved 'up' to 'start' | |
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/god-0.11.0/lib/god/event_handler.rb:62: [BUG] Segmentation fault | |
ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux] | |
-- control frame ---------- | |
c:0007 p:---- s:0018 b:0018 l:000017 d:000017 CFUNC :handle_events | |
c:0006 p:0012 s:0015 b:0015 l:001e2c d:000014 BLOCK /usr/local/rvm/gems/ruby-1.9.2-p0/gems/god-0.11.0/lib/god/event_handler.rb:62 | |
c:0005 p:---- s:0011 b:0011 l:000010 d:000010 FINISH | |
c:0004 p:---- s:0009 b:0009 l:000008 d:000008 CFUNC :loop | |
c:0003 p:0009 s:0006 b:0006 l:001e2c d:000005 BLOCK /usr/local/rvm/gems/ruby-1.9.2-p0/gems/god-0.11.0/lib/god/event_handler.rb:60 |