RubyFlow : The Ruby Community Blog

Home   Submit   Sign Up   Log In   leaders   Twitter   RSS Feed  
 
August 30, 2014
DescriptiveStatistics is a gem that adds methods to the Enumerable module to allow easy calculation of basic descriptive statistics of Numeric sample data in collections that have included Enumerable such as Array, Hash, Set, and Range. The statistics that can be calculated include Number, Sum, Mean, Median, Mode, Variance, Standard Deviation, Percentile, Percentile Rank, Descriptive Statistics, and Quartiles.

When requiring DescriptiveStatistics, the Enumerable module is monkey patched so that the statistical methods are available on any instance of a class that has included Enumerable. For example with an Array:

> require 'descriptive_statistics'
=> true
> data = [2,6,9,3,5,1,8,3,6,9,2]
=> [2, 6, 9, 3, 5, 1, 8, 3, 6, 9, 2]
> data.number
=> 11.0
> data.sum
=> 54.0
> data.mean
=> 4.909090909090909
> data.median
=> 5.0
> data.variance
=> 7.7190082644628095
> data.standard_deviation
=> 2.778310325442932
> data.percentile(30)
=> 3.0
> data.percentile(70)
=> 6.0
> data.percentile_rank(8)
=> 81.81818181818183
> data.mode
=> 2
> data.range
=> 8
August 29, 2014
Creating a simple ToDo with Rails  arubystory.blogspot.com
Creating a simple ToDo application With Rails.
Amazon provides Simple Queue Service also knows as SQS. It is a fast, reliable, scalable, fully managed message queuing service in the cloud that you can use from your applications. This is how you can use it from Sinatra/Ruby.
Imagine developing an application where you need to grab shipping data in real time, send products, inventory, and order information over at least ten different APIs including Amazon and eBay. When I first heard that I had to do this, there could only be one answer: “Challenge accepted”. Continue reading.
August 28, 2014
Made a thing that makes setting up configurable gem variables with optional defaults super easy. Implementation details here - http://viget.com/extend/easy-gem-configuration-variables-with-defaults
Reading Rails - TimeWithZone  monkeyandcrow.com
Timezones are not fun.

Thankfully, Rails largely deals with them behind the scenes.
Learn how TimeWithZone works, and when you run into that crazy timezone bug, you'll know where to start looking.
Paperdragon is a new alternative to Paperclip and CarrierWave. Its very explicit API uses Dragonfly under the hood and gives you control about every aspect for processing uploaded images.
ITTIA DB SQL offers big data capabilities for smart embedded systems with limited local resources, enabling the distribution of a large data set across a wide array of devices, and the potential to store millions of rows per device. Applications can then run queries on individual devices, or pool data together in a back-end system for data warehousing and data mining. In this way, developers benefit from highly reliable embedded database software with a strong track record in mission-critical systems.
This is part 3 in my series about living documentation. Here I discuss effective ways to implement end-to-end tests. Part 2 discussed how we can write better living documentation, and Part 1 discussed why you should give living documentation a chance.
August 27, 2014
A fundamental Active Record feature known as eager loading regularly trips up new Rails developers to the detriment of their application's performance. In this post I offer a concrete example illustrating the difference between the includes and joins approaches, complete with a log of the queries executed when each approach is implemented.
Following up on last year's report, here's a chart of Ruby versions used in commercial projects, sourced from Semaphore CI.
After a list of free resources for Ruby beginners, this time we've coined a list of handy Ruby resources to follow for intermediate to advanced devs.
We just wrote a tutorial series on integrating Bootstrap with Rails:

Integrating Rails with Bootstrap, Part 1 - the Installation
Integrating Rails with Bootstrap, Part 2 - CSS and Components
Integrating Rails with Bootstrap, Part 3 - Javascript Based Features
August 26, 2014
Ruby has both symbolic (&&/||) and English logical and/or operators. The differences between these operators can be confusing, to the point that many programmers simply avoid using the English versions entirely rather than deal with their sometimes surprising behavior. I've made a screencast which explains why the very features which make these operators problematic in a boolean logic setting also make them perfect for certain elegant control flow idioms.
The first beta of Rails 4.2 was announced last week, and it already looks amazing. I’m really excited to use ActiveJob, Web Console, Adequate Record, and Foreign Key support in my own apps. But the beauty of Rails is in the details. And if you do a little digging, you’ll find some less advertised features that will totally improve your daily work with Rails.
Heroku is awesome. It's a great first stop for deployment. But when is it not the right thing?

Let's talk money, architecture and customizaton. And also about when Heroku is right.
Hi guys! I just released normalizr - lightweight and flexible solution for attribute normalization. Check this out!
We recently had to set up a MS SQL database on a Mac for a client project. So, we thought we'd put together this mini tutorial just incase you ever have to do the same.
August 25, 2014
Postgres has a reputation of being hard to set up, but it seems things are changing now. check out our blog post on how to install Postgres for Mac OS X!

Install PostgreSQL on Mac
We’ve just unveiled the first release of Praxis, a ruby framework that takes a different approach to creating APIs.
With Praxis you can have different sets of people design, review and implement your API, while resting assured that the resulting code is always consistent with your API specs.
Building APIs with Praxis leads to better designs, faster developer times and result in precise documentation that is apt for both human (web browsable) and machine consumption (JSON definition files).

Check out the blog announcement and the project page for more information. The sources can be found at: Github
An open source extension that integrates PayU payment gateway with Spree stores.
I found this article/blog post from 2009 regarding caching. Still relevant.

Caching in the controller
I'm reading Rails source code and wanna share what I have learnt as a series of blogs. Here is the first one, How Rails initializes itself.
August 24, 2014
Green Ruby News #81  greenruby.org
Like every week, here is a fresh list of the links from last week on Green Ruby News #81.
When you want to write a mobile app, but you don't want to quit Ruby, it's worth looking into Rhodes. Unfortunately it might not be so simple to use it on Ubuntu (or any other Linux). Also it won't work out of the box with anything newer than 1.9.3. I wrote a simple how to bypass all of those issues: Installing Rhodes on Ubuntu and making it run on Ruby 2.1
A tiny Ruby script to generate a Dockerfile from a Dockerfile.erb template.
August 22, 2014
Could JRuby have made the largest contribution to the Ruby community? JRuby gives you access to an additional 84,000 libraries.

JRuby: Performance Plus the Whole Java World on a Silver Platter
Hi guys, I just created http://huydx.com/facy, a colorful and fun facebook terminal client, which helps you interact with facebook without being distracted by images in a compact way.
A lot times when you run rake tasks it would be nice to get output from rails logger into STDOUT. The simplest way to do it is to create a new rake task that will redirect output to STDOUT.
August 21, 2014
Hello, I've put together a new world data gem, that is, worldlite, that includes all the world countries as good ol' ruby code - no database required, no dependency, and all code and data is public domain, that is, no copyright and no rights reserverd. Try it. Use require 'worldlite'; include WorldLite and
>> WORLD.size # => 245
>> WORLD_UN.size # => 193
>> WORLD_G20.size # => 20

and so on. For countries try:
>> AT.class.name # => WorldLite::Country
>> AT.name # => Austria
>> AT.alpha3 # => AUT

Still early and rough but all the world's countries and territories (246 total) included. Cheers.
Do you know someone who teaches a class or workshop on Rails? I offer my book for beginners, Learn Ruby on Rails, to students enrolled in classes or workshops. See my blog post for details: ‘Learn Ruby on Rails’ Free for Students.
The 1.1 release of Reform brings better reusability for DRY form objects, simplifies and fixes lots of things and allows deserializing JSON and more, to make forms part of your HTTP API, too.
August 20, 2014
I just posted a write-up of using ActiveRecord's .pluck if you only need a subset of model attributes. Check it.
Wanna a complete, quick and easy way to validate email address? It validates not only the format, but also domain address. You can check it here .
August 19, 2014
Rails' i18n library is more powerful than it looks. You don't need to only use it for translation. The i18n library is useful anywhere you want to decouple the text you display from the place you display it. I'm going to share a few of the things that we learned that have come in handy, along with a crazy abuse of the library that ended up working out incredibly well for us.
Rails bundles default 404 (file not found), 422 (unprocessable entity), and 500 (internal server error) pages into every newly generated application. While they get the job done, these pages are pretty bland, so in this post I’ll show you how to update them to suit the logic and design requirements of your application.
How to avoid creating additional columns for child classes using RoR 4 and PostgreSQL 9.3, with an example based on social media users data: Renewed Life for STI with PostgreSQL JSON type.
August 18, 2014
I use the Rails console repeatedly throughout the day, but peering into object data can be a bit difficult due to poor formatting. Fortunately, a great gem called Awesome Print can bring an end to the formatting blues. In this blog post I introduce Awesome Print, and show you how to integrate it into your Rails console.
Subdomains can be a tricky thing to work with. So, we thought we'd share some tips to develop and test Rails applications using them.
So, now we came to a point where our app no longer fit to vanilla MVC and we want to extract a service layer. By “Service Layer” I mean a collection of Plain Old Ruby Objects, which hold pure business logic.

But the question is – where do we put them in our Rails app files structure?

We got several options here: [read more]
August 17, 2014
Green Ruby News #80  greenruby.org
I just posted http://greenruby.org/grn-080.html fresh with the week cool news for open minded rubyists.
Using Cloud Formations at AWS is an incredible way of building repeatable infrastructure, learn more about how it works and get to know cfn-bridge as well, a gem that aims to fill in the gaps not covered by the Cloud Formation API yet.
tl;dr Go to github.com/beatrichartz/configurations and get MyGem.configure do ... end configuration functionality (plus bonus).

In nearly every gem written there is some lines doing configuration. Although there seems to be a broad consensus on the MyGem.configure do ... end idiom, everybody has their own version of doing it, or is at least is copy-pasting the same code into the gem.

Configurations is a lightweight gem aiming at fixing that.

It lets you implement everything from an arbitrarily configurable object down to a type restricted configuration, so you can focus on writing exciting code without getting stuck implementing a configuration.

Works on nearly every Ruby version, has no dependencies, and is 11 KB to download (oh the bloat!)

Configurations - A delicious hash wrapped in a basic object, and nothing more. Try it today!
I've bundled up the sport.db.admin web app (- demo running on heroku -) into an easy-to-use command line tool, that is, sportweb for (local) use on your own machine. Let's say you have an SQLite database - e.g. football.db - in your folder, than just type $ sportweb and that's it - open your browser (e.g. use localhost:3000) and start browsing your local SQLite sports database. Cheers.
Final post on looking into the Gem Main check it out!
August 16, 2014
RailsApps Update for Devise 3.3  blog.railsapps.org
Devise default views now say “Log in” instead of “Sign in.” And the wording of error messages has changed. My blog post on the RailsApps Update for Devise 3.3 contains links for the details.
August 15, 2014
Released update to equatable to help implementing equality comparison in ruby objects.
Semaphore, a hosted CI & deployment service is now free to use fo open source projects. There are also accounts for open source organizations, coupled with public profiles to show off your work. :)
This week/s I have been mostly programming Ruby and Go, occasionally thinking about monoliths and services. My general feeling at the moment on rearchitecting your app is nope. Push it out as far as you can and take steps to postpone the inevitable (in Rails land, that’s engines, components and gems). Feel the Vibe
The new Cells view model allows replacing helpers and partials with a clean, encapsulated component by introducing a badly needed new abstraction layer.