Rubyland

news, opinion, tutorials, about ruby, aggregated
Sources About
Schneems - Programming Practices, Performance, and Pedantry 

I know how to code, I can code in anything

Every time I talk to a recent grad I hear a variation of the phrase “I know how to code, I can code in anything”. This is, on the surface, true for some bits like boolean logic and loops. Where it starts to fail for me is when I need to leverage a language’s ecosystem. I’m a Ruby programmer at heart (for the last 10+ years), yet I’m being forced to write in other languages through my CS Masters classes at Georgia Tech. I know I’m a competent coder, but can I really “code in anything”? How much does skill in one language translate to another?

Search Results for “ruby” – via @codeship 

An Overview of the Security Ecosystem in Programming

Reading Time: 7 minutes

As is the case in recent years, security breaches are becoming ever more accepted. Just take the recent Equifax breach as an epic example. No matter where we look, it seems like someone is always falling victim to some form of malicious attack or another.

While the recent breach is fresh in our minds, I wanted to take a moment to get an overview of the security ecosystem, concerning software development. I’ll go over some of the key things you can do, from a constructive and active perspective, to improve the robustness of your applications against security breaches.

To do that, I’m going to look at four key areas. They will primarily discuss specific technical steps.…

Drivy Engineering 

Sanitize your attributes through your form object

At Drivy, we use the Virtus gem to build form objects in our codebase. This lets us:

  • Keep our business logic out of the Controller and Views
  • Deal with unpersisted attributes
  • Add specific validations instead of adding them directly in the model
  • Display custom data validations errors directly in the form
  • Use features from ActiveModel::Model by including it

Sometimes, we have to sanitize user input: format the data, remove whitespaces and so on. Here is a convenient way to handle it with Virtus.

Using #coerce

Let’s imagine that we want to remove all the whitespaces from a VAT number recorded as a string. This is a pretty simple use case, but concepts will apply to more complex…

GoRails Screencasts 

Administrate Custom Fields and the Trix Editor

Use the Trix editor in your admin area using Administrate's custom fields.
All Ruby Podcasts by Devchat.tv 

RR 332: Exploring Connections Between Your Apps and the Web with Justin Weiss

Panel:

Charles Max Wood

Eric Berry

Special Guest: 

Justin Weiss

In this episode, the Ruby Rouges speak with Justin Weiss. Justin is a software developer for aha.io, blogs at justinweiss.com, and is also the book author of Practicing Rails: Learn Rails without being overwhelmed.

Justin gives a preview of his presentation at Ruby Dev Summit , which is about exploring connections between your apps and the web. Ruby Rogues and Justin dive deep into questions about testing apps with an array of tools to see how that information is relevant in exploring connectivity and working parts of apps.

In particular, we dive pretty deep on:

  • Apps becoming of the web instead of running on the web
OmbuLabs Blog 

Upgrade Rails from 3.0 to 3.1

This is the second article of our Upgrade Rails series. We will be covering the most important aspects that you need to know to update your Ruby on Rails application from version 3.0 to 3.1. If you are in an older version, you can take a look at our previous article.

  1. Considerations
  2. Ruby version
  3. Tools
  4. Config files
  5. jQuery
  6. Asset Pipeline
  7. Next steps

1. Considerations

Before beginning with the upgrade process, we recommend that each version of your Rails app has the latest patch version before moving to the next major/minor version. For example, in order to follow this article, your Rails version should be at 3.0.20 before updating to Rails 3.1.12

2. Ruby version

Rails 3.1 requires Ruby …

Notes to self 

InvoicePrinter 1.0

After some time with 1.0.0.rc1 I am releasing a final 1.0.0 of InvoicePrinter. So what it is it, what does it mean and what’s next?

InvoicePrinter started as a spin off of my old bachelor thesis where I took some ugly Prawn code from a Rails view and turned it into a standalone and well tested Ruby library. I made an unobstructive and direct way of making PDF invoices from Ruby. No validations, no rules – just your data as a nicely crafted PDF in seconds. Generating PDF invoices from Ruby was never easier. 

Here are my previous blog posts about InvoicePrinter:

BigBinary Blog 

Scheduling pods on nodes in Kubernetes using labels

This post assumes that you have basic understanding of Kubernetes terms like pods, deployments and nodes.

A Kubernetes cluster can have many nodes. Each node in turn can run multiple pods. By default Kubernetes manages which pod will run on which node and this is something we do not need to worry about it.

However sometimes we want to ensure that certain pods do not run on the same node. For example we have an application called wheel. We have both staging and production version of this app and we want to ensure that production pod and staging pod are not on the same host.

To ensure that certain pods do not run on the same host we can use nodeSelector constraint in PodSpec to schedule…

Kuber…

OmbuLabs Blog 

Upgrade Rails from 3.0 to 3.1

This is the second article of our Upgrade Rails series. We will be covering the most important aspects that you need to know to update your Ruby on Rails application from version 3.0 to 3.1. If you are in an older version, you can take a look at our previous article.

  1. Considerations
  2. Ruby version
  3. Tools
  4. Config files
  5. jQuery
  6. Asset Pipeline
  7. Next steps

1. Considerations

Before beginning with the upgrade process, we recommend that each version of your Rails app has the latest patch version before moving to the next major/minor version. For example, in order to follow this article, your Rails version should be at 3.0.20 before updating to Rails 3.1.12

2. Ruby version

Rails 3.1 requires Ruby …

Ruby Inside - Medium 

Triple Equals Black Magic

For the most part, === is either ignored or used in the background of case statements. Now there are several articles detailing this, but the question is what all can we use it for?

What is Triple Equal?

In the default case, triple equal is just an alias for double equal. The brilliance comes in when other classes override it for their own behavior. A few examples of this:

Ranges

(1..10) === 1

For a range, triple equal is an alias for includes?.

Now, a note on ranges, they do a lot of black magic themselves. That’s the subject of a whole new post, but for now a few fun ones that you can try out:

'a'..'z'
'1.0.0'..'2.0.0'

Regex

/abc/ === 'abcdef'

For regex, it’s match .

Classes

String === 'foo'

For a…

Hanami 

Announcing Hanami v1.1.0.rc1

Hello wonderful community!

Today we're happy to announce v1.1.0.rc1 release 🙌 , with the stable release (v1.1.0) scheduled later this month.

Features

Here's the last minor additions. This version is the feature freeze for v1.1.0.

Association aliases

We added support for association aliases via :as option. In this way an association can be referenced by the alias, not the conventional name.

class UserRepository < Hanami::Repository
  associations do
    has_many :stories
    has_many :comments
  end
end
class CommentRepository < Hanami::Repository
  associations do
    belongs_to :story
    belongs_to :user, as: :author
  end
class StoryRepository < Hanami::Repository
  associations do
    belongs_to :user
    has_many
Hi, we're Arkency 

Two ways for testing preloading/eager-loading of ActiveRecord associations in Rails

As a developer who cares about performance you know to avoid N+1 queries by using #includes, #preload or #eager_load methods . But is there a way of checking out that you are doing your job correctly and making sure that the associations you expect to be preloaded are indeed? How can you test it? There are two ways.

Struggling with finding Senior Ruby developers? - Show your job post here and reach thousands of developers quickly.

Imagine we have two of these classes in our Rails application. An order can have many order_lines.

class Order < ActiveRecord::Base
  has_many :order_lines

  def self.last_ten
    limit(10).preload(:order_lines)
  
class OrderLine < ActiveRecord::Base
  belongs_to :order
end

We implemented Order.last_…

Red Panthers 

Observer Design Pattern in Ruby

Observer design pattern (also known as Publish/Subscribe) is a software design pattern, used when we are building a system where the state of one object affects the state of other objects. It is a key part of model-view-controller architectural pattern.

In a traditional MVC ( Model-View-Controller ) architecture, a model is a subject and a view is an observer. A view is notified when a model changes and responds accordingly. When the subject sends observers detailed information about what has changed, indiscriminately, this is known as the push model of the Observer pattern. When a subject sends only minimal information to its observers must ask for details explicitly, this is known as the 

Ruby Together News 

September 2017 Monthly Update

Hello! Welcome to the monthly update. During September, our work was supported by reinteractive, Stripe, Bleacher Report, GitLab, and many others.

Since the last update, we shipped a security release of RubyGems, hired a new developer to work on security, funded the new Ruby Toolbox, and patched RubyGems.org to protect it from a newly-found variant of an old security hole.

ruby together news

In September, Ruby Together was supported by 138 different companies, including Ruby member reinteractive and Sapphire member Stripe, and one new company. On top of those companies, 3 people signed up as members or friends of Ruby Together, including Stanislav (Stas) Katkov and Abu Nashir. In total,…

Hi, we're Arkency 

Using state_machine with event sourced entities

Our event sourced aggregates usually have a lifecycle and they need to protect some business rules. Often they start with guard statements checking if performing given action is even allowed. I was wondering if there was a nice way to remove those conditional and make the code more explicit. I wanted to experiment with porting the code from our book to use state_machine gem and see if the results are promising.

Struggling with finding Senior Ruby developers? - Show your job post here and reach thousands of developers quickly.

My starting point was a class looking like this:

  class Order
    include AggregateRoot
    NotAllowed = Class.new(St…
Hi, we're Arkency 

Make your Ruby code more modular and functional with polymorphic aggregate classes

For the last year, I’ve been using Rails (as I do for the last 10 years), but last year it was almost exclusively Rails “Not the Rails Way”. We have successfully combined Rails with Domain-Driven Design, CQRS and Event Sourcing. Over the last year, most of the business logic state in my apps was persisted using events, not the “let’s just store the last state and forget the history” ;)

In short, I was using a lot of Event Sourcing.

Struggling with finding Senior Ruby developers? - Show your job post here and reach thousands of developers quickly.

Event Sourcing is not easy and it does take time to get used to it. We are event sourcing our…

Drifting Ruby Screencasts 

Testing with RSpec

Using RSpec, learn how to create tests for your application and view your coverage.
Giles Bowkett 

Quick "TV" Reviews (from Netflix, Amazon, Crunchyroll, & YouTube)

I've had an awful leg injury all this year. I tore my Achilles tendon, and that takes a very long time to heal. One of the few upsides has been that, since I've almost been unable to leave the house at all, I've had time for a lot of TV. For instance, this past year I watched almost the entire series of Game of Thrones. I had given up on it early in the second season; I started from there and am now all caught up.

Here are some reviews of stuff I've been watching recently.

Lesbian Bear Storm

This is an anime which presents an allegory about homophobia. Magical talking bears want to eat humans, and argue for their right to do so in a court presided over by a judge named Life Sexy. The lesbian…
Andy Croll 

Rescue specific errors. Avoid rescuing StandardError. Don’t rescue Exception.

There are many built-in error classes in Ruby and Rails. Most of these errors are subclasses of Ruby’s StandardError. You can find more information in the relevant Ruby docs.

Instead of…

…rescuing Exception.

def your_method
  # do something
rescue Exception => e
  # saved ALL THE THINGS
end

Or…

…a non-specific rescue that implicitly rescues StandardError.

def your_method
  # do something
rescue => e
  # saved StandardError and all subclasses
end

Use…

rescue on a specific named error.

def your_method
  # do something
rescue SpecificProblemError => e
  # saved only what you meant to
rescue AnotherProblemError => e
  # saved a different kind of error
end

But why?

Ruby’s Excep…

Michał Łomnicki 

Improved stacktrace display in Ruby 2.5

Trace

Reading long stacktraces is tedious. Luckily, there is good news. Ruby 2.5 makes them slightly more convenient.

Rodrigo Rosenfeld Rosas 

Explicit request params binding in Ruby web apps (or "convenience can be inconvenient")

The Ruby ecosystem is famous for providing convenient ways of doing things. Very often security concerns are traded for more convenience. That makes me feel out of place because I'm always struggling to change the default route since I'm not interested in trading security with convenience when I have to make a choice.

Since it's Friday 13, let's talk a bit about my fears ;)

I remember that several of the security issues that were disclosed in the past few years in the Ruby community only existed in the first place because of this idea that we should try to deliver features the most convenient way. Like allowing YAML to dump/load Ruby objects, for example, when people were used to use it…

Notes to self 

Sending JSON API like 401 Unauthorized error with Devise

If you are using Ruby on Rails together with Devise gem you might be wondering
how to handle unauthorized error responces in your JSON API.

JSON API prescribes that to send errors you need a root “errors” array of errors with as least a status code (as string) and a title (as string). Essentially that means to turn our error message issued by Devise into the following:

{"errors":[{"status":"401","title":"Unauthorized"}]}

The problem is that Devise does not really throw an exception that we could rescue_from from our controller. What we need is to create a custom equivalent of Devise::FailureApp:

# Our custom failure response app since we want to return JSON:API like
# messages for some…
Search Results for “ruby” – via @codeship 

Using Codeship Basic to Test Ruby on Rails Applications

Reading Time: 4 minutes

Codeship offers developers a vast array of possibilities when creating a continuous integration and deployment pipeline for their applications. I want to focus today on how to build a solid CI/CD pipeline for a Ruby on Rails application with Codeship.

Setting Up Your Local Environment

Our tutorial has a few prerequisites:

We’ll kick things off by configuring our local application. Once downloaded, we can test out the Docker build process by running docker-compose build.

This command will tell Docker to…

The Bike Shed 

127: Bike Shed: Discovery

We discuss Bundler warning us to update to a prerelease version and other recent annoyances with our favorite dependency manager. We also wonder what GitHub diff stats can tell you about your contributions to a project and when they might be a smell. Stick around post credits for some spoiler-filled chatter about the first couple episodes of Star Trek: Discovery.

Awesome Ruby Newsletter 

Issue 74 - Vanilla Rails

EquiValent - Web Developer Blogs 

CSRF protection on single page app API

Single Page application is awesome paradigm but because they communicate with APIs there is lot of confusion around what security measures are needed and what are unnecessary. In this article I'll try to explain when is CSRF protection needed.
Speedshop - Ruby on Rails performance consulting 

Configuring Puma, Unicorn and Passenger for Maximum Efficiency


In Ruby, web application servers are like gasoline in a car: the fancy stuff won’t make your car go any faster, but the nasty stuff will bring you grinding to a halt. Application servers can’t actually make your app significantly faster - no, they’re all pretty much the same and changing from one to the other won’t improve your throughput or response times by much. But it is easy to shoot yourself in the foot with a bad setting or misconfigured server. It’s one of the most common problems I see on client applications.

This post will be about optimizing resource usage (memory and CPU) and maximizing throughput (that is, requests-per-second) from the three major Ruby application servers:…

Ruby – Sihui Huang 

Design Pattern: Command and Concierge

Design Patterns in life and Ruby — gain an intuitive understanding of OO design patterns by linking them with real-life examples.

 

The Command Pattern’s definition is a stressful one to look at.

The Command Pattern:

 

– encapsulates a request as an object,

 

– thereby letting you parameterize other objects with different requests, queue or log requests, and support undoable operations.

 

Let’s forget about it for a second and take a trip to Hawaii.

And live in a luxury hotel.

 

We spent the day on the beach, scuba dived, and did some sightseeing. It’s time to get back to the hotel to chill, eat, and plan for the next day.

 

After getting back to the hotel, we want to:

  1. Get room…
Ruby Weekly 

#370: Ruby 2.5 Preview 1 Released

Ruby Weekly Issue 370 — October 12, 2017
ruby-lang.org
The first official preview release of 2.5 is here (fingers crossed for a final release at Christmas).


Aaron Patterson
Read this for the full explanation of the problem and the very speedy fix.


Depfu  Sponsored
Depfu continuously updates your dependencies one gem at a time and creates a super nice pull request with all the info you need. You stay in control if and when to merge.


Tom Benner
A library for quickly adding interactive charts…
Michał Łomnicki 

Improved stacktrace display in Ruby 2.5

Trace

Reading long stacktraces is tedious. Luckily, there is good news. Ruby 2.5 makes them slightly more convenient.

GoRails Screencasts 

Making GeoSearch smooth with AJAX

Cleaning up the rough edges and adding some polish to geosearch using AJAX
Greater Than Code 

050: Open Source Anarchism with Steve Klabnik

This episode is sponsored by Instrumental application and server monitoring!

Instrumental’s goal is to help developers answer application performance questions FASTER, with a powerful query language, real-time metrics, blazing interface, and automatic metric collection.

Sign up for a free developer account at InstrumentalApp.com!


Panelists:

Coraline Ada Ehmke | Jamey Hampton | Rein Henrichs | Lorena Mesa

Guest Starring:

Steve Klabnik: @steveklabnik | www.steveklabnik.com  

Show Notes:

00:16 – Welcome to “Greater Than Crabmeat” …we mean, “Greater Than Code!”

01:02 – Steve’s Background, Origin Story, and Superpowers!

Skrillex

06:00 – Contributing to Open Source

_why the lucky stiff

Hacket…

Tech Tips and Freebies – Rubyroid Labs Blog 

7 Gems Which Will Make Your Rails Code Look Awesome

Reading Time: 6 minutes


In Rubyroid Labs we are very passionate about application architecture. Most projects we work here are long-term projects, so if you are not beeing careful about your application design at some point you will find yourself in a position where in order to add a new feature it’s just easier to rebuild the whole project from the scratch. And it’s definitely not something you want to face up with.

One of the bad signs that your project is getting sick is that new team members spend a significant amount of time just reading through the source code in order to understand the logic. Today we want share a list of different gems, which in our opinion can help you to organize…

Hi, we're Arkency 

Event-sourcing whole app — opinions

You might have heard the “Event-sourcing your whole app in an anti-pattern” meme. It’s not uncommon to get exposed to it once you find yourself speaking with another practitioner of this technique.

I had — just recently, on a Rails DDD training that we’ve organized. To be honest I’ve heard about it before. This time however it provoked me to dig deeper. To find the reasons which led to formulate it. To understand the context in which it makes most sense.

Struggling with finding Senior Ruby developers? - Show your job post here and reach thousands of developers quickly.

The opinions

No surprise that the original quote comes from the godfather…

Riding Rails 

This Week in Rails: HTTP/2 Early hints, friendly error message and more!

Hi there! It’s Prathamesh from Pune, enjoying rain 🌧, sipping ☕️ coffee  and bringing you latest news from the Rails world. Let’s get started!

This Week’s Contributors

13 people contributed to Rails the past week! If you’d like to join them, why not check out the list of open issues?

HTTP2 early hints support for Rails

Early Hints is a new HTTP status code that allows your application to send links to assets that you would like to load early. The spec is still in draft but Rails is ready to support it along with Puma. Check this blog post to know more about this feature.

Friendly error message when unsubscribing from non-existent Action Cable subscription

If for some reason the…

Ruby Weekly 

#369: Could We Drop Symbols From Ruby?

Ruby Weekly Issue 369 — October 5, 2017
Robert Pankowecki
A potentially controversial thought experiment here. Could symbols simply be replaced by frozen, immutable strings?


Ruby Dev Summit
It takes place October 16-21 and has a lot of great speakers including Matz and Michael Hartl (of Rails Tutorial fame).


Redisgreen  Sponsored
Redis 4.0 is out and available on RedisGreen with full visualization of your memory usage and top-tier performance.


Daniel Westendorf
The idea is that slow…
Blogs on Luca Guidi 

Introducing hanami-cli

Introducing hanami-cli: a general purpose Command Line Interface (CLI) for Ruby. Learn why Hanami replaced thor in favor of hanami-cli and how to use it to build a CLI application in 5 minutes. Why not thor? For long time we used thor 🔨 to build the Command Line Interface (CLI) of Hanami. But as the time passed, we needed more control on the internals of our implementation. The Hanami 🌸 command line needs two crucial features: subcommands and extendibility.
Ruby News 

Ruby 2.5.0-preview1 Released

We are pleased to announce the release of Ruby 2.5.0-preview1.

Ruby 2.5.0-preview1 is the first preview release toward Ruby 2.5.0. It introduces some new features and performance improvements, for example:

New Features

  • Print backtrace and error message in reverse order if STDERR is unchanged and a tty. [Feature #8661] [experimental]

  • Top-level constant look-up is removed. [Feature #11547]

  • rescue/else/ensure are allowed inside do/end blocks. [Feature #12906]

  • yield_self [Feature #6721]

Other notable changes since 2.4

  • Merge Onigmo to 6.1.1. It adds absent operator Note that Ruby 2.4.1 also includes this change.
  • Merge bundler to standard…
All Ruby Podcasts by Devchat.tv 

RR 331: 30 days to Elixir then Crystal and back again to Ruby with Fabio Akita

Panel:

Charles Max Wood

Dave Kimura

Eric Berry

Brian Hogan

Special Guest: 

Fabio Akita

The Ruby Rouges speak with Fabio Akita, a return guess. Fabio is a blogger at AkitaOnRails.com and is an organizer and speaker at Ruby Dev. Conf. Brazil. Fabio mentions have minor open source projects. Fabio talks revolve around “How do you as a Ruby Developer, dive into new languages,” such as Crystal and Elixir. Fabio will be speaking on the upcoming Ruby Dev Summit.

In particular, we dive pretty deep on:

  • Should we just all just go to Elixir?
  • Problems with choosing and staying with one language?
  • Ruby is a ZPE language or 0.8 languages.
  • Ruby on Rail was never a full solution.
  • Elixir is not…
RubyGems Blog 

2.6.14 Released

RubyGems 2.6.14 includes security fixes.

To update to the latest RubyGems you can run:

gem update --system

If you need to upgrade or downgrade please follow the how to upgrade/downgrade RubyGems instructions. To install RubyGems by hand see the Download RubyGems page.

Security fixes:

  • Whitelist classes and symbols that are in loaded YAML. See CVE-2017-0903 for full details. Fix by Aaron Patterson.

SHA256 Checksums:

  • rubygems-2.6.14.tgz
    406a45d258707f52241843e9c7902bbdcf00e7edc3e88cdb79c46659b47851ec
  • rubygems-2.6.14.zip
    247d1b704bc1b56cf2f8d26a663ea8b35aec990465cea662181d195a4ad06055
  • rubygems-update-2.6.14.gem
    ecaedf77483549e73a33a6779f4769aff6198c7f50df124256cc869cc905ffae
RubyGems Blog 

Unsafe Object Deserialization Vulnerability in RubyGems

Hello everyone! An unsafe object deserialization vulnerability was found in RubyGems. Unfortunately this vulnerability can be used as a way to escalate to a remote code execution exploit. The good news is that this issue was responsibly reported to the RubyGems team by Max Justicz, and we were able to promptly fix it. The RubyGems team audited all Gems, and using the data available to us we can say we have high confidence that no recently published Gems have been impacted, but due to the amount of time this bug has been in production, we cannot say for sure that zero Gems have been impacted.

You can read the CVE announcement for RubyGems here.

What was the bug?

This bug was an “unsafe…

BigBinary Blog 

Rails 5.2 adds expiry option for signed and encrypted cookies and adds relative expiry time

In Rails 5.1 we have option to set expiry for cookies.

cookies[:username] = {value: "sam_smith", expiry: Time.now + 4.hours}

The above code sets cookie which expires in 4 hours.

The expiry option, is not supported for signed and encrypted cookies. In other words we are not able to decide on server side when an encrypted or signed cookie would expire.

From Rails 5.2, we’ll be able to set expiry for encrypted and signed cookies as well.

cookies.encrypted[:firstname] = { value: "Sam", expiry: Time.now + 1.day }
# sets string `Sam` in an encrypted `firstname` cookie for 1 day.

cookies.signed[:lastname] =  {value: "Smith", expiry: Time.now + 1.hour }
# sets string `Smith` in a signed…
RubyGuides 

7 Little-Known Ruby Methods To Help You Write Better Code

Did you know that using the right Ruby method can save you a lot of work? The more methods you are familiar with the faster you can produce working code & the better this code will be (both in performance & quality). That’s why today I want to introduce 7 interesting methods to you that […]

The post 7 Little-Known Ruby Methods To Help You Write Better Code appeared first on RubyGuides. Don't miss your free gift here :)

Ruby – Sihui Huang 

Who are you? Self-awareness In Ruby

Understanding how self works is critical in reading Ruby code. If you ever feel confused or lost when reading a piece of Ruby code, exam what is self in the current context might get you back on track. It’s one of those things that once you get it, many Ruby codes will start making sense to you.

This article explains:

  1. what is self
  2. how to determine self

What Is Self?

Self is a keyword in Ruby representing the default object of the current context.

Being the default object of the current context gives self two privileges.

  1. It is the default receiver of messages, meaning calling a_method is the same as calling self.a_method
  2. It is the owner of instance variables.

    The buttermilk…

Devon C. Estes - Articles 

Everything you need to know about Elixir's new formatter

It’s been a big weekend! The new formatter that José mentioned in his ElixirConf talk is finally here! It landed on Sunday, and that means we can now poke around in the code to see everything that it does and answer a few burning questions.

Drifting Ruby Screencasts 

Basic Testing Introduction in Rails

Using the Rails 5.1.X defaults, we have a look at what is configured and explore the different types of tests; using the provided MiniTest and Capybara.
Jon McCartie 

Building Healthy Teams - Elevate Summit, Denver

In preparation for speaking at Elevate Summit in Denver, I prepared this script for my talk. I wasn’t able to memorize it fully, so wanted to share it in text since there were a few key points that may be easier to digest in this format. The video of the talk is embedded at the end. 👍


Intro

After working in corporate-land right out of college, an opportunity came up to join a hot new startup in San Francisco. I just bought an outrageously overpriced first home (thanks housing bubble) and was very excited for my massive startup payday. So we packed up the moving truck and headed to the Bay.

The first few months were very exciting. Our small team was a powerhouse and we were getting…

Posts 

PDF Filter Implementation in HexaPDF Using Fibers

In the previous post about HexaPDF I introduced the basic PDF object system. This post will focus on one of the available object types, PDF streams and their filters.

If you are already familiar with the basics of PDF streams and filters, jump down to the section about their implementation in HexaPDF.

PDF Streams

As described in the previous post, a PDF stream represents a potentially unlimited sequence of bytes. Each stream has also some meta data associated with it and this meta data is represented by a PDF dictionary. Since a stream is not limited in size it is used to hold data like images, font files or content streams of pages (i.e. the instructions that tell a PDF viewer what to…

Appfolio Engineering 

Joining Us From RubyKaigi?

At my RubyKaigi talk, I suggested that further information on Ruby performance will be forthcoming here -- and it will.

A gentleman from EngineYard, however, first asked me, "are there any other factors that I wish I had time to cover in my talk and didn't have time?"

OH YES. This is my response to him:


The short answer is "yes, there are a number of factors and I've written blog posts about several of them."

Garbage collection, for instance, is a huge factor. Between Ruby 2.0 and 2.3, the garbage collector changed enormously. And in a high-concurrency, high-memory-usage scenario like mine, it's fair to ask the question, "was the whole difference a matter of garbage collection?" I wrote a blog…

Glauco Custódio 

Pentaho Data Integration: You Need to Know

Today I wanna share something nice I've been using: Pentaho Data Integration (aka Kettle).

As the name says, PDI is a powerful tool for manipulating and integrating data accross multiple souces (databases, files, APIs, CRMs etc).

Imagine you have two applications (products) with distinct databases: one PostgreSQL and other SQL Server.

How can we cross customers from the two databases?

This process of extracting, transforming and loading data is called ETL, and PDI is meant for that.

How it works

The building blocks of PDI are: job and transformation.

A transformation is where the magic happens and a job is a set of transformations.

Both can be stored locally or in a remote…

Test Double | Our Thinking 

Solving the Boolean Identity Crisis

The video above was recorded at Elm Conf 2017.

While powerful in its simplicity and important to computation, the boolean can be extremely limiting in Elm applications. In this talk, briefly explore the history of boolean logic in computation and look at how booleans can become misused in Elm. See how booleans obscure the meaning of code, make code harder to maintain, and hinder usability for our teammates and users. By watching this talk, you will learn how to harness union types to write cleaner, clearer code. More importantly, you will learn how to place usability at the forefront of the APIs and UIs you build.

Booleans create problems in four key areas:

  1. Boolean arguments make function…
Search Results for “ruby” – via @codeship 

Integrating Codecov with Codeship

Reading Time: 2 minutes

At Codeship, we’re pleased to be able to integrate with several third-party products across a variety of areas to ensure your CI/CD workflows are that much smoother. For example, Codecov is an automated code-coverage service that helps you enforce standards of code quality and transparency with your engineering team.

Getting started with Codecov and Codeship is fast and easy. Their documentation does a great job of providing more information, in addition to the setup instructions below. Let’s begin with the Codeship Pro setup.

Getting Started with Codecov and Codeship Pro

First of all, add your CODECOV_TOKEN to the encrypted environment variables that you encrypt and…

BigBinary Blog 

Optimize JavaScript code for composability with Ramda.js

In this blog R stands for Ramda.js. More on this later.

Here is code without R.

function isUnique(element, selector) {
  const parent = element.parentNode;
  const elements = parents.querySelectorAll(selector);
  return (elements.length === 1) && (elements[0] === element);
}

Code with R.

function isUnique(element, selector) {
  const querySelectorAll = R.invoker(1, 'querySelectorAll')(selector);

  return R.pipe(
    R.prop('parentNode'),
    querySelectorAll,
    elements => R.both(
                  R.equals(R.length(elements), 1),
                  R.equals(elements[0], element)
                );
  )();
}

Is the refactored code better ?

What is R? What’s invoker? What’s pipe?

The…

Michał Łomnicki 

Yes, Ruby would be better without Symbols

Logo

Robert Pankowecki published a fascinating article titled “Could we drop Symbols from Ruby?”.

For me symbols are one of the most annoying features in Ruby so I instantly thought “Yes! That’s a great idea”.

Awesome Ruby Newsletter 

Issue 73 - Lifelong Rubyist makes some Python code 5x Faster

Michał Łomnicki 

Yes, Ruby would be better without Symbols

Logo

Robert Pankowecki published a fascinating article titled “Could we drop Symbols from Ruby?”.

For me symbols are one of the most annoying features in Ruby so I instantly thought “Yes! That’s a great idea”.

Ruby Weekly 

#369: Could We Drop Symbols From Ruby?

This week's Ruby and Rails news
Read this e-mail on the Web Ruby Weekly Issue 369 — October 5, 2017
Robert Pankowecki
A potentially controversial thought experiment here. Could symbols simply be replaced by frozen, immutable strings?


Ruby Dev Summit
It takes place October 16-21 and has a lot of great speakers including Matz and Michael Hartl (of Rails Tutorial fame).


Redisgreen  Sponsored
Redis 4.0 is out and available on RedisGreen with full visualization of your memory usage and top-tier performance.

Redisgreen
Daniel Westendorf
The Bike Shed 

126: Speaking of Compilers...

We discuss a major change to Diesel's insert statements in advance of its 1.0 release and reexamine Contracts.ruby after Derek spends some time with it in use.

Hi, we're Arkency 

Could we drop Symbols from Ruby?

Don’t know about you, but I personally have been hit a least a dozen times by bugs caused by strings vs symbols distinction. That happened in my own code, and it happened when using some other libraries as well. I like how symbols look in the code, but I don’t like the specific distinction that is made between them and strings. In my (perhaps controversial opinion) they introduce more problems than they solve.

Struggling with finding Senior Ruby developers? - Show your job post here and reach thousands of developers quickly.

So I was thinking… Maybe we could drop them? Sounds radical right? But I don’t think rewriting thousands of Ruby…

EquiValent - Web Developer Blogs 

Deep dive into Cloud coding

Cloud Coding is a method of developing software on a remote VM. In this article I'll give you some insight on benefits and the flow.
Hi, we're Arkency 

Which ruby version am I using? - how to check

Are you not sure which Ruby version you are using right now? Wondering how to check it? Say no more. Here are two simple ways to check for it.

Struggling with finding Senior Ruby developers? - Show your job post here and reach thousands of developers quickly.

In irb

Run irb and type:

RUBY_VERSION
# => "2.4.1"

from command line

Just type ruby -v

$ ruby -v
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]

in rvm

Are you using RVM?

Run rvm current and get the answer

$ rvm current
ruby-2.4.1

in rbenv

Are you using rbenv? Just run rbenv version

$ rbenv version
2.4.1p111 (set by /Users/rupert/.rbenv/version)

using which

Do you want to know…

Hi, we're Arkency 

One simple trick to make Event Sourcing click

Event Sourcing is like having two methods when previously there was one. There — I’ve said it.

Struggling with finding Senior Ruby developers? - Show your job post here and reach thousands of developers quickly.

But it isn’t my idea at all.

It was Greg that used it first, in a bit different context. When explaining CQRS he used this exact words:

Starting with CQRS, CQRS is simply the creation of two objects where there was previously only one. The separation occurs based upon whether the methods are a command or a query (the same definition that is used by Meyer in Command and Query Separation, a command is any method that mutates state…

You can…

Depfu 

On Bundler 2.0 compatibility

Well that was awkward. When I wrote our last article about the transition from Gemfile to gems.rb, the “official document” about the Bundler 2.0 transition stated that Gemfile will be removed in Bundler 3.0 but since we published that article, the RFC has been changed to remove that note, probably due to pressure from the community. We’ve updated the article, but if you’re too lazy to read it again: Gemfile and Gemfile.lock are probably not going away any time soon ¯\_(ツ)_/¯.

Of course the main point of my article still stands: While it is trivial to migrate a single project by renaming the Gemfile to gems.rb and Gemfile.lock to gems.locked, it’s quite a different thing to make the whole…

BigBinary Blog 

Elm Conf 2017 Summary

I attended Elm Conf 2017 US last week alongside Strangeloop conference. I was looking forward to the conference to know what the Elm community is working on and what problems people are facing and what are they doing to overcome those.

After attending the conference, I can say that Elm community is growing strong. The conference was attended by around 350 people and many were using Elm in production. More number of people wanted to try Elm in production.

There was a lot of enthusiasm about starting new Elm meetups. As a Ruby on Rails and React meetup organizer myself, I was genuinely interested in hearing experiences of seasoned meetup organizers. In general Evan and Richard prefer meetup…

Hanami 

Announcing Hanami v1.1.0.beta3

Hello wonderful community!

On yesterday I released v1.1.0.beta2, but it was broken 😭.

My sincere apologize, folks. 🙏

I quickly fixed the problem and released a new version: v1.1.0.beta3.

Released Gems

  • hanami-1.1.0.beta3
  • hanami-model-1.1.0.beta3
  • hanami-assets-1.1.0.beta3
  • hanami-cli-0.1.0.beta3
  • hanami-mailer-1.1.0.beta3
  • hanami-helpers-1.1.0.beta3
  • hanami-view-1.1.0.beta3
  • hamami-controller-1.1.0.beta3
  • hanami-router-1.1.0.beta3
  • hanami-validations-1.1.0.beta3
  • hanami-utils-1.1.0.beta3

How to try it

If you want to try with a new project:

gem install hanami --pre
hanami new bookshelf

If you want to upgrade your existing…

All Ruby Podcasts by Devchat.tv 

MRS 23: Adam Cuppy

This week on My Ruby Story, Charles speaks with Adam Cuppy. Adam is the co-founder at Zeal, a software consultancy that specializes in web and mobile applications. Adam describes his journey as an actor in theater and fine arts, then made his way into tech. Adam has been working and contributing to the Ruby community for at least the last decade.

In this episode, we learn more about how Adam got into programming.  Adam talks about having to learn JavaScript and HTML to build a contact page, this was  Adam's the initial spark into programming. Adam talks about how he got into Ruby and the swiftness in building amazing programs and tools.  Adam talks about his contributions, favorite things…

Alfredo Motta 

EuRuKo 2017 talks shortlist

Last week I attended the 2017 European Ruby Conference in Budapest. Here is a shortlist of the talks I enjoyed the most and some thoughts on the conference in general. The conference First and foremost this has been the biggest European Ruby conference in 15 years. A demonstration that the community is strong and working […]
Greater Than Code 

049: Technology For the Greater Good with Reyn Aubrey

This episode is sponsored by Upside!

Bundle your flights and hotel. Save money. Earn gift cards.


Panelists:

Rein Henrichs | Jamey Hampton | Coraline Ada Ehmke

Guest Starring:

Reyn Aubrey: @ReynAubrey | PocketChange | reyn@pocketchange.social

Show Notes:

00:16 – Welcome to “For Good or For Awesome?” …we mean, “Greater Than Code!”

01:18 – Reyn Aubrey’s Background, Origin Story, and Superpower!

06:04 – Culture of a Company and Tolerance

Tribes: We Need You to Lead Us by Seth Godin

08:12 – Becoming an Entrepreneur at 19-years-old and PocketChange

10:40 – Charity Evaluation Criteria; “Wicked Problems”

pocketchange.social/charities (Coming Soon)

14:33 – Habitizing Donation

16:22 – Analyzing…

Hanami 

Announcing Hanami v1.1.0.beta2

Hello wonderful community!

Today we're happy to announce v1.1.0.beta2 release 🙌 , with the stable release (v1.1.0) scheduled later this month.

Features

So what's new and exiciting in the Hanami world?

Hanami plugins

We're starting to support Hanami plugins. Hanami plugins are gems that can integrate with Hanami projects.

The first thing plugins are be able to do is to provide custom CLI commands. A developer that needs to use a plugin, can add it to the :plugins group to the Gemfile.

# Gemfile
# ...

group :plugins do
  gem "hanami-reloader"
end

Here's a first working example of how to implement it: hanami-reloader. It's…

GoRails Screencasts 

Using the Trix Editor plus File Upload Attachments

Learn how to use the Trix editor for editing wysiwyg content and upload attachments like images using Javascript and Shrine
All Ruby Podcasts by Devchat.tv 

RR 330: Functions vs Methods with Devon Estes

Panel:

Charles Max Wood

Dave Kimura

Eric Berry

Special Guest: 

Devon Estes

The Ruby Rouges speak with Devon Estes, a return guess and Ruby developer who currently lives in Berlin, Germany. The topic of discussion is about Function vs. Methods, and talk about blocks and its functions. Also, some further digging into the behaviors of functions and designs. Devon explains that this topic will be of discussion at Ruby Dev Conf.

Devon dives into the object orientation and the interactions between functions, editing or changing functions. The Ruby Rogues ask questions about, service functions, subsections of applications, application logic, and understanding the parts.

In particular, we…

Cognito Blog 

How Identity Verification Works in a Post-SSN World

140M leaked identities

SSNs are dead. The most recent Equifax hack confirms that.

In a post-SSN world, using one for authenticating an identity is a recklessly insecure business practice that will leave you susceptible to fraud.

For years, we at Cognito have been trying to find ways to move past the old world of identity verification that relies on possession of data. Not only are the industry-standard methods of KBA and SSN verification insecure, but they are also onerous for your customers. The Social Security Number was never supposed to be the private key to your life as it is used today. It emerged as one because it was purported to be secret; the act of knowing a Social Security Number was considered…

Schneems - Programming Practices, Performance, and Pedantry 

Lifelong Rubyist makes some Python code 5x Faster

I’ve been writing Ruby code for the past 10+ years, and recently due to my masters courses, I’ve been writing a lot of Python. While there are many differences, one area of similarity is their performance characteristics and how code can be optimized. In this post I’m going to look at a bit of Python code I optimized recently, and then compare the process of making this code faster to the process of how I make Ruby code faster.

AkitaOnRails.com 

THE CONF - 2017 Edition Report

TL;DR: The event was very successful!

audience

First and foremost, thanks to everybody that not only believed in the concept but actively helped us through this journey.

I posted about the concept on October 20, 2016, in "THE CONF Initiative" blog post. Everybody that has been paying attention to Twitter, Facebook, LinkedIn, Facebook Groups (Ruby on Rails, Go, Xamarin, Security, etc) saw the SEVERAL posts I have been doing in the past few months in multiple channels (sorry for the mini spam).

In the very same day I got this e-mail from InfoQ (who I didn't know before):

C4Media

This is how InfoQ joined us. They directly sponsored all the video recording and editing, and they will upload all the talks

RubyGuides 

Build an Image Downloader in Ruby

Build an Image Downloader in Ruby Watch this video to learn how to build an image dowloader program step-by-step using Ruby, Nokogiri & RestClient! Starting a new project & not sure where to start? Write down a plan! The plan for this project: [crayon-59e6906b77a03909120539/] In the video I explain every step in detail. Code: [crayon-59e6906b77a0d957503314/] […]

The post Build an Image Downloader in Ruby appeared first on RubyGuides. Don't miss your free gift here :)

Ruby – Sihui Huang 

Design Pattern: Singleton and YOU

Design patterns in life and Ruby — gain an intuitive understanding of OO design patterns by linking them with real-life examples.

 

This might be the most important post in my Design Pattern series because this one is about YOU.

Before anything, you need to listen to this song:

 

No, I’m serious.

The song is less than 2 minutes.

Listened to the song before you read any further.

 

Let’s take a look at the lyrics of the song:

Stand tall.

 

You’re in a class by yourself.

 

Be proud.

 

You’re not like anyone else.

 

No doubt about it. You’re second to none.

 

’Cause you are the one and only one.

 

Chin up.

 

’Cause you are one of a kind.

 

Chest out.

 

We know that we’ll never find anyone…

 

You’re in a…

Hanami 

Documentation Challenge

🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸

Hello wonderful community!

We would like to improve our documentation in October and we need your help. 🙌

Make a contribution to the Hanami guides in the following repository: https://github.com/hanami/hanami.github.io.

Every contribution will be awarded with new (and improved) Hanami stickers. Very eager contributors will receive larger gadgets, such as t-shirts.

Do you need some inspiration? Maybe have a look at these ideas, or write about repositories, and validations.

We appreciate every contribution ❤️.

🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸🌸

Andy Croll 

Don’t use default_scope. Ever.

When you would like a scope to be applied across all queries on a model, you can use default_scope. See more in the ActiveRecord Query Guide and Rails docs.


Where you have a blog system with posts that can be set to be hidden, for when you are writing a draft.

Instead of…

default_scope.

# app/models/post.rb
class Post < ActiveRecord::Base
  default_scope { where(hidden: false) }
end

Use…

…explicit scopes.

# app/models/post.rb
class Post < ActiveRecord::Base
  scope, :published -> { where(hidden: false) }
end

…then you can do…

Post.published

But why?

Two reasons. Both to do with avoiding later confusion and bug hunting.

Adding a default scope affects your model…

Andy Croll 

Use Rails’ naming conventions for dates & times

Rails includes the default managed timestamps updated_at and created_at for ActiveRecord models.

However, on many applications, diving into a schema.rb or migration often reveals something_date as a field name on a model.

Instead of…

…including the words date or time in your database columns:

class NaughtyMigration < ActiveRecord::Migration[5.1]
  add_column :users, :logged_in_date, :datetime
  add_column :users, :logged_out_time, :date
end

Use…

…the suffix at for times and on for dates.

class AwesomeMigration < ActiveRecord::Migration[5.1]
  add_column :users, :logged_in_at, :datetime
  add_column :users, :logged_out_on, :date
end

But why?

Including the word time or date in…

BigBinary Blog 

CSV::Row#each etc. return enumerator when no block given

This blog is part of our Ruby 2.4 series.

In Ruby 2.3, These methods do not return enumerator when no block is given.

Ruby 2.3

CSV::Row.new(%w(banana mango), [1,2]).each #=> #<CSV::Row "banana":1 "mango":2>

CSV::Row.new(%w(banana mango), [1,2]).delete_if #=> #<CSV::Row "banana":1 "mango":2>

Some methods raise exception because of this behavior.

> ruby -rcsv -e 'CSV::Table.new([CSV::Row.new(%w{banana mango}, [1, 2])]).by_col.each'
 #=> /Users/sushant/.rbenv/versions/2.3.0/lib/ruby/2.3.0/csv.rb:850:in `block in each': undefined method `[]' for nil:NilClass (NoMethodError)
  from /Users/sushant/.rbenv/versions/2.3.0/lib/ruby/2.3.0/csv.rb:850:in `each'
  from…

Ruby 2.4 fixed this issue.

Ruby 2.4

CSV::Row.new(%w(banana mango), [1,2]).each #=> #<Enumerator: #<CSV::Row "banana":1 "mango":2>:each>

CSV::Row.new(%w(banana mango), [1,2]).delete_if #=> #<Enumerator: #<CSV::Row…

As we can see, these methods now return an enumerator when no block is given.

In Ruby 2.4 following code will not…

BigBinary Blog 

Ruby 2.4 has optimized enumerable min max methods

This blog is part of our Ruby 2.4 series.

Enumerables in Ruby have min, max and minmax comparison methods which are quite convenient to use.

(1..99).min         #=> 1
(1..99).max         #=> 99
(1..99).minmax      #=> [1, 99]

In Ruby 2.4, Enumurable#min, Enumurable#max methods and Enumurable#minmax method are now more optimized.

We would run the following benchmark snippet for both Ruby 2.3 and Ruby 2.4 and observe the results

require 'benchmark/ips'

Benchmark.ips do |bench|
  NUM1 = 1_000_000.times.map { rand }

  ENUM_MIN = Enumerable.instance_method(:min).bind(NUM1)
  ENUM_MAX = Enumerable.instance_method(:max).bind(NUM1)
  ENUM_MINMAX = Enumerable.instance_method(:minmax).bind(NUM1

Results for Ruby 2.3

Warming up -----…
Mike Perham 

Retries and Exceptions

Do you hate getting your inbox filled with errors you know you can ignore? Here's one cool trick to make them disappear.

If you are writing a background job, it is best practice to have that job retry in the case of unexpected errors. Networks can be flaky, code can be buggy, data can be sketchy -- as they say, "stuff happens".

Sidekiq's default policy for jobs and retries is simple:

  • if a job returns normally, it is considered a success.
  • if a job raises an error, the error is reported and a retry is scheduled.

Many people have asked me: "I have a flaky service, how can I retry the job without reporting the error to my error service and filling my inbox". Sometimes the asker will…

Red Panthers 

Gulp

Gulp is a toolkit for automating painful or time-consuming tasks in your development workflow, so you can stop messing around and build something. You can compile sass files, uglify and compress js files and much more.

Installation

Make sure that you’ve installed Node and npm before attempting to install gulp.

Install the gulp command

npm install --global gulp-cli

Make sure that you have your package.json created by manually creating it or typing npm init.

Run this command in your project directory:

npm install --save-dev gulp

Create a gulpfile

In your project directory, create a file named gulpfile.js in your project root with these contents:

var gulp = require('gulp');

gulp.task('task-name',…
Awesome Ruby Newsletter 

Issue 72 - Pry - an IRB alternative and runtime developer console

Ruby – Sihui Huang 

Design Pattern: Observer and Podcasts

Design patterns in life and Ruby — gain an intuitive understanding of OO design patterns by linking them with real-life examples.

 

If you listen to podcasts, you are already familiar with the Observer pattern. In fact, you are an “observer”.

Here’s the definition for the Observer pattern:

The Observer pattern defines a one-to-many dependency between objects so that when one object changes state, all of its dependents are notified and updated automatically.

 

Let’s look at the definition as related to podcasts.

I find an interesting podcast named developer tea.

After clicking the SUBSCRIBE button, I’m now on their subscriber list.

 

When developer tea releases a new episode, the…

Michał Łomnicki 

yield_self in Ruby 2.5

Pipes

Ruby 2.5 adds a very interesting method Object#yield_self.

Depfu 

Depfu now flags security updates

Ever since we started working on Depfu, we knew that we wanted to add special handling of security updates. Security has always been one of Depfu’s main selling points: Only an up-to-date application is a secure application. But until now the Depfu robots didn’t have any idea if an update was actually important for the security of your application.

Today, we released our first version of flagging security relevant dependency updates. Here’s how that works:

As soon as Depfu notices that a certain gem update is due to a security vulnerability, we’ll try to make sure that you will get the update PR as quickly as possible, with the best fitting version and with all needed information to…

Ruby Inside - Medium 

Perusing delegate.rb from Ruby’s Standard Library

CC BY-SA 3.0 Nick Youngson (http://www.thebluediamondgallery.com/wooden-tile/d/delegate.html)

It is a rather common claim that Object Oriented programming is a lot about passing messages between objects. Also, OO encourages us to find the right nouns and verbs in order to solve a given problem. I often like to think about a program as a theatrical stage, upon which participants act and speak with each other. Sometimes, though, a character might need to say something to another character through a third participant; that go-between actor would be asked to delegate the message to the target character. Back to programming, delegation

…refers to evaluating a member (property or method) of one…
The Bike Shed 

125: Less Bad Than Expected

We share and discuss some user feedback on fakes and mocks, discuss the benefits and drawbacks to FactoryGirl and share exasperation over the handling of the Equifax data breach.

BigBinary Blog 

CSV::Row#each etc. return enumerator when no block given

This blog is part of our Ruby 2.4 series.

In Ruby 2.3, These methods do not return enumerator when no block is given.

Ruby 2.3

CSV::Row.new(%w(banana mango), [1,2]).each #=> #<CSV::Row "banana":1 "mango":2>

CSV::Row.new(%w(banana mango), [1,2]).delete_if #=> #<CSV::Row "banana":1 "mango":2>

Some methods raise exception because of this behavior.

> ruby -rcsv -e 'CSV::Table.new([CSV::Row.new(%w{banana mango}, [1, 2])]).by_col.each'
 #=> /Users/sushant/.rbenv/versions/2.3.0/lib/ruby/2.3.0/csv.rb:850:in `block in each': undefined method `[]' for nil:NilClass (NoMethodError)
  from /Users/sushant/.rbenv/versions/2.3.0/lib/ruby/2.3.0/csv.rb:850:in `each'
  from…

Ruby 2.4 fixed this issue.

Ruby 2.4

CSV::Row.new(%w(banana mango), [1,2]).each #=> #<Enumerator: #<CSV::Row "banana":1 "mango":2>:each>

CSV::Row.new(%w(banana mango), [1,2]).delete_if #=> #<Enumerator: #<CSV::Row…

As we can see, these methods now return an enumerator when no block is given.

In Ruby 2.4 following code will not…

BigBinary Blog 

Ruby 2.4 has optimized enumerable min max methods

This blog is part of our Ruby 2.4 series.

Enumerables in Ruby have min, max and minmax comparison methods which are quite convenient to use.

(1..99).min         #=> 1
(1..99).max         #=> 99
(1..99).minmax      #=> [1, 99]

In Ruby 2.4, Enumurable#min, Enumurable#max methods and Enumurable#minmax method are now more optimized.

We would run the following benchmark snippet for both Ruby 2.3 and Ruby 2.4 and observe the results

require 'benchmark/ips'

Benchmark.ips do |bench|
  NUM1 = 1_000_000.times.map { rand }

  ENUM_MIN = Enumerable.instance_method(:min).bind(NUM1)
  ENUM_MAX = Enumerable.instance_method(:max).bind(NUM1)
  ENUM_MINMAX = Enumerable.instance_method(:minmax).bind(NUM1

Results for Ruby 2.3

Warming up -----…
Kir Shatrov blog 

SREcon Europe 2017: impressions

Earlier this month I went to SREcon Europe in Dublin. This was my first SRE and non-Ruby conference, and it was quite different from the conferences I attended before. I decided to write a quick post about with my impressions and the talks that I liked the most.

The conference takes three days and each day has 4-5 tracks. That’s almost as huge as RailsConf (which is up to 7 tracks). Sometimes I found it hard to choose between talks, especially when you had to forgo three talks to attend a two hour workshop.

Speaking of them, SREcon was full of workshops! Even that I couldn’t stay for all of them, I think the variety of workshops was quite diverse: statistics for engineers, mastering…

Ruby Weekly 

#368: Visualizing Your Ruby Heap

This week's Ruby and Rails news
Read this e-mail on the Web Ruby Weekly Issue 368 — September 28, 2017
Aaron Patterson
Core team member Aaron ‘tenderlove’ Patterson digs into what it takes to write a program for visualizing Ruby heap dumps.


YouTube
A truly rich array of sessions (in both English and Japanese) from Ruby’s ‘home’ conference. How about a talk on Bundler 2.0? Or an update on JRuby? Or Hanami?


Michał Łomnicki
Makes it possible to chain operations in a different way to usual.


OpsCare by reinteractive  Sponsored
Our…
Michał Łomnicki 

yield_self in Ruby 2.5

Pipes

Ruby 2.5 adds a very interesting method Object#yield_self.

Ruby Weekly 

#368: Visualizing Your Ruby Heap

Ruby Weekly Issue 368 — September 28, 2017
Aaron Patterson
Core team member Aaron ‘tenderlove’ Patterson digs into what it takes to write a program for visualizing Ruby heap dumps.


YouTube
A truly rich array of sessions (in both English and Japanese) from Ruby’s ‘home’ conference. How about a talk on Bundler 2.0? Or an update on JRuby? Or Hanami?


Michał Łomnicki
Makes it possible to chain operations in a different way to usual.


OpsCare by reinteractive  Sponsored
Our out-source DevOps solves the problems associated with ROR…
Tender Lovemaking 

Visualizing Your Ruby Heap

In a previous post, I wrote a bit about how Ruby objects are laid out in memory. Today we’ll use that information to write a program that will allow us to take a Ruby heap dump and visualize the layout and fragmentation of that heap.

Ruby Object Layout Recap

Just as a recap, Ruby objects are fixed width. That is, every Ruby object is the same size: 40 bytes. Objects are not really allocated with malloc, but instead they are placed inside of pages.

A Ruby process has many pages. Pages have many objects.

Which Page Does This Object Belong To?

Objects are allocated in to a page. Each page is 2 ^ 14th bytes. In other words, Ruby objects aren’t allocated one at a time, but the GC…

Schneems - Programming Practices, Performance, and Pedantry 

Gaijin Guide to RubyKaigi

Okay Gaijin you think you’re ready for RubyKaigi? I’m no expert, but I’ve been a few times and I want to share what I wish someone had told me about attending the conference as an outsider.

Schneems - Programming Practices, Performance, and Pedantry 

RubyKaigi 2017 Day 1

This is my third RubyKaigi and my first in Hiroshima. This is also the first time where I’m not speaking (though I am on the waitlist).

Riding Rails 

Rails 4.2.10 released

Hi everyone,

I am happy to announce that Rails 4.2.10 final has been released!

As noted in the rc1 post, Rails 4.2 is no longer supported except for severe security patches, but the last release introduced a couple regressions that warranted a release. Unless more regressions are found this will likely be the last bug fix release for Rails 4.2. :champagne:

CHANGES since 4.2.9

The following gems had changes since 4.2.9. Changes are listed below, or you can read the CHANGELOG’s on GitHub:

Fix regression in behavior of normalize_path.

In Rails 5 there was a change to ensure the encoding of the original string in a path was maintained. This was…

All Ruby Podcasts by Devchat.tv 

MRS 022: Allison McMillan

This week on My Ruby Story, Charles speaks with Allison McMillan. Allison is a software developer at Collective Idea, a software consulting company that solves real-world software problems. Allison is very excited about working on a number of projects and learning new things in the development world. Allison was a recent guest on Ruby Rogues and will be a speaker at Ruby Dev Summit coming up on October 16-21, 2017.

In this episode we learn more about Allison’s journey as a startup founder, to make a career change to a developer, all while and making a name in the dev community and gaining a dev job. Allison talks about her involvement and contributions to the Ruby community.

In…

Drivy Engineering 

Evolution Of Our Continuous Delivery Process

We’ve always valued releasing quickly, as unreleased code is basically inventory. It slowly gathers dust and becomes outdated or costs time to be kept updated. Almost 3 years ago we published an article “Drivy, version 500!” on our main blog, so I feel now is the time to get more into the details of how we accomplish pushing a lot of new versions of the app to production.

Our Different Iterations

As in most cases, we keep 改善 in mind and go for continuous improvement over one huge definitive solution straight away. We don’t try to build the perfectly automated system that handles all cases, when there are only 2 developers and no users. Probably obvious, but it’s something always worth…

Red Panthers 

Background Workers using Crontab

Scheduling background jobs is a common task in rails application development. Eventually what we want is a cron job which runs the schedule jobs.

cron is the system process which will automatically perform tasks for you according to a set schedule. The schedule is called the crontab, which is also the name of the program used to edit that schedule.

For example, let’s say you have a rake task which you want to run every hour.

namespace :send_update_mail do
  desc "send_product_update_mails"
  task :send_mail => :environment do
    UserMailer.notify_product_updates
  end
end

To edit the crontab, use this command:

crontab -e

Now let’s add our job to the crontab. Each job you add should take up a…

Greater Than Code 

048: Finding Our Lane with Marco Rogers

Build and maintain complex distributed systems.

We are proud to be partnering with O’Reilly Media. Be sure to check out velocityconf.com for all of the dates and cities coming this Fall.

The O’Reilly Velocity Conference is the best place to learn about continuous delivery, DevOps, operations, and performance. If you want to build distributed systems and apps that stand up to today’s technological challenges and customer expectations, make plans to attend Velocity in New York, NY (October 1-4) or London, UK (October 17-20). Register with code PCGTC to save 25% on your Gold, Silver, or Bronze pass.


Panelists:

Jamey Hampton | Jessica Kerr | Astrid Countee |
Janelle Klein | Sam…

Guest Starring:

Marco Rogers: @polotek

Show Notes:

00:16

Rodrigo Rosenfeld Rosas 

The day I reached the 1600 columns limit in PostgreSQL

WARNING: skip the TLDR section if you like some drama.

TLDR: PostgreSQL doesn't reclaim space when dropping a column. If you use some script that will add temporary columns and run it many times at some point it will reach the 1600 max columns per table limit.

It was a Friday afternoon (it's always on Friday, right?) and we were close to start a long awaited migration process and after several tests everything seemed to be working just fine, until someone told me they were no longer able to continue testing as the servers wouldn't allow them to port deals anymore. After a quick inspection in the logs I noticed the message saying we had reached the 1600 columns per table limit in…

All Ruby Podcasts by Devchat.tv 

RR 329: Learning Machine Learning with Marc-André Cournoyer

Panel:

Charles 

Dave

Eric 

Special Guest: 

Marc-André Cournoyer

Ruby Rouges speaks with Marc-André Cournoyer, whose most notable works were the Thin Web Server, Tiny RB Ruby implementation, and a book called “Create your own Programming Language,” response for the creation of Coffee Script. Also he has done some with with Rack 2 and create some of the initial Rack Adapters. 

The discussion covered in this episode are about learning machine learning. How do you learn it in Ruby? The basics of machine learning and the best practices to become more competent in machine learning. Also some diving into hardware, training, for getting the job done. 

In particular, we dive pretty deep on:

All Ruby Podcasts by Devchat.tv 

RR 329: Learning Machine Learning with Marc-André Cournoyer

Panel:

Charles 

Dave

Eric 

Special Guest: 

Marc-André Cournoyer

Ruby Rogues speaks with Marc-André Cournoyer, whose most notable works were the Thin Web Server, Tiny RB Ruby implementation, and a book called “Create your own Programming Language,” responsible for the creation of Coffee Script. Also, he has done some with Rack 2 and creates some of the initial Rack Adapters. 

The discussion covered in this episode are about learning machine learning. How do you learn it in Ruby? The basics of machine learning and the best practices to become more competent in machine learning. Also some diving into hardware, training, for getting the job done. 

In particular, we dive pretty deep on:

Hi, we're Arkency 

How to overwrite to_json (as_json) in Active Record models in Rails

Let’s say you have a model in Rails with certain attributes and columns. When you serialize it with to_json, by default Rails will include all columns. How can you add one more or remove some from now appearing there?

Struggling with finding Senior Ruby developers? - Show your job post here and reach thousands of developers quickly.

to_json ? Use as_json instead

In the simplest way you can define the as_json method on your model. You can call super to get the standard behavior from ActiveRecord::Base and then add or remove more attributes on that result.

Imagine that you have Event class. And initially the JSON looks like.

{
  "id": 1,
  "tit…
Martian Chronicles 

imgproxy: Resize your images instantly and securely

Authors:Andy Barnov, Writer at Evil Martians. Formerly international TV correspondent, now teaches Ruby and Rails basics to beginners and Sergey Alexandrovich, Lead Developer at Evil Martians

Learn how to get started with imgproxy—a fast and secure standalone server written in Go. It does only one thing and does it well: takes care of all your image resizing needs.

Is image worth a thousand lines?

You have an idea for a startup; maybe you are already working on it. You have scaffolded your MVP, and everything works fine under a minimal load. You have users who can do things in your app. And now you want to accept images from them—so anyone can upload an avatar or a profile page cover.…

Appfolio Engineering 

OptCarrot: An Excellent CPU Benchmark for Ruby 3x3

You may have read here about my benchmarking attempts for Ruby 3x3. In addition, there are various small benchmarks in the Ruby source and several other aggregations of benchmarks.

But the other major benchmark currently used for Ruby 3x3 is called OptCarrot. It's written by Yusuke Endoh (aka mametter, aka mame.) It's a very well-designed benchmark. Let's talk a bit about why, shall we?

Anatomy of a Carrot

OptCarrot is a headless hardware emulator for the Nintendo Entertainment System. Everybody should have some fun with profiling, right?

And original NES. most of you are probably too young to remember these.

And original NES. most of…

Ruby – Sihui Huang 

Stop Thinking Like A Developer. Think Outside-in.

TL;DR: Want to advance your career as a software developer? Putting all energy into learning technical topics is not enough. You need to think outside-in.

 

Finally, you landed your first software development job. It felt like a dream came true. Or at least it’s one step closer to your dream. Your career as a software developer just started. You are super excited and eager to learn and grow as fast as possible. You want to be like that ninja developer on the team who seems to know everything about programming. You are ready to put in some extra hours after work to read books and study. Your next goal is to write better code faster and to become the next ninja developer on the team.

As a…