background preloader

General

Facebook Twitter

Ruby Object Model: Methods - Code Galoot. Ruby methods belong to the classes that define them.

Ruby Object Model: Methods - Code Galoot

This makes sense since instantiations (objects) of the class inherit the same methods. I thought I would share some method discoveries as I continue on my exploration of Ruby’s object model. Ruby and Rails Programming. #286 Draper. Clean up complex view logic using Draper.

#286 Draper

This gem provides decorators (much like presenters) which bundles view logic in an object oriented fashion. 3 Rails refactoring tools. September 27, 2010 Refactoring—the practice of making your working code better and more manageable through better design choices—is an important part of software development.

3 Rails refactoring tools

It’s core to test-driven and behavior-driven methods, but if you’re not yet following the red-green-recycle mantra in your development, you may have yet to experience refactoring in practice. There are plenty of resources on refactoring; today I want to share three tools to help you get started with this technique in your Ruby on Rails projects. In addition to making your code more maintainable, refactoring is an excellent learning opportunity. You can read about good design principles, but seeing how code you wrote breaks them—and then fixing your errors—can drive home these principles and make them second nature to you.

While a suite of tests for your application is not strictly a prerequisite to refactoring, it will make the task significantly easier. Using FastGettext to translate a Rails application — Rendered Text. Ruby on Rails is shipped with i18n gem, which provides an internationalization and localization system.

Using FastGettext to translate a Rails application — Rendered Text

It basically allows the developer to abstract all the locale specific elements, mainly strings and date formats, out of the application. The i18n gem is split into two parts: 1) the public API and 2) the default backend, intentionally named Simple. As the Rails guide suggests, the Simple backend can be replaced, if needed, with a more powerful one. And that’s where FastGettext comes into play. Blog. Gambling development has its own rules and if you have chance to face them, you may know how hard it can be to meet all the gambling regulatory authority requirements.

Blog

In one of our recent projects (horses racing betting website) we had to follow a lot of rules from the ARJEL - regulatory Authority for online gambling in France. The ARJEL provides french gambling operators with license, but only if they prove that they can protect players, prevent fraud, and, the most important, prove integrity of gambling activity. Building a Faster Ruby Garbage Collector.

Since late 2009, much of www.twitter.com has run on Ruby Enterprise Edition (REE), a modified version of the standard MRI 1.8.7 Ruby interpreter.

Building a Faster Ruby Garbage Collector

At the time, we worked with the REE team to integrate some third-party patches that allowed us to tune the garbage collector for long-lived workloads. We knew this was not a perfect choice, but a switch to a new runtime (even MRI 1.9x) would introduce compatibility problems, and testing indicated that alternative runtimes are not necessarily faster for our workload.

Nevertheless, the CPU cost of REE remained too high. To address this problem, we decided to explore options for optimizing the REE runtime. We called this effort Project Kiji, after the Japanese bird. Inefficient garbage collection Our performance measurements revealed that even after our patches, the Ruby runtime uses a significant fraction of the CPU for running the garbage collector on twitter.com. We needed to make the garbage collector more efficient but had limited options. Schneems/sextant. Html5-boilerplate/doc/TOC.md at master · h5bp/html5-boilerplate. Initializr - Start an HTML5 Boilerplate project in 15 seconds! Russfrisch/h5bp-rails. Angularjs Normal Links with html5Mode. How can we use rails routes with angularjs in a DRY way? - Tech Forum Network. Home » TechQns » How can we use rails routes with angularjs in a DRY way?

How can we use rails routes with angularjs in a DRY way? - Tech Forum Network

First of all,I would say sorry for my broken English and the broken codes…(many words here come from google translation…so, I’m afraid that I can’t make myself clear…so, I paste all the codes…) Setting up routes in rails is really easy. But when we want to warp it into angurjs, it becomes a little bit verbose… Is there any ‘best practice’ for this kinds of job: given some rails route resources: resources :users resources :photos ... resources :topics. Ruby efficiently determining the largest (longest) of 2 arrays. Tell, Don't Ask. And now, a friendly message from your local Tell, don't ask Department.

Tell, Don't Ask

Resources for Building Robust Rails Applications. Test driven development - the easy way! Laserlemon/figaro. How to write a Ruby and Rails 3 REST API. Background I’ve always wondered how I’d go about publishing a real REST API on the web to do something.

How to write a Ruby and Rails 3 REST API

In this example, we’ll create an employee manager app-thing. Handling Background Jobs in Rails 3.2. Hi everybody, What's up!

Handling Background Jobs in Rails 3.2

Today I am going to discuss about the background tasks management in rails. Suppose we have a UserMailer which sends email to the users once they have successfully completed the registration process.