March 2010
30 posts
1 tag
Pure RSpec →
RT @kpumuk: Wow, so many new things about RSpec http://pure-rspec-scotruby.heroku.com/
P.S. Use arrows to navigate through the presentation
2 tags
Let Hoptoad know about your failed rake tasks
If you use Hoptoad and run rake tasks from cron you won’t receive any error messages until you call Hoptoad notifier explicitly.
The correct way to do that is to call: HoptoadNotifier.notify(e)
task :taskname do
begin
# ...
rescue Exception => e
HoptoadNotifier.notify(e)
raise # to show error in console
end
end
3 tags
How to display .gitignore files in Textmate →
RT @kpumuk How to display .gitignore files in Textmate http://skitch.com/kpumuk/n5s9j/display-.gitignore-file-in-textmate #tmtricks
3 tags
Rails, Redis, Resque and Cucumber
If you have a cucumber feature which depends on a resque worker make sure that
the resque worker is running in “cucumber” environment
transactions are turned off for the feature by @no-txn tag
2 tags
Cucumber - undefined method `fork='
$ rake cucumber
undefined method `fork=' for #<Cucumber::Rake::Task:0x3521fa4>
If updating rspec, rspec-rails and cucumber gems doesn’t help. Probably you have an old cucumber gem installed
Try to remove it
[sudo] gem uninstall aslakhellesoy-cucumber
2 tags
Outside-In Development with Cucumber at Mountain West RubyConf 2009 (Ben Mabey)
3 tags
Hoptoad and rescue_from →
I’m using rescue_from in my controller, but now I don’t see the exceptions in Hoptoad. Whazzup with that?
Hoptoad uses alias_method_chain to hook into the rescue_action_in_public method.
# Overrides the rescue_action method in ActionController::Base,
# but does not inhibit any custom processing that is defined
# with Rails 2's exception helpers.
def...
4 tags
IRHG - Integrated Ruby Hacker's Guide →
The RHG is a book that explains how the ruby interpreter (the official C implementation of the Ruby language) works internally.
It is partially translated from Japanese. Official RHG contains only 4 chapters.
The IRHG Project has been significantly improved by the integration of the Ruby Forge Translation Documents. The two projects have been merged and have provided a improved format,...
2 tags
YQL Geo Library (pure JavaScript) →
geolocation, reverse geocoding, content analysis
UPD Other Open-Source Geocoders
2 tags
Javascript charting libraries →
Open Source
Bluff : Ruby’s Gruff ported to JS. Looks pretty straightforward.
gRaphael : built on the awesome Raphael JS vector graphics library. Limited functionality, but that’ll change.
Canvas3D : super cool, but not sure if it’s ready for a production site…
jqPlot : charting for jQuery. I’m neither pro- nor con-jQuery, so I’m not sure that I’d pick a jQuery-centric...
1 tag
Shadow Art →
2 tags
Rails "Good Touch"/"Bad Touch" →
Did you know that useful little method ActiveRecord::Base#touch will fire all of your after_save callbacks?
2 tags
Credit Card Test Cases (Google Checkout XML API) →
All of the credit card numbers below are randomly generated numbers. In addition, none of the credit card numbers has the same last four digits as any other credit card number. This ensures that when you select a credit card to complete an order, you can easily associate a test credit card with a particular test
2 tags
Replace a div.fieldWithErrors with a span in Rails →
Replace the stupid fieldWithErrors <div> with a <span>. YES, I know you can make DIVs inline by applying a “display: inline” style; the real problem is that you can’t simply use DIVs anywhere. Most significantly, you can’t use DIVs inside a P, which would be invalid HTML and in fact confuses some browsers more than you’d...
1 tag
Google Analytics. Asynchronous Tracking. Multiple... →
Multiple Tracker Objects
As mentioned above, the creation of tracker objects is implied. They are created the first time you use them. The examples above only show how to used the default tracker object. If you need more tracker objects, you must prepend a unique name to the method name of each command array you push for non-default trackers. For example, the following code sets the account and...
3 tags
Ruby Best Practices Chapter #6 →
This chapter on what to do “When Things Go Wrong” turned out to be one of the most enjoyable ones to write. Having a strong ability to troubleshoot and debug code is a powerful skill to have, and I do my best to share all my secrets here. Go ahead and download Chapter 6 now
3 tags
Иконки многих платёжных систем →
Очень мне хотелось собрать все иконки платёжных систем в одном стиле. Отрисовал все, которые смог найти […] Иконки очень не любят чёрный/тёмный фон. На любые светлые тона ложатся отлично. Возможность скачать архив с png.
1 tag
Top 20 Nginx WebServer Best Security Practices →
1 tag
The Git Community Book →
2 tags
Absolute Center (Vertical & Horizontal) an Image →
1 tag
Daniel Kahneman reveals how our “experiencing selves” and our “remembering selves” perceive happiness differently.
1 tag
Input fields as blanks within sentences →
A while ago, I came across a unique registration form built by Jeremy Keith for his audio sharing site, Huffduffer […]
I was curious how it would perform against a traditional form. Would people be more inclined to complete it because of the narrative format? Or would the unfamiliar presentation format confuse people? […] I now have some early answers. […]
Mad Libs style forms...
2 tags
If exim has too long message queue and ls returns...
cd /var/spool/exim/
find ./msglog/ -name "*"|xargs /bin/rm
find ./input/ -name "*"|xargs /bin/rm
1 tag
Functional Programming Meditation →
3 tags
@augustl: Good arguments against Ruby 1.9 encoding →
For me, I absolutely hate all this encoding stuff in ruby 1.9, and I’ll try to explain why here.
In ruby 1.8, if I write an expression like “s3 = s1 + s2”, where s1 and s2 are strings, this is easy because it’s a one-dimensional space. As long as s1 and s2 are strings, then I know that s3 will be a string, consisting of the bytes from s1 followed by the bytes from s2....
1 tag
Rails Indexes plugin →
Rails indexes is a small package of 2 rake tasks that scan your application models and displays a list of columns that probably should be indexed.
Display a migration for adding/removing all necessary indexes based on associations:
rake db:show_me_a_migration
UPD: Another similar plugin ambitious_query_indexer
Ambitious Query Indexer is a Rails plugin to identify database indexes that are...
1 tag
Microsoft рекомендует не нажимать кнопку F1 когда вы пользуетесь браузером IE...
– bondbig, Хабр
2 tags
Recursive Lambdas in Ruby
Recursive Lambdas in Ruby
Recursive Lambdas in Ruby using Object#tap
A Really Simple Recursive Combinator
Fun With the Y Combinator in Ruby
2 tags
How jQuery is Killing Flash + jQuery Tutorials &... →
2 tags
Writing Good Factories →
I really wanted to remember what Pratik had to say about writing good factories in his Rails Summit talk so I’m putting it up here as a reference. Should be able to loop 10.times { Factory(:user) }
No associations in the base Factory Factory(:user) and Factory(:user_with_items)
Should pass validations