Rubyland

news, opinion, tutorials, about ruby, aggregated
Sources About
example.com 

Happy (Ruby) Birfday to me!

The 15th of October was my Seventeen Year Anniversary with Ruby!

983 gem releases (up by a measly 24), 11413 commits (up by 1004).

Wow, that has really slowed down! I won’t say I’m going strong. Quite the opposite. Some of this is certainly because I’ve stabilized a lot of my projects and they just don’t need the work they needed in the past. I have plenty of projects where that is NOT the case tho. I have plans for minitest, sexp_processor, ruby_parser, etc… yet I haven’t really been working on these other than to patch up an occasional bug.

Ruby Weekly 

Improving Ruby Performance with Rust

Ruby Weekly Issue 376 — November 23, 2017
Daniel P. Clark
Rust is a (compiled) systems language focused on speed and safety. What about integrating it with Ruby? Here’s an introduction.


Amazon Web Services
You can now generate a Ruby gem for consuming an Amazon API Gateway API with a simple button click or command.


OpsCare by reinteractive  Sponsored
Our out-source DevOps solves the problems associated with ROR development. Plus our blue/green pre-baked deployment process means that you can deploy your app as often as you want. Get started today –…
The Bike Shed 

133: A Very Special Bike Shed

Sean is on to a significant ActiveRecord optimization using an extension written in Rust and Derek shares an overdue thanks to an excellent manager.

AkitaOnRails.com 

From Microsoft to Apple, and Back Again

This is going to be a very lengthy article, buckle up ladies and gentlemen.

If you're hasty, here's what you need to know:

  • Windows 10 is still Windows, but it's nowhere near the nightmare of the 2000's. It rightfully deserves a new chance.
  • OS X is on its way to becoming no more than an XCode runtime. Rumor says that Apple doesn't even have a dedicated team for the desktop OS anymore. They are entirely focused on iOS and to make the iPad the desktop replacement.
  • Linux is great, if you're a full-time web developer, you can comfortably run something like Ubuntu or Manjaro/Arch (my personal recommendation).

Best cost-benefit: the Dell XPS 13. The Surface Book 2 is totally worth it if…

Schneems - Programming Practices, Performance, and Pedantry 

Self Hosted Config: Introducing the Sprockets manifest.js

Have you ever felt like a framework was getting in the way isntead of helping you go faster? Maybe you’re stuck on some simple task that would be easy to do manually, but your framework is making you jump through configuration hoops. I end up getting lost in a sea of documentation (or no documentation), and the search for that one magical config key takes just a tad bit too long. It’s a productivity sink, and worse than the time delay it adds to my frustration throughout the day. When I hit ETOOMUCHFRUSTRATION, then I’m definitely fighting the framework. One way to alleviate this configuration fatigue is by making configuration consistent and composable. That’s what Sprocket’s new…

RubyGuides 

Learn to Implement & Use Prefix Trees in Ruby

A prefix tree (also known as a trie) is a data structure that helps you organize a word list & quickly find words that start with a specific prefix. For example, you can find all the words in your dictionary that start with the letters “ca”, such as “cat” or “cape”. Look at this picture: […]

The post Learn to Implement & Use Prefix Trees in Ruby appeared first on RubyGuides. Don't miss your free gift here :)

Hi, we're Arkency 

Quarantine your non-deterministic tests with a time limit

In a fantastic article Eradicating Non-Determinism in Tests Martin Fowler shares his strategies for dealing with random failures in your test suite. I especially like the idea of quarantine: to temporarily disable a certain test and come back later to fix it. But disabling a randomly failing test is the easy part. The question is, what to do next?

Then the question is what to do with the quarantined test suites. They are useless as regression tests, but they do have a future as work items for cleaning up. You should not abandon such tests, since any tests you have in quarantine are not helping you with your regression coverage.

Place any non-deterministic test in a quarantined area.…

We want to come back to it, we want to fix the test and make it a first class citizen again.

But how do we track quarantined tests? What do we do about them?

Here is what Martin says:

The general approach with quarantine is to take the…

Greater Than Code 

056: Systematize Your Hustle with Kronda Adair

Panelists:

Jessica Kerr | Sam Livingston-Gray

Guest Starring:

Kronda Adair: @kronda | kronda.com | Karvel Digital

Show Notes:

01:26 – SYSTEMS! Implementing Repeatable Processes Via Automation

Work the System: The Simple Mechanics of Making More and Working Less by Sam Carpenter

09:28 – Strategies for Implementation

12:18 – Reclaiming Your Time and Cheap is Always Expensive

Work the System (Online)

Traction: Get a Grip on Your Business

Entrepreneurial Operating System (EOS)

23:20 – Choosing Successful Customers and Avoiding Perfection…

example.com 

Stale blog is stale

Wow… I’ve been under a rock for a while.

It’s been a long time since I’ve released anything (until today) and even longer since I’ve actually blogged anything. I’ve actually missed not one but two birfday posts?!? Damn… Hopefully I’ll catch up on that over the next day or so.

ruby – Bibliographic Wilderness 

One year of the rubyland.news aggregator

It’s been a year since I launched rubyland.news, my sort of modern take on a “planet” style aggregator of ruby news and blog RSS/atom feeds.

Is there still a place for an RSS feed aggregator in a social media world? I think I like it, and find it a fun hobby/side project regardless. And I’m a librarian by training and trade, and just feel an inner urge to collect, aggregate, and distribute information, heh. But do other people find it useful? Not sure!  You can (you may or may not have known) follow rubyland.news on twitter instead, and it’s currently got 86 followers, that’s probably a good sign. I don’t currently track analytics on visits to the http rubyland.news page. It’s also possible…

All Ruby Podcasts by Devchat.tv 

RR 337: Rapidly Mapping API Schemas in Ruby with Adam Cuppy

Panel:

Brian Hogan

Dave Kimura

Eric Berry

Special Guest: 

Adam Cuppy

In this episode, the Ruby Rogues speaks with Adam Cuppy. Adam is the co-founder of Zeal. Zeal is a software consultancy that specializes in Rails, React, and Elixir. In his earlier experience, he was a professional actor. Adam talks about his journey from actor to a developer, and his self-taught experience as he dived into coding for a creative company and learned about marketing. Adam is on Ruby Rouges to talks about his current talk on Rapidly Mapping API Schemas in Ruby. Adam recently presented this topic to the annual Ruby Dev Summit.

In particular, we dive pretty deep on: 

  • Transition to Developer
  • Web…
Honeybadger Developer Blog 

Uptime and API Monitoring Improvements

Here at Honeybadger we want to give you a complete picture of your application's health. That's why we include uptime & latency monitoring with all our plans. We've been hard at work making our uptime system even better; making it suitable not only to check web pages, but also APIs.
Search Results for “ruby” – via @codeship 

Improving Ruby Performance with Rust

Reading Time: 14 minutes

A couple of years ago, I found a few methods in my Rails application that were called several thousand times and accounted for more than 30 percent of my website’s page load time. Each of these methods were strictly focused on file pathnames.

Along with that, I came across a blog post that said “Rust to the Rescue of Ruby,” which showed me that I could write my slow-performing Ruby code in Rust and get much faster results in Ruby. Also Rust offers a safe, fast, and productive way to write code. After rewriting just a few of the slow methods for my Rails site in Rust, I was able to have pages load more than 33 percent faster than before.

If you want to learn about…

BigBinary Blog 

Ruby 2.5 introduces Dir.children and Dir.each_child

This blog is part of our Ruby 2.5 series.

Ruby 2.5.0-preview1 was recently released.

Dir.entries is a method present in Ruby 2.4. It returns the output of shell command ls -a in an array.

 > Dir.entries("/Users/john/Desktop/test")
 => [".", "..", ".config", "program.rb", "group.txt"]

We also have method Dir.foreach which iterates and yields each value from the output of ls -a command to the block.

> Dir.foreach("/Users/john/Desktop/test") { |child| puts child }
.
..
.config
program.rb
group.txt
test2

We can see that the output includes the directives for current directory and parent directory which are "." and "..".

When we want to have access only to the children files and…

Drivy Engineering 

Sending an e-mail to millions of users

Recently, we had to send an e-mail to all our active users. For cost reasons, we decided to invest a bit of tech time and to go with transactional e-mails instead of using an e-mail marketing platform.

While it would certainly be quite straightforward for, say, hundreds or even thousands of users, it starts to get a bit more complicated for larger user bases.

In our case, we had to send the e-mail to ~1.5 million e-mail addresses.

In this blog post, I’ll quickly explain why a standard approach is not acceptable and go through the solution we chose.

A naive solution

Let’s implement a very naive way to send an e-mail to all our users. We’re going to create a job that loops through all…

Everyday Rails 

Replacing RSpec controller tests, part 3: Removing business logic from controllers

Do you need yet another reason to move code out of controllers and into service (or whatever you want to call them) objects? How about better, forward-thinking testability?
RubyBlog.pro 

Chain of Responsibility Pattern - Ruby

In this article, I'll cover _Chain of Responsibility_ pattern. We will learn how to implement it using Ruby and discover when this pattern is applicable in Ruby apps.
Martian Chronicles 

Spend less on Google Translate

Author:Viktor Sokolov, Lead Developer at Evil Martians

Meet google_translate_diff, a Ruby gem for everyone who uses Google Translation API to treat long texts on multi-lingual websites. See how it helps us spend three times less on machine translations at eBay For Business.
Spoiler: it has to do with NLP and caching.

No humans involved

Thanks to breakthroughs in AI, automated translation services keep improving at a steady pace. In some cases, Google Cloud Translation produces texts that are indistinguishable from human work. Product descriptions are a perfect example: their translations do not have to be creative, they just have to be exact.

eBay For Business automated translation

Same product on global and…

Drivy Engineering 

Multi-currency support in Java

For a few weeks, Drivy has been available in the United-Kingdom. Unlike the others European countries where Drivy operates, the United-Kingdom uses a different currency: the pound (£). We had to make some changes in our Android apps to support this.

Server-side or Client-side Formatting?

At Drivy, formatting is generally done server-side, we just display the values as they are:

Here, prices are formatted server-side, depending on the search place (London, so £), and the app’s locale (french).

But for some specific features we need client-side formatting, for instance an input field. Let’s dive into some Java APIs to see how they can help.

Formatting

First thing first, how to format a…

Running with Ruby 

Kafka on Rails: Using Kafka with Ruby on Rails – Part 1 – Kafka basics and its advantages

Introduction

In this series of articles, I will try to provide you with an explanation on why you should invest your time in learning Kafka and the Karafka framework and how it can reshape the way you design and develop your Ruby applications. I will also try to answer some of the most common questions regarding those two and give you some real usage examples on how you can benefit fast from adding them to your technological stack.

What is Kafka?

Let me quote Wiki on that one:

Apache Kafka is an open-source stream processing platform developed by the Apache Software Foundation written in Scala and Java. The project aims to provide a unified, high-throughput, low-latency platform for…

Avdi Grimm 

Some thoughts and feelings on RubyConf 2017

It’s the day after RubyConf 2017, and I’m still a bit raw and porous around the edges. I thought I’d write a few thoughts before I revert to a steady state. Forewarning: this is going to be a lot more about personal feelings than about technology.

First, though, I need to give some thanks. I almost didn’t attend RubyConf. I don’t usually attend conferences I’m not speaking at, simply because I can’t afford to. Going this year (my first time strictly as an attendee) was a late decision, and it was only possible because of the generous support of a number of benefactors. (I will un-redact their names as I receive their permission to credit them publicly)

First, thank you to Jeremy Hinegardner

Hi, we're Arkency 

Decoding JSON with unknown structure with Elm

A decoder is what turns JSON values into Elm values.

This post has been updated after I have received some valuable feedback.

Paweł and I have been working recently on a web interface for RailsEventStore. The main goal is to have a dashboard in which one could examine stream contents and look for particular events. It may serve as an audit log browser available to you out of the box.

It is written in Elm and soon will be an integral part of the RailsEventStore solution.

Decoding JSON

For the purpose of this post here’s how we imported Json.Decode.

import Json.Decode as D exposing (Decoder, Value, field, list, string, at, value)

First lets examine how you could decode JSON with a known…

Search Results for “ruby” – via @codeship 

Integrating Hakiri with Codeship

Reading Time: 3 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, Hakiri is a service for analyzing and monitoring the security of your Rails application dependencies. By using Hakiri, you can be sure that your Ruby gems are up to date and secure.

The Hakiri documentation does a great job of providing more information, in addition to the setup instructions below and our own documentation. We’ll cover setups for both Codeship Pro and Codeship Basic.

Codeship Pro

You will need to add your STACK_ID value to the environment variables that you encrypt and…

Hi, we're Arkency 

Interview with Scott Bellware (Eventide co-creator) about micro-services in Ruby, event sourcing, autonomous services, SOA, dumb pipes, EventStore and mis-representation of terms in IT

Are you confused about micro-services? Don’t worry, you are not the only one. In this interview with Scott Bellware (the co-creator of Eventide), I am trying to shed some light on this complex topic.

Can you tell our readers in a few sentences what is Eventide and what good use-cases do you imagine for it?

Eventide is a toolkit for building microservices. Specifically, it’s a toolkit for building pub-sub services and event sourcing.

What was your primary motivation for writing Eventide?

I had some background in SOA and had been working in Ruby for a number of years. I wanted to continue working with Ruby, but I wanted to remove the limitations on design that the predominant Ruby web…

Hi, we're Arkency 

Safely migrating has_and_belongs_to_many associations to Rails 4

During recent days I’ve been migrating a senior Rails application from Rails 3 to Rails 5. As part of the process, I was dealing with has_and_belongs_to_many associations.

As you can read in the official migration guide

Rails 4.0 has changed to default join table for has_and_belongs_to_many relations to strip the common prefix off the second table name. Any existing has_and_belongs_to_many relationship between models with a common prefix must be specified with the join_table option. For example:

CatalogCategory < ActiveRecord::Base
  has_and_belongs_to_many :catalog_products,
    join_table: 'catalog_categories_catalog_products'
end

CatalogProduct < ActiveRecord::Base
  has_and_belongs…

The application that I was working on has around 50 has_and_belongs_to_…

Awesome Ruby Newsletter 

Issue 79 - Avoid these 35 habits that lead to unmaintainable code

The Bike Shed 

132: What Went Well?

We discuss patterns and anti-patterns encountered in agile retrospectives and revisit a favorite topic: form objects.

Red Panthers 

Getting started with Faraday gem

 

Client libraries help in reducing the amount of code for the application developer who is using the API, whether a REST API or any other. By adding a set of code to the application, it provides the basic things an application needs to do in order to interact with the API. This is what a client library does. Also, it may handle user authentication and authorization.

Client libraries are developed by API developer or the community.

There are several HTTP client libraries in Ruby such as:

Among them, the favorite of mine is Faraday gem. Faraday has adapters for popular libraries like Net::HTTP. It is simple, flexible and…

Ruby Weekly 

Implementing a Worker Pool in Ruby

Ruby Weekly Issue 375 — November 16, 2017
Andrey Deryabin
Hooks into Net::HTTP, Patron, Curb, Typhoeus and other Ruby HTTP libraries to log outgoing requests for further analysis.


Nick Douglas
Lifehacker has interviewed DHH about his work habits. Not very Ruby specific, but it’s interesting to see he still uses Textmate.


Fabio Pitino
Writing a worker pool from scratch along with some scheduling algorithms to get a better understanding of the design pattern.


Redisgreen  Sponsored
Redis 4.0 is out and…
Search Results for “ruby” – via @codeship 

SaaS Implementations of the Code Coverage Ecosystem

Reading Time: 9 minutes

Welcome to the second part of the code coverage ecosystem review. In the first part, I introduced the concept, in case the term was new for you or you needed a bit of a refresher, and then worked through a series of code coverage libraries for PHP, Python, Java, Ruby, and Go.

During that process, we saw some of the functionality on offer, examples of the reporting that the tools provide, and how to install them. In this, the second part, we’re switching gears and looking at four online services.


“Checking out four online services for code coverage” via @settermjd
Click To Tweet


Unlike the code libraries, which we saw in the first part of this series, these services…

Ruby – Sihui Huang 

Design Pattern: Facade and 1-Click Ordering

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

 

The Facade Pattern is about making complicated things simple.

The Facade Pattern:

 

– provides a unified interface to a set of interfaces in a subsystem.

 

– defines a higher-level interface that makes the subsystem easier to use.

 

You will know exactly what the definition means after we do some shopping on Amazon.

 

Shopping on Amazon is similar to shopping anywhere else online.

You first add an item to your shopping cart.

You then proceed to the checkout process, which has four steps:

  1. Enter Shipping Address
  2. Enter Payment Method
  3. Review Items and Shipping
  4. P…

Here is what the code will look like:

View the code on …

Test Double | Our Thinking 

There's Nothing.new

[Note: the video above is an early sneak peek of the talk while we wait for a video feed (and a higher quality audio feed) from our friends at Confreaks. If you find the audio to be a little hard to understand, we recommend holding out for an updated version, which we hope to release over the next couple weeks.]

Justin and I were honored to co-present this presentation at Rubyconf 2017 in New Orleans. Our goal was to rediscover what drew people to Ruby in the years before we joined the community. In the talk, we shared a bunch of talks and blog posts from other Rubyists in the past, and this post shares all of those links here, in the order that they appeared, starting with Chris…

OmbuLabs Blog 

Setup Monit notifications on Slack

Monit is a powerful tool for monitoring processes on Unix systems and sometimes it can be very useful to receive notifications about a specific process from your server to your everyday tool, Slack. This article will show you exactly how to do that.

In the examples we are using a Linux environment running Ubuntu 16.04. Also the process that we will be monitoring is Mosquitto, but you can monitor any process just by changing the configuration.

Setup Slack

As a first step you need to create a new Incoming WebHook. You can do that by going to https://my.slack.com/services/new/incoming-webhook, select or create a channel, and then click on Add incoming WebHooks Integration. Then you will…

BigBinary Blog 

Higher Order Component for rendering spinner in React Native app

In one of our previous blogs, we mentioned how recompose improves both the readability and the maintainability of the code.

We also saw how branch and renderComponent functions from recompose help us in deciding which component to render based on a condition.

We can use the code from renderComponent documentation to render a spinner component when the data is being fetched in a ReactJS application.

Initial Code

// PatientsList.js

import React, { Component } from 'react';
import LoadingIndicator from './LoadingIndicator';

export default class PatientsList extends Component {

  state = {
    isLoading: true,
    patientsList: [],
  }

  componentDidMount() {
   …
Tech Tips and Freebies – Rubyroid Labs Blog 

How to Clear Out Your Controllers and Models with Waterfall Gem

Reading Time: 4 minutes

Fat models and large actions have always been a problem for Rails developers, service objects came to help us but sometimes it feels like we just move the bad and hard to follow the code from controllers to plain ruby objects. But Waterfall gem seems to solve the problem.
RubyGuides 

Atom Tricks, Plugins & Shortcuts for Ruby Developers

If you are using Atom for Ruby development then you probably know that there are plugins (packages in Atom) that can improve your productivity with the editor. But Atom’s package repository has thousands of packages! Which ones should you be using? And on top of that, what are some useful keyboard shortcuts you can use […]

The post Atom Tricks, Plugins & Shortcuts for Ruby Developers appeared first on RubyGuides. Don't miss your free gift here :)

Search Results for “ruby” – via @codeship 

The Libraries and Packages of the Code Coverage Ecosystem

Reading Time: 11 minutes

If you’ve been writing test-driven code for even a little while, you’ll know about code coverage (also known as test coverage). If you’re not familiar with the term, here are two short definitions. Wikipedia defines it as:

A measure used to describe the degree to which the source code of a program is executed when a particular test suite runs.

According to Martin Fowler, code coverage…

…helps you find which bits of your code aren’t being tested. It’s worth running coverage tools every so often and looking at these bits of untested code.

If you’re not already familiar with and making use of code coverage as part of your testing process or continuous development…

Appfolio Engineering 

Do Random Seeds Matter?

In working on Rails Ruby Bench, I've explained a bit about how it generates a bunch of fake user actions from a random seed number. Basically, if you choose a particular random seed, you get a different bunch of actions like "post a new comment" or "save a draft" or "view current posts" using the Discourse forum software.

By doing this with a bunch of fake users at once, it (approximately) simulates high load on a busy Rails app.

With a different random seed, you get a slightly different benchmark. I keep posting about how Ruby has gotten faster over time based on my benchmark.

With a different random seed, would I get a different story about that?

Take the Simple Approach

Maybe the answer is as…

Greater Than Code 

055: Change Ourselves a Little, Many Times with Keith Bennett

Panelists:

Jessica Kerr | Sam Livingston-Gray | Astrid Countee | Jasmine Greenaway

Guest Starring:

Keith Bennett: @keithrbennett | about.me/keithrbennett | Bennett Business Solutions

Show Notes:

00:16 – Welcome to “Metamours United For Frequent Dialogue” …we mean, “Greater Than Code!”

01:47 – Keith’s Background and Superpower

10:03 – Conflict Resolution

Open Spaces session on Conflict Resolution this summer at DevOpsDays D.C. (and the precursor to this conversation)

Difficult Conversations: How To Discuss What Matters Most

12:01 – Opinions on Mediators/Mediation

14:21 – Approaching Conflict

News Story Re: Portland Murders

17:31 – Radical Helpfulness/Kindness

Keith Bennett: Kaizen and…

All Ruby Podcasts by Devchat.tv 

RR 336: Refactoring Mature Rails Apps with Ben Orenstein

Panel:

Charles Max Wood

Dave Kimura

Eric Berry

David Richards

Special Guest: 

David Richards

In this episode, the Ruby Rogues speak with a return guest, Ben Orenstein. Ben gives an update on leaving the company he worked for ThoughtBot, to pursue entrepreneurial aspirations. He most recent work is a call Refactoring Rails. Ben speaks about the work that went into creating this course and working with Rail on this type of platform. Ben dives into the course features such as testing practices, coding practices, code quality, and much more.

In particular, we dive pretty deep on: 

  • What makes Rail development slow to a crawl?
  • Active record callbacks
  • Slow tests
  • Testing best practices
Depfu 

How we trick Bundler and cause interesting bugs

“So, uhm, there’s this process on our server that always starts to leak memory like no tomorrow and then gets restarted because it blows the process limits. Any idea?”

I want you to try something right now:

  1. Start your favourite process monitor (htop works great, but Activity Monitor on a Mac would work as well) and sort the processes by used memory.
  2. Open up irb and type the following code in and excute it (you don’t need to really understand what’s going on right now, I’ll explain later):
    ([1] * 26).combination(13).to_a
  3. Watch your process monitor (and make sure you CTRL-C the Ruby process before you run out of memory)

Fun, eh?

What would you say if I told you that before…

BigBinary Blog 

Rails 5.1 does not load all records on ActiveRecord::Relation#inspect

This blog is part of our Rails 5.1 series.

Let’s take a project with hundreds of users. When we call inspect on User.all, we see an array of 10 users followed by .... That means the output of #inspect method shows data only for 10 records.

> User.all.inspect
User Load (3.7ms)  SELECT  "users".* FROM "users"
=> "#<ActiveRecord::Relation [
#<User id: 1, email: \"dirbee@example.com\" >,
#<User id: 2, email: \"tee@example.com\">,
#<User id: 3, email: \"scott@example.com\">,
#<User id: 4, email: \"mark@example.com\">,
#<User id: 5, email: \"ben@example.com\">,
#<User id: 6, email: \"tina@example.com\">,
#<User id: 7, email: \"tyler@example.com\">,
#<User id: 8, email:…
Schneems - Programming Practices, Performance, and Pedantry 

WTF is a Source Map

These days web assets such as JS and CSS aren’t simple text files. Instead, they’re typically minified or come from a complex build process involving compiling or transpiling. For example, CSS can be generated from a SASS file. JS can be compiled from ES6 using Babel. These toolchains make working with assets easier for developers, and make following best practices such as minification much easier. Yet, there’s a problem. What do we do when there’s a error? If there’s an exception in your JS and it’s minified, you will have short variable names which are all on one line and it’s impossible to see where the error comes from. Source maps seek to solve this problem.

GoRails Screencasts 

Error Tracking with Errbit

Track errors in Rails, Sidekiq, etc in production for free using the open source Errbit app and the Airbrake gem
Search Results for “ruby” – Journeys of a young Software Engineer 

Are comments a code smell? Yes! No? It Depends.

Most people are either firmly on the “Yes!” or the “No!” side when it comes to discussing comments and their status as a code smell. But, as with most question worth asking the correct answer rather is an “It depends”. I got to re-examine this topic lately triggered by a tweet and a discussion with […]
Mike Perham 

Getting Started with Faktory

When I unveiled my new background job system Faktory three weeks ago, I didn't have an easy path for people to install and try Faktory themselves. Now there is; let's get it running!

faktory

Homebrew

If you are running macOS, it's installable with Homebrew:

> brew tap contribsys/faktory
> brew install faktory
...two minutes pass...
> faktory

Now open your browser to http://localhost:7420

Docker

If you have Docker, it's easy to pull an image:

docker pull contribsys/faktory:latest

The command to run it is rather involved, see the description.

Workers

Faktory is only one half of the puzzle, now you need to install a worker package which can execute jobs that are pushed to Faktory. I…

AkitaOnRails.com 

THE CONF 2017 - All the Recordings!

Finally, InfoQ Brasil has been posting the edited talks to their new YouTube! channel. They created a playlist with all 32 talks available right now! And, as promised, everything available for FREE!

We're almost done with the 2017 edition.

As we stated before, out of the 32 talks, I will select 5 to showcase in the USA InfoQ website. You can help out in the process by sharing the playlist and liking your favorites. I'll take that into consideration as well.

If you missed this year's edition, don't forget to read about the Initiative that I kicked off in October of 2016. And also the report of the 2017 edition.

We actually did it: 31 Brazilian speakers, coming from all around the globe…

Martian Chronicles 

Embracing metrics as new tests

Authors:Maxim Filatov, Operations engineer at Evil Martians and Denis Lifanov, Developer at Evil Martians

Do you often care about what happens to your app after it is deployed? As a diligent developer, you have written good tests, so you assume your code behaves correctly in production. “Correct”, however, does not necessarily mean “efficient”. Read on to see how easy it is to add monitoring tools like Prometheus to your developer workflow, and how to report to Prometheus from your Ruby application.

Life after “git push”

With the emergence of the test-driven philosophy in the last decade, developers no longer question themselves whether they should write tests. That is especially true…

Andy Croll 

Use a pull request template

If you’re submitting work for review, pull requests are a great way to group related changes and discuss approaches and improvements. The audience for a pull request can be your immediate co-workers, other interested parties or even your future self.

It should describe the ‘what’, ‘why’ and high-level ‘how’ of the changes in your branch. It is important the description is detailed and sets the context for the changes you have made.

GitHub offers the ability to define pull request templates. See their documentation.

Instead of…

…writing one line of explanation. Or listing a bunch of commits. Or making it up each time.

Use…

…a template.

Add .github/PULL_REQUEST_TEMPLATE.md

#### What…
Running with Ruby 

Karafka (Ruby + Kafka) framework 1.1.0 Release Notes

Note: These release notes cover only the major changes. To learn about various bug fixes and changes, please refer to the change logs or check out the list of commits in the main Karafka repository on GitHub.

Time passes by, Kafka is already 1.0 and Karafka is already 1.1.

Code quality

I will start from the same thing as with 1.0. We’re constantly working on having a better and easier code base. Apart from adding several new monitoring tools to our code quality stack, we were able to maintain a pretty decent offenses distribution and trends.

It’s also worth noting, that our reaction time towards gem updates and other upgrades have significantly improved, which means that we’re almost…

RubyBlog.pro 

Proxy Pattern

In this article, we will cover Proxy pattern and its types. We will implement each of them using Ruby.
Search Results for “ruby” – via @codeship 

Integrating Gemnasium with Codeship

Reading Time: 3 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, Gemnasium is a service for analyzing and monitoring the security of your application dependencies. By using Gemnasium, you can be sure that your Ruby gems are up to date and secure.

The Gemnasium documentation does a great job of providing more information, in addition to the Codeship Pro and Codeship Basic setup instructions below.

Codeship Pro

Let’s begin with the Codeship Pro setup for Gemnasium.

Setting your Gemnasium token

You will need to add your GEMNASIUM_TOKEN value to the encrypted…

Rodrigo Rosenfeld Rosas 

Upgrading PostgreSQL from 9.6 to 10 with minimal downtime using pglogical

Once PostgreSQL 10 was released I wanted to upgrade our 9.6 cluster to the newest version. However, it would require a lot of coordination effort to get a maintenance window to perform the migration the way I was used to: put the application in maintenance mode, get a new dump and restore it to the new cluster and switch off the maintenance mode.

That means the application wouldn't be available for an hour or so, maybe more. After reading once more about pglogical, I decided to finally give it a try, which allowed me to switch from 9.6 to 10 in just a few seconds.

How it works - a higher level view

pglogical implements logical replication, which allows replicating databases among…

Awesome Ruby Newsletter 

Issue 78 - Why Aren't We Using More Service Objects Already

Dustin Zeisler 

Refactoring with Hash Defaults

I’m going to give you a primer on how to set default values when accessing non-existing keys. Then I’ll give you some advice on how this could improve your code.

Set default in the initializer

h = Hash.new(:key_not_found)
h[:cat] 
#=> :key_not_found

Set default on an instance

h = { fish: 100 }
h.default
#=> nil
h.default = :default_key
h[:fish]
#=> 100

h[:dog]
#=> :default_key

Be aware if this is exposed as public API it may not do what end users are expecting, so either keep the hash with defaults set isolated or be very sure you think about the issues it could cause.

Side note don’t depend on using nil as an indicator of a key not being present because if the value it’s self is nil

Ruby Weekly 

#374: Discussing Ruby 3.0 with Matz

Ruby Weekly Issue 374 — November 9, 2017
Ross Kaffenberger
A thorough writeup of what was involved and what was learnt by adopting the Webpacker system in an existing Rails 4.2 app.


Kickstarter
How Kickstarter prepared and executed the upgrade to Rails 5 on time and with minimal production interruptions.


Honeybadger  Sponsored
Exceptional creatures is a bestiary-style compendium of Ruby's exceptions, blending documentation with artwork reminiscent of _why's poignant guide.


Morning Commute
A 30 minute interview in a…
Drivy Engineering 

Data quality checkers

At Drivy, we store, process and analyse hundreds of gigabytes of data in our production systems and our data warehouse. Data is of utmost importance to us because it makes our marketplace run and we use it to continuously improve our service.

Making sure that the data we store and use is what we expect is a challenge. We use multiple techniques to achieve this goal such as high standard coding practices or checker jobs we run on production data to make sure that our assumptions are respected.

Defining data quality

There are several research papers discussing the data quality dimensions as professionals have a hard time agreeing on the terminology. I found that the article written by the…

JRuby.org News 

JRuby 9.1.14.0 Released

The JRuby community is pleased to announce the release of JRuby 9.1.14.0

JRuby 9.1.x is our current major version of JRuby. It is expected to be compatible with Ruby 2.3.x and stay in sync with C Ruby. JRuby 9.1.14.0 is our latest release…

Major features of JRuby 9000:

  • Ruby 2.x compatibility
  • A new optimizing runtime based on a traditional compiler design
  • New POSIX-friendly IO and Process
  • Fully ported encoding/transcoding logic from MRI

If you do find issues then report them on using our issue tracker at http://bugs.jruby.org. We also encourage users to join our IRC channel (#jruby on Freenode) and…

RubyGuides 

Build Your Own Link Shortener App with Ruby & Sinatra

If you are looking for a little project to work on & practice your Ruby skills then you are in the right place. Today I want to build a “link shortener” application together with you. What’s a link shortener? I’m sure you have seen them before… These “short links” like: [crayon-5a15c074a92b4239310799/] When you visit this […]

The post Build Your Own Link Shortener App with Ruby & Sinatra appeared first on RubyGuides. Don't miss your free gift here :)

OmbuLabs Blog 

Upgrade Rails from 3.2 to 4.0

This article is part of our Upgrade Rails series. To see more of them, click here.

A previous post covered some general tips to take into account for this migration. This article will try to go a bit more in depth. We will first go from 3.2 to 4.0, then to 4.1 and finally to 4.2. Depending on the complexity of your app, a Rails upgrade can take anywhere from one week for a single developer, to a few months for two developers.

  1. Ruby version
  2. Gems
  3. Config files (config/)
  4. Application code
    1. Models (app/models/)
    2. Controllers (app/controllers/)
  5. Tests
  6. Miscellaneous
  7. Next steps

1. Ruby version

Rails 3.2.x is the last version to support Ruby 1.8.7. If you're using Ruby 1.8.7, you'll need to…

Schneems - Programming Practices, Performance, and Pedantry 

80% Smaller Rails Page Size With Rack Deflate

Do you have 5 minutes? Do you want to decrease the “over the wire” size of your Rails app by 80%? Sure you do! I added Rack::Deflate to CodeTriage.com, the best way to get started in Open Source, and went from a page size of 85,523 bytes to 15,568 bytes (over the wire). You can verify with this retro looking web based compression tool.

AaronLasseigne.com 

Why Aren't We Using More Service Objects Already

Avdi Grimm recently wrote a post in which he lambastes the rise of service objects. As an advocate for service objects I was interested in reading about their shortcomings. I want to know the strengths and weaknesses of the tools I use. That’s not what I found. Instead, I found a post that simply contradicted my own experience.


RubyGems Blog 

2.7.2 Released

RubyGems 2.7.2 includes bug 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.

Bug fixes:

  • Added template files to vendoerd bundler. Pull request #2065 by SHIBATA Hiroshi.
  • Added workaround for non-git environment. Pull request #2066 by SHIBATA Hiroshi.

SHA256 Checksums:

  • rubygems-2.7.2.tgz
    715d0c1450146c700528b7f135d05030674f41b4eb2886ec40f8869ce7fedad3
  • rubygems-2.7.2.zip
    34ca397cd389b34db4619b614dd6da034ceabe1298ec9c67f107f3c8a4d9c84a
  • rubygems-update-2.7.2.gem
    49d49c8cfd3677aff90546360ea2c…
rossta.net 

How we switched from Sprockets to Webpack

In case you missed the news, Rails is loving JavaScript and Rails 5.1 ships with the option to compile JavaScript with Webpack via the Webpacker gem. This is a big change after years of the Rails asset pipeline running on Sprockets. My team at LearnZillion recently decided to embrace this change and make the switch to Webpack with Webpacker to compile our clientside JavasScript for our Rails 4.2 application. Gulp!

This post describes the challenges we encountered while switching from Sprockets to Webpack, how we solved those issues, and what we learned along the way.

Though much of what follows may be generally relevant to other teams considering a similar change, this post is not…

The Bike Shed 

131: Nouns For Verbs Sake

We briefly discuss the renaming of factory_girl to factory_bot before diving in to the visitor pattern; what is it, and what are its inherent tradeoffs.

Greater Than Code 

054: Code Hospitality with Nadia Odunayo

Panelists:

Jamey Hampton | Jacob Stoebel | Rein Henrichs

Guest Starring:

Nadia Odunayo: @nodunayo | nadiaodunayo.com | Ignition Works |
Ruby Book Club  

Show Notes:

01:19 – Nadia’s Superpower

02:01 – Code Hospitality and Being a Good Host

Nadia Odunayo: The Guest: A Guide To Code Hospitality @ GORUCO 2016

Daniel Dennett’s “Intuition Pump”

10:22 – People and Habits and Having Expertise in a Particular Realm

17:00 – Asking Questions/Waiting for Explanation Rather Than Passing Judgement

22:16 – Codebases Are Constantly Changing: Use the README to Give Context

Code Hospitality Guide App

27:27 – Making Diagrams Whilst Coding/Pairing

Rapoport’s Rule

32:27 – Thinking About the “Why”

36:44 –…

John Nunemaker 

Flippin' Features at Runtime

Since it has been nearly a year since I’ve written about Flipper (a ruby gem for turning parts of your application on or off at runtime), I thought I’d share some of what I (and other contributors) have been up to. From keeping track of a default instance to preloading all your features to the awesome sauce that is Flipper::Cloud, a new version (0.11 changelog) is hot off the press and ready for use.

Default Instance

One of the pain points from the beginning was how do I set up Flipper in my app? A global? A class method somewhere? Rails configuration? I usually told people to drop it in a class method like so:

module MyApp
  def self.flipper
    @flipper ||= Flipper.new(...)
  end
end
All Ruby Podcasts by Devchat.tv 

RR 335: Collaborative and Effective Work Environment with David Richards

Panel:

Charles Max Wood

Dave Kimura

Eric Berry

Special Guest: 

David Richards

In this episode, the Ruby Rogues speak with David Richards. David has been a software developer for the last couple of decades and develops most of his software with Ruby. Currently, David is building fin-tech products for companies.

David is on Ruby Rogues to talk about the process of collaborative work, developer turnover, effective work, and personally connecting with your work. Also, the differences in being older and more experienced developer in today’s world. Lastly, David and the panel discuss the overall effectiveness of a developer in the company and among his/her peers.

In particular, we dive…

Michał Konarski 

Advanced SQL - window functions

This post starts a series of articles discussing advanced SQL concepts that are well supported in popular database management systems for quite some time, but somehow many people still don’t know about their existence. I’d like to explain them with examples, first giving a problem to solve using “plain old” SQL and then showing a better solution using advanced SQL.

The first feature that I’d like to present is window functions.

In this article I’ll be using PostgreSQL 10, because it’s the most feature-rich open source database available. Version 10 has been just released, but window functions have been available since 8.4, so any modern version will be fine.

Problem

As I promised, let’s…

zverok with ruby 

On sustainable testing

A few days ago, I’ve posted on /r/ruby announce of some RSpec matchers/plugins library, and it met with a (not very heated, TBH) discussion that I’ve expected, seen several times, and now want to focus on. The discussion is between two opposite approaches:

Concise and expressive specs without textual descriptions and lot of custom matchers.
vs.
Formal and structured specs with textual descriptions and no special attention to laconism.

Here is a showcase from Reddit thread (imagine we are testing Array#[] behavior):

# approach 1
describe '#[]' do
  subject { [1, 2, 3].method(:[]) }

  its_call(0) { is_expected.to ret 1 }
  its_call(1..-1) { is_expected.to ret [2, 3] }
  its_call(:b) { i…
Test Double | Our Thinking 

React Performance Analysis

Overview

With the proliferation of React applications in the wild, I thought it would be a good idea to examine some techniques for evaluating the performance of React Components.

React is frequently touted as being performant due to the optimizations of its Virtual DOM technique, yet all to often this is used by developers as a crutch to avoid thinking about the performance of their code at all. This generally leads to performance problems in React apps of any significant scale.

This screencast covers a number of techniques for constructing components, but also shows how to evaluate performance objectively and make informed refactoring decisions.

Screencast Outline

  1. Introduction

    • A Common…
Martian Chronicles 

Partition and conquer

Authors:Sergey Dolganov, Developer at Evil Martians, Open Source activist and Denis Lifanov, Developer at Evil Martians

Here is a tale of database partitioning inspired by real events. We’ll learn how to break down a gigantic table that is slowing down your application in production—Ruby on Rails and PostgreSQL, in our case. Expect a step-by-step guide.

When bigger is no longer better

Databases tend to grow. At a certain point, their size becomes a liability, and we are not even considering extreme cases when the primary key hits the limit (although, this does happen). This article is written from experience: one of our clients, Gett, had a database table that grew over time to…

OmbuLabs Blog 

Upgrade Rails from 3.1 to 3.2

This is the third 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.1 to 3.2.

  1. Considerations
  2. Ruby version
  3. Tools
  4. Config files
  5. Gemfile
  6. Deprecations
  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.1.12 before updating to Rails 3.2.22

2. Ruby version

Depending on which patch version of Rails 3.2 you are using, the Ruby versions that you can use will…

Anthony Super 

Luck and Analysis

Over the last few years, I’ve become progressively more interested in tabletop games. As a result, I’ve been playing more of them—and thus rolling more dice. Now, as with any game of chance, occasionally luck isn’t in my favor and and I’ll consistently do much lower damage than I feel like I should. When you do 5 damage on an attack that averages 16, it feels pretty awful. I, however, wanted to know more. I wanted to know exaclty how unlucky I was getting. Being a programmer, my solution, naturally, was to write some code to do so.

Now, figuring out how unlucky it is to roll a 1 on a six-sided die (a d6) is pretty easy: you have a \frac{1}{6} chance of getting any possibility, 1 is a…

Drifting Ruby Screencasts 

Speeding Up Tests

Slow tests can slow down your development process. Using parallel_tests, you can speed up your test suite by multiple threads and running the tests in groups.
Kir Shatrov blog 

Environment variables considered evil

For the past few years I noticed that it became more common among developers to use environment (ENV) variables as a way to control a command line tool. In this post I’m going to expand some of the use cases and demonstrate why in some of them ENV variables may be considered evil, and why using classic command line arguments may be a better approach.


In the Ruby world, it’s common to define tasks with something called Rake. Rake is a build tool and a DSL for task management. Historically, Rake tasks caused many developers to use ENV variables. This comes from the lack of arguments support in Rake. Developers are left with ENV variables as the only way to control the flow. Consider a task…

Riding Rails 

This Week in Rails: Better Source Code Formatting, Improved Ajax API and more!

Hi! Tim here! About to bring you the latest in all things Rails….

This Week’s Contributors

This week we had 12 contributors, including 1 for the very first time! Huge thanks to all of you!

Make beforeSend optional in Rails.ajax

Rails.ajax requires a beforeSend parameter but for some this means having to supply a no-op function. It can now be omitted entirely, thanks to this enhancement!

Prevent source line wrapping in rescue layout

You may be used to seeing source extracts in development mode when encountering runtime errors. Long lines currently get wrapped, but this change aids readability by letting you scroll instead.

That’s all we’ve got for this week, but do check out the full…

RubyGems Blog 

2.7.1 Released

RubyGems 2.7.1 includes bug 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.

Bug fixes:

  • Fix gem update --system with RubyGems 2.7+. Pull request #2054 by Samuel Giddins.

SHA256 Checksums:

  • rubygems-2.7.1.tgz
    b5edd299eb12e503f2f4a47c1c5766ce8cca6711a894eb22f5142f5e9ce0048a
  • rubygems-2.7.1.zip
    dcaa7d23a0d7d3338ba2465d4156e312c90567c258a6ecc71d31238d50f5222e
  • rubygems-update-2.7.1.gem
    434c8e624ca1028112637d6b0109076c11788f500fa0877e324bcc437adc4d02
Alfredo Motta 

To raise or not to raise exceptions, and the art of designing return values

Each time we call a function that's meant to perform some operation that could succeed or fail we are always left with the same dilemma. What should be the return value? Should I return nil if a failure happened? Or I should throw an exception? What does failure means anyway? Like every interesting question, the answer is […]
The Life of a Radar 

How require loads a gem

In modern versions of Ruby, you can use the good old require method to load a gem. For instance, if you've got the gem activesupport installed, you can require everything inside of activesupport (including the kitchen sink) with this line:

require 'active_support/all'

You might've just tried to open up irb and run that line, and it might've worked for you... assuming you have activesupport actually installed. It works on my machine, at least.

But how does require know where to find gems' files in Ruby? Wouldn't those files need to be on the load path? Well, thanks to a cheeky hack in RubyGems code, no, those files don't need to be on the load path. Instead, these gems' lib directories are…

The Bike Shed 

130: I Grew Up in Balloons

Is Database Cleaner necessary anymore? Tune in for our exciting play-by-play reporting on that issue and stick around for chatter on personal defaults for new Rails applications.

Awesome Ruby Newsletter 

Issue 77 - Enough With the Service Objects Already

Ramblings Of a Madman - ruby 

Commonly used (and abused) Ruby Gems

Following up on my last post about Ruby gems, here's a list of some of my typical choices for various tasks in the Ruby and Ruby on Rails world:

active_model_serializers

Makes it real easy to define exactly how to serialize models in an API

annotate

Annotates Rails/ActiveRecord Models, routes, fixtures, and others based on the database schema. Very cool to know exactly which fields are present in your models, without having to look it up in the schema.rb file.

awesome_print

Great Ruby dubugging companion: pretty print Ruby objects to visualize their structure. Supports custom object formatting via plugins.

aws-sdk

The Amazon Web Services SDK allows…
bogdanvlviv (Bogdan) 

How to install the latest tmux on Ubuntu 16.04

What is tmux?

tmux is a “terminal multiplexer”, it enables a number of terminals (or windows) to be accessed and controlled from a single terminal. tmux is intended to be a simple, modern, BSD-licensed alternative to programs such as GNU screen. .

Install the download, build and tmux dependencies

We can download package information from all configured sources:

$ sudo apt update

We need to install Git in order to download the latest version of tmux from the official repository:

$ sudo apt install -y git

In order to get the latest version of tmux, we’ll be compiling and installing the software from source. We need to satisfy the build and tmux dependencies so that we can…

Honeybadger Developer Blog 

Introducing our new search query builder

If you're a regular Honeybadger user, you may have noticed that search looks a little different. We recently launched a new query builder that not only looks better, but also makes it a snap to construct advanced search queries.
Ruby Weekly 

#373: Memory Conscious Programming in Ruby

Ruby Weekly Issue 373 — November 2, 2017
Avdi Grimm
A critique of the common advice to encapsulate business domain actions in “Service Objects”.


Samuel Giddins
Bundler now has an improved, faster resolver and bundle install is now almost as fast as bundle check when no installation is needed. There’s also news about Bundler 2 here.


Semaphore  Sponsored
Semaphore Boosters automatically parallelize large Ruby test suites with split-second precision. Deliver working code faster — no configuration required.


Practical Artificial Intelligence
RubyGems Blog 

2.7.0 Released

RubyGems 2.7.0 includes major enhancements, minor enhancements, compatibility changes and bug 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.

Major enhancements:

  • Update vendored bundler-1.16.0. Pull request #2051 by Samuel Giddins.
  • Use Bundler for Gem.use_gemdeps. Pull request #1674 by Samuel Giddins.
  • Add command signin to gem CLI. Pull request #1944 by Shiva Bhusal.
  • Add Logout feature to CLI. Pull request #1938 by Shiva Bhusal.

Minor enhancements:

  • Added message to uninstall command…
Ilija Eftimov 

Understanding why and how to add idempotent requests to your APIs

Idempotency is an often used term in computer science. It’s meaning to some might not be known, to others it’s very well known. The explanation for idempotency on Wikipedia is:

… the property of certain operations in mathematics and computer science that they can be applied multiple times without changing the result beyond the initial application.

Essentially, idempotency is the mathematical way of saying “one can apply a certain operation on something many times, without changing the result of the operation after the first time the operation is applied”.

A common example of this would be an UPDATE statement in SQL. For example, imagine you have a SQL table full of student’s first…

zverok with ruby 

Useful RSpec trick for testing method with arguments

What’s inside: A useful rspec/rspec-its trick for testing methods with arguments + philosophical explanations why I consider such tricks a good thing.

The task

Currently we are working hard on daru’s next version, and part of this work is refactoring specs. Most of them are pretty old and written by Google Summer of Code students, which sometimes lead to not ideal coverage, and almost always—to very “wordy” specs.

As daru is algorithmically complex (trying to provide “natural” interface for Rubyists to simple-to-explain-yet-powerful concepts like dataframes and series), those specs refactoring provides a lot of funny challenges, and I’d like to share one of them.

So, we have Index

AkitaOnRails.com 

How does Bitcoin force consensus among Byzantine generals?

"Is it possible to break the blockchain?"

Now, this is a fair question. If you know anything about the blockchain architecture, you instinctively conclude that "no", it's quite improbable that anyone will break it. In practice, it's basically impossible.

It's quite amazing that most of my peer programmers have a very difficult time overcoming the prejudice against cryptocurrencies. I have no idea where this prejudice comes from, but I know very smart people that can solve the most difficult web scalability problems, but that never once glanced over Satoshi Nakamoto extremely short original paper describing the blockchain.

Seriously, the Bitcoin: A Peer-to-Peer Electronic Cash System

RubyGuides 

Performance Improvements in Ruby 2.5

New Ruby versions keep improving & Ruby 2.5 is no different. Ruby 2.5 is introducing some optimizations: String interpolation will be around 72% faster when a large string is created String#prepend will be around 42% faster if only one argument is given Enumerable#sort_by, Enumerable#min_by & Enumerable#max_by will be about 50% faster Let's see some benchmarks! […]

The post Performance Improvements in Ruby 2.5 appeared first on RubyGuides. Don't miss your free gift here :)

Devon C. Estes - Articles 

I'm writing a book!

I’ve known for a couple months now that this is happening, and I’m even putting the finishing touches on chapter 1 with my editor now, but I think it’s time to talk about it.

BigBinary Blog 

Fixing CORS issue with AWS services

While working on a client project, we started facing an issue where the JWPlayer stopped playing videos when we switched to hls version of videos. We found a CORS error in the JS console as shown below.

cors error

After researching we found that JWPlayer makes an AJAX request to load the m3u8 file. To fix the issue, we needed to enable CORS and for that we needed to make changes to S3 and Cloudfront configurations.

S3 configuration changes

We can configure CORS for the S3 bucket by allowing requests originating from specified hosts. As show in the image below we can find the CORS configuration option in Permissions tab of the S3 bucket. Here is the official documentation on configuring CORS for…

s3 cors configuration

Greater Than Code 

053: BOOK CLUB! The Responsible Communication Style Guide

This episode is sponsored by Upside!

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

___

Panelists:

Astrid Countee | Jamey Hampton | Sam Livingston-Gray

Guest Starring:

Audrey Eschright: The Recompiler | Greater Than Code Episode #013: Religion in Tech with Audrey Eschright | Open Source Bridge

Thursday Bram: thursdaybram.com

Show Notes:

01:33 – Superpowers and Acquisition

02:50 – Reflective Listening

05:27 The Responsible Communication Style Guide

11:54 – Asking Content-Related Questions

15:10 – Who is the target audience for this book?

17:45 – The Evolution of Writing the Book

19:39 People-first Language

Kronda Adair: Five Stages of Unlearning Racism

23:40 – What if you…

Drifting Ruby 

Configuring a Sentry Server on Ubuntu 16.04 LTS

Sentry is an error tracking software product which has many different subscriptions options. Its software is open source and can be difficult to install if you are unfamiliar with the server side of things and hosting. They do offer a free hosted option for up to 10k events per month, 1 user and up to seven days retention.

In this example, I’m using an updated Ubuntu 16.04.2 LTS install. To get started, we will install several packages. Note, this will install Redis and PostgreSQL. Typically, you would want to install these on their own servers.

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y python-virtualenv python-setuptools python-pip libxslt1-dev…
AkitaOnRails.com 

[Beginner] Long live PhantomJS, let's use Chrome Headless now

If you do Feature Specs, the act of loading up a real app server and then a real headless browser to do real user feature testing, then you know Capybara and one of its most well-known drivers, Poltergeist. Poltergeist wraps up PhantomJS, which is a well known WebKit-based headless browser.

But WebKit is known for being very complicated to deal with. So I can only imagine the nightmare to maintain PhantomJS, which is akin to main a full-blown web browser like Chrome or Safari.

So it's no wonder that when the Chrome team announced the availability of the Chrome Driver, then the maintainer of PhantomJS decided to step down.

If you know the contributors of PhantomJS, say thank you, as it…

Posts 

Memory Conscious Programming in Ruby

When programming in Ruby many people think that egregious memory usage is the norm and unavoidable. However, there are ways and strategies to keep memory usage down and in this post I will show you some of them.

Keeping Ruby’s Internals in Mind

Ruby’s main built-in classes like TrueClass, FalseClass, NilClass, Integer, Float, Symbol, String, Array, Hash and Struct are highly optimized in terms of execution performance and memory usage. Note that I’m talking about CRuby (MRI) here and therefore most things will probably not apply to other Ruby implementations.

Internally, i.e. in its C code, each object in Ruby is referenced via the VALUE type. This is a pointer to a C structure that…

Honeybadger Developer Blog 

Cleanly Scaling Sidekiq

When your autoscaling group terminates instances running Sidekiq, you should finish the Sidekiq jobs before the instance gets terminated. This is how we do that at Honeybadger.
Bundler Blog 

Bundler 1.16: 2.0 Is So Close!

What’s new in Bundler 1.16?

A short summer after the performance-focused Bundler 1.15 release, we’ve shipped 1.16. Before we get to the list of changes, we want to share a very exciting announcement: Bundler 2.0 is right around the corner! We anticipate that v1.16 will be the last 1.x release, and details about the transition to 2.0 can be found below.

Improved Resolver

Thanks to the heroic efforts of Grey Baker, the Molinillo library Bundler uses for dependency resolution has once again been overhauled. By replacing the heuristic-focused “swapping” algorithm with one that can consider groups of gems at once, Grey managed to eliminate many bugs around dependency resolution, all while…

GoRails Screencasts 

Uploading Files to DigitalOcean Spaces

Learn how to upload files to DigitalOcean's Spaces which is an Amazon S3 compatible file storage API
Search Results for “ruby” – via @codeship 

An Overview of Caching Methods

Reading Time: 7 minutes

Caching is a way to store and reuse the same data multiple times. By data, I mean anything like images, CSS files, JSON, etc. Caching will help you serve more requests per second and save on precious resources like network bandwidth and CPU load.

What are some of the benefits and challenges that come with caching? What are the most important things you should know about every caching layer? In this post, I will do my best to answer these questions for you!


“What you should know about every caching layer” via @matugm
Click To Tweet


Caching Challenges

Caching comes with its own set of challenges you have to deal with. For example, what strategy are you going to use to…

All Ruby Podcasts by Devchat.tv 

RR 334: Is Elixir the Next Ruby? with Hal Fulton

Panel:

Charles Max Wood

Dave Kimura

Special Guest: 

Hal Fulton

In this episode, the Ruby Rouges speak with Hal Fulton. Hal is one of the first few people to learn the Ruby language in the beginning from the Japanese. Hal describes the history Ruby and his journey to before an author of the book The Ruby Way. This book was one of the few foundational elements Ruby developers of today.

Hal has recently presented at the Ruby Dev Summit, on Is Elixir the new Ruby? The panel asks questions about, how or if, Elixir is possibly out there to replace Ruby. Hal talks about the pros and con of Ruby in today’s world fo development. Also, the practicality of Elixir and how it fits into our world…

Hi, we're Arkency 

Make your JSON API tests clean with linter

Recently, one of our customers requested that mobile devices should communicate with backend via JSON API. We started implementing an endpoint for registering customers.

We used JSON Schema describing JSON API as a part of custom RSpec matcher. To be sure that both request and response body are following the schema.

RSpec::Matchers.define :be_valid_jsonapi_document do
  def schema_path
    Rails.root.join("spec/support/schema.json").to_s
  end

  match do |document|
    JSON::Validator.validate(schema_path, document)
  end

  failure_message do |document|
    JSON::Validator.fully_validate(schema_path, document).join("\n")
  end
end

As you might notice, json-schema gem was used to…

Riding Rails 

This Week in Rails: 5.1 deprecations removed, SystemTestCase load hook and more!

Hey there, it’s Kasper, bringing you the latest edition of This Week in Rails!

Remove Rails 5.1 deprecations from the code

All the code that was deprecated in Rails 5.1 is now removed in one fell swoop by the Rails 5.2 release manager — now you know how these removals are handled too, so please don’t send individual removal PRs.

Psssst: it also brings us another step closer to the first 5.2 beta.

Add SystemTestCase load hook

Allows gems or app code to hook in when
ActionDispatch::SystemTestCase has been fully loaded.

Add allow_other_host option to redirect_back

When passed false, the new allow_other_host option will restrict redirect_back links to just the current host, so users…

It…

Avdi Grimm 

Enough With the Service Objects Already

Once upon a time I was writing a web app that needed to accept notifications of payments. Once it was notified of a payment (via a webhook) it needed to take certain actions to fulfill the purchase.

An overweight controller

Imagine that you’re working on this app. The payment notifications come in the form of PayPal-style IPN data. Here’s an approximation of the controller action for receiving these notifications:

(Note that this is a Sinatra action, but an equivalent Rails controller action wouldn’t be much different.)

post "/ipn" do
  demand_basic_auth

  # Record the raw data before we do anything else
  email = params.fetch("payer_email") { "<MISSING_EMAIL>" }
 …
Drifting Ruby Screencasts 

Sample Data with Factory Bot and Faker

Factory Bot is a fixtures replacement which can generate the needed records directly in the tests. Faker can be used to create fake data for these records.
Valentino G. | Blog 

UI testing with Jest and Puppeteer: an introduction

I started to consider testing with Jest and Puppeteer right after the library came out. Puppeteer has quite an interesting API.

Testing with Jest and Puppeteer

In the following post I’ll introduce you to a basic UI test for a contact form.

We will testing with Jest and Puppeteer. Even if it’s still under development and the API could be subject to changes, Puppeteer is here to stay.

I was writing some tests last day and at the very same time I’ve come across a post by Kent C. Dodds.

Making your UI tests resilient to change” explains how to use  data-*attribute to make UI testing less fragile.

The data-*attributes are basically custom data attributes you can define on almost every HTML element. This is useful especially…

Hi, we're Arkency 

A bug that only appears once a year

There are some bugs that only appear under certain circumstances. Today was the day I’ve got one of those (there is a hint in this sentence).

I pushed a small change and got a red build as a result. I already had the corresponding test fixed so red build was not something I was expecting.

An exception I’ve got was from a check in TicketTransferPolicy which had nothing at all to do with my changes. And so the investigation began.

raise DeadlinePassed  if deadline_passed?(event)
def deadline_passed?(event)
  if FT.on?(:extended_tickets_transfer_deadline, organizer_id: event.user_id)
    event.ends_at < Time.current
  else
    event.starts_at < Time.current.advance(days: 1)
  end
end

Hint…

Andy Croll 

Use simplecov in your Rails test suite

A useful way of assessing the effectiveness of your testing is to use the simplecov gem with your Rails application. It counts the number of times each line of application code is run during your test suite.

Use…

simplecov in your tests.

Add to Gemfile

group :test do
  gem 'simplecov', require: false
end

And run bundle in the root directory of your project.

Add to .gitignore

Do not commit generated files in the coverage directory.

coverage/*

Add to top of spec/spec_helper.rb or test/test_helper.rb

require 'simplecov'
SimpleCov.start 'rails' do
  add_filter '/bin/'
  add_filter '/db/'
  add_filter '/spec/' # for rspec
  add_filter '/test/' # for minitest
end

Add this right…

Valentino G. | Blog 

4 + 1 ways for making HTTP requests with Node.js: async/await edition

HTTP requests with Node.js are a means for fetching data from a remote source. It could be an API, a website, or something else: at one point you will need some code to get meaningful data from one of those remote sources.

4 + 1 ways for making HTTP requests with Node.js: async/await edition

During your career as a Web Developer you will work with HTTP requests all the time. This is why in the following post I want to introduce you to some different ways for making HTTP requests in Node.js.

Starting from the easier one we will explore the “classic way” for doing HTTP requests all the way through libraries which support Promises.

I will focus mostly on GET requests in order to keep things simple and understandable.

What you will learn

  1. How to make HTTP…