Skip to content

Instantly share code, notes, and snippets.

View mergulhao's full-sized avatar

Sylvestre Mergulhão mergulhao

View GitHub Profile
def create
if saved = @act.add_participant(@current_person)
flash[:notice] = _('You are now participating in this action!')
else
flash[:notice] = @act.errors.full_messages.first
end
respond_to do |format|
format.html { redirect_to(@act) }
format.xml { head :ok }
title = content_tag(:h3, "#{_("Tags")}:", :class => "tags")
title << content_tag(:ul, links.map { |link| content_tag :li, link }, :class => "tags")
content_tag :div, title, :class => "tags"
<!--
ATENÇÃO: os links estão ordenados alfabeticamente. Siga esta nomenclatura ao adicionar o seu.
-->
<h2>#horaextra</h2>
<ul id="blogroll">
<li><a href="http://tapajos.me/?utm_campaign=horaextra">Marcos Tapajós</a></li>
<li><a href="http://rafael.adm.br/?utm_campaign=horaextra">Rafael Lima</a></li>
<li><a href="http://rafael.tauil.com.br/?utm_campaign=horaextra">Rafael Tauil</a></li>
<li><a href="http://ramonpage.com/?utm_campaign=horaextra">Ramon Bispo</a></li>
<li><a href="http://mergulhao.info/?utm_campaign=horaextra">Sylvestre Mergulhão</a></li>
<script>
// 1. Write a class to support the following code:
var Person = function(name) {
this.name = name;
}
var thomas = new Person('Thomas');
var amy = new Person('Amy');
...F
Failures:
1) Task
Failure/Error: it { should have_scope(:by_due_at).order("due_at desc") }
Expected :by_due_at when called on Task scope to SELECT `tasks`.* FROM `tasks` ORDER BY due_at desc, got SELECT `tasks`.* FROM `tasks` ORDER BY due_at desc
# spec/models/task_spec.rb:9
# spec/models/task_spec.rb:3
Finished in 0.066 seconds
ruby-1.9.2@ideas mergulhao@darkstar:~/Desenvolvimento/ideas(master)$ rake stats
(in /Users/mergulhao/Desenvolvimento/ideas)
+----------------------+-------+-------+---------+---------+-----+-------+
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
+----------------------+-------+-------+---------+---------+-----+-------+
| Controllers | 97 | 83 | 2 | 10 | 5 | 6 |
| Helpers | 15 | 13 | 0 | 3 | 0 | 2 |
| Models | 74 | 58 | 1 | 12 | 12 | 2 |
| Libraries | 41 | 37 | 0 | 1 | 0 | 35 |
| Model specs | 253 | 231 | 0 | 1 | 0 | 229 |
# Generate a token by looping and ensuring does not already exist.
def generate_token(column)
loop do
token = Devise.friendly_token
break token unless to_adapter.find_first({ column => token })
end
end
source 'http://rubygems.org'
gem 'rails', '3.0.10'
gem 'rake', '0.8.7'
gem 'mysql2', '~> 0.2.11'
group :development, :test do
gem 'integration', :git => 'git://github.com/mergulhao/integration.git'
gem 'rspec-rails', '2.6.1'
end
railsapps@webby5973:~$ sudo gem list -r rails
*** REMOTE GEMS ***
ERROR: http://rubygems.org/ does not appear to be a repository
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
too many connection resets (http://rubygems.org/yaml)
railsapps@webby5973:~$
Alguém tem algum benchmark real de uma app que *em produção* apresentou ganho de performance ao migrar para ruby 1.9? A gente que gosta de tecnologia quer estar sempre no "cutting edge", mas ainda não vi nenhum bench convincente, posso apenas não ter procurado direito. Todas as minhas apps até hoje rodam em 1.8, exceto algumas estão rodando no Heroku, que estão no 1.9.
Segue a instalação do ruby 1.9 usando pacotes nativos do Ubuntu. Reparem que apesar do nome do pacote, a versão instalada é a 1.9.2, como pode ser visto no final.
====================================
railsapps@webby5973:~$ sudo apt-get install ruby1.9.1-full
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required: