Rubyland

news, opinion, tutorials, about ruby, aggregated
Sources About
All Ruby Podcasts by Devchat.tv 

RR 340: Strings and Encodings in Ruby with Aaron Lasseigne

Panel:

Charles Max Wood

Dave Kimura

Eric Berry

David Richards

In this episode, the Ruby Rogues panel discuss Strings and Encodings in Ruby with Aaron Lasseigne. Aaron has been a Ruby developer for over a decade and is the author of Mastering Ruby: Strings and Encodings. Also, Aaron talks about his recent work on a service object Gem called Active Interaction. This is a great episode on learning about Strings and Encodings.

In particular, we dive pretty deep on: 

Discussion Points (contributed by guests and hosts):

•Why is it so important to understand strings?

◦“The internet is powered by multimillion-dollar string manipulation machines. We put strings in a box, and get new strings…

Pat Shaughnessy 

Installing the Postgres LTREE Extension

Hidden inside of your Postgres server is code that provides special SQL operators and functions designed to support tree operations. It’s called the LTREE extension. I’m guessing this stands for left-tree. In my next post, I’ll write about some of these functions and operators: what they do and how to use them.

But first, where is the LTREE extension? How can you install and start using it? Read on to find out.

Testing Whether the LTREE Extension is Installed

Depending on where you downloaded Postgres from and how you installed it, you may have already installed LTREE with Postgres. To find out, execute this SQL statement:

=> create extension ltree;
CREATE EXTENSION

If you…

Test Double | Our Thinking 

Agent Dossier: Brittany Moore

cat1

NAME: Brittany Moore

DESIGNATION: Agent 0035

ALIASES: kalamet, brittanymoore, bannmoore, bann

STATUS: Agent 0035 is currently on assignment at REDACTED. Agent 0035 is working on ways to improve their api architecture and build out an end-to-end testing harness.

LAST TRANSMISSION: Agent 0035 sent along the following notes from her current assignment:

  • This is the first time I've seen Docker in action, and it's very cool.
cat2

BACKGROUND: Agent 0035 is married with three cats.

Agent 0035 started college as an art major, but after taking a programming class as an elective, quickly realized her skills could be put to good use in the high class world of software espionage. She had…

Mike Perham 

Sidekiq Pro Statsd support -- new and improved!

Drivy's impressive Sidekiq dashboard [source]

Several customers have been asking for more metrics to track Sidekiq internals: when is a job dropped due to uniqueness or expiration? I've had to put off the work while working on Faktory but recently I took a week off to focus on Sidekiq and implement this feature.

New and Improved

Sidekiq Pro 3.6 has a brand new Statsd metrics subsystem. Statsd is a de facto universal standard for metrics in open source software, created by Etsy. Even if you use another system like InfluxDB, Prometheus or Datadog, every metrics system will have an adapter or proxy to convert Statsd metrics into their own internal format.

You plug in the Statsd…

Search Results for “ruby” – Journeys of a young Software Engineer 

Surprises with Nested Transactions, Rollbacks and ActiveRecord

Lately I acquired a new hobby. I went around and asked experience Rails developers, whom I respect and value a lot, how many users the following script would create: The result should be the same on pretty much any database and any Rails version. For the sake of argument you can assume Rails 5.1 and […]
Martian Chronicles 

Evil Front Part 2: Modern Front-end in Rails

Authors:Andy Barnov, Writer at Evil Martians. Teacher at Le Wagon. Former international TV correspondent and Alexey Plutalov, Front-end Developer at Evil Martians

An opinionated guide to modern, modular, component-based approach to handling your presentation logic in Rails that does not depend on any front-end framework. Follow this three-part tutorial to learn the bare minimum of up-to-date front-end techniques by example and finally make sense of it all.

Previously, on Part 1…

By the end of the much-discussed Part 1 (read it here), we have managed to rewire our standard Rails application to cater for modern front-end practices. We are using Webpacker gem to build our assets with W…

BigBinary Blog 

Ruby 2.5 added yield_self

This blog is part of our Ruby 2.5 series.

Ruby 2.5.0-preview1 was recently released.

Ruby 2.5 added a new method named yield_self. It yields the receiver to the given block and returns output of the last statement in the block.

irb> "Hello".yield_self { |str| str + " World" }
  => "Hello World"

How is it different from try in Rails ?

Without a method argument try behaves similar to yield_self. It would yield to the given block unless the receiver is nil and returns the output of the last statement in the block.

irb> "Hello".try { |str| str + " World" }
  => "Hello World"

Couple of differences to note are, try is not part of Ruby but Rails. Also try’s main purpose is protection…

Dustin Zeisler 

Refactoring Towards Immutable Objects in Ruby [Video]

Learn how to refactor from a mutable object into an immutable one while still being able to make changes to state. I’ll start with an Account class and show how you would let it emit new objects instead of changing the previous one. I walk step by step through the refactor process and talk about its possible advantages.

class Account
attr_reader :name, :balance

def initialize(balance:, name:)
@balance = balance
@name = name
end

def deposited(amount)
updated(balance: @balance + amount)
end

def withdrawn(amount)
updated(balance: @balance - amount)
end

private

def updated(balance: balance, name: name)
Account.new(balance: balance, name: name)
end
end

account = Ac…

Retweet Post

Dustin Zeisler 

ActiveMocker 2.6 Released

103rd release of ActiveMocker! See change log for details.

ChangeLog

tom-lord.github.io 

10 More New Features in Ruby v2.5

With the upcoming release of ruby v2.5 scheduled (as per tradition) for 25th December, it’s good to know what’s changed in the language - so you can take advantage any new (or refined) features.

This popular blog post by Junichi Ito highlighted 10 new features; but since there are so many improvements to the language, let’s dive in and unravel 10 more handpicked highlights!

1. More public Module methods

(Features #14132 and #13133).

Module#attr, attr_accessor, attr_reader, attr_writer, define_method, alias_method, undef_method and remove_method are now all public.

For example:

# Ruby v2.4
Integer.alias_method :plus, :+
#=> NoMethodError: private method `alias_method' called for…
Pat Shaughnessy 

Trying to Represent a Tree Structure Using Postgres

Suppose you had a hierarchical data structure in your application – how would you save it in a database? How would you represent a complex tree structure using flat rows and columns?

There are a few different, equally valid options. In this series of blog posts, I’ll take a close look at one option that Postgres provides, the LTREE extension. If you install and enable LTREE on your Postgres server, it will add powerful SQL operators and functions that support tree operations.

But what are these new SQL operators, and how do you use them? And how does LTREE actually work? What Computer Science does it use behind the scenes to enable fast tree operations?

This week I’ll publish a…

Drivy Engineering 

Embulk: move easily data across datasources

At Drivy, we heavily use Embulk for our data needs. Embulk is an open-source data loader that helps data transfer between various databases, storages, file formats, and cloud services. It can automatically guess file formats, distribute execution to deal with big datasets, offers transactions, can resume stuck tasks and is modular thanks to plugins.

Embulk is written in JRuby and the configuration is specified in YAML. You then execute Embulk configuration files through the command line. It’s possible to inject environment variables and other configuration files can be embedded thanks to the Liquid template engine.

Embulk architecture Overview of Embulk's architecture and its various components …
Andy Croll 

Set your page title in the view template using content_for

Rails uses content_for as its primary way to store content in one place for use in other views, layouts or helpers. Find out more about content_for in the Rails documentation in the ActionView helpers section.

Instead of…

…using an instance variable in the controller…

things_controller.rb

def show
  @page_title = 'Page Title'
  # other controller stuff
end

And views/layouts/application.html.erb

In the <head>.

<title><%= @page_title || 'Default' %></title>

Use…

content_for and yield.

things/show.html.erb

I like to put the title at the top of the individual view file.

<% content_for(:html_title) { 'Title' } %>

And views/layouts/application.html.erb

In the <head>.

<title>
All talking but no coding... 

AdequateErrors - Overcoming limitation of Rails model errors API

Over the years I encountered many issues related to ActiveModel::Errors API. After looking at the Rails source, I realized the original design was the root cause. errors was originally just a hash of array of String, which worked for simple requirements, but not for more complex ones.

In April I started collecting use cases, and study Rails source. Last month I finally put my hands on implementing a solution: a gem to apply object-oriented design principles to make each error an object, and provide new set of APIs to access these objects. I call it AdequateErrors.

AdequateErrors can be accessed by calling model.errors.adequate. It co-exists with existng Rails API, so nothing will break.…

Awesome Ruby Newsletter 

Issue 82 - That time I used Ruby to crack my Reddit password — RubyConf 2017

John Nunemaker 

FeatureFlipper.com: Why?

I have moleskines full of ideas. When I worked at Notre Dame (circa 2006), making products was all the rage. I spent all my free time thinking up and working on new apps. They never went anywhere, but were great fun and, more importantly, great practice.

Over time, a few of the apps I worked on did go somewhere, but for the past six years I have been happily employed at GitHub. I am not leaving GitHub, so why am I know building a new app? I will get to that, but first I am going to take a trip down memory lane that hopefully you will not find too boring. :wink:

The First

The first one that did go somewhere was Conductor. Conductor was a multi-site CMS that I built (along with many…

OmbuLabs Blog 

Upgrade Rails from 4.0 to 4.1

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

This article will cover the most important aspects that you need to know to get your Ruby on Rails application from version 4.0 to 4.1.

  1. Ruby version
  2. Gems
  3. Config files (config/)
  4. Application code
    1. Callbacks
    2. ActiveRecord
  5. Tests
  6. Miscellaneous
  7. Next steps

1. Ruby version

Rails 4.1 requires Ruby 1.9.3 or later. Ruby 1.8.7 support was dropped in Rails 4.0, so you should already be running 1.9.3 or later. For Rails 4.1, Ruby 2.0 (or newer) is preferred according to the official upgrade guide.

2. Gems

If your application relies on MultiJSON, you will need to add the gem to your Gemfile (gem 'multi_json') if…

The Bike Shed 

134: Fastributes

We share our favorite talks from RubyConf and discuss how Sean has made ActiveRecord attributes allocation significantly faster with Rust.

JRuby.org News 

JRuby 9.1.15.0 Released

The JRuby community is pleased to announce the release of JRuby 9.1.15.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.15.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…

Ruby Weekly 

#378: A Progress Update on Ruby 3x3

Ruby Weekly Issue 378 — December 7, 2017
Noah Gibbs
Ruby 3x3 is the idea that Ruby 3 should aim to be 3 times faster than Ruby 2.0. But how’s that working out so far? (Spoiler: Ruby 2.5 is already 1.65x faster than Ruby 2.0 so progress is good.)


Nate Berkopec
A well-researched journey into how malloc works in CRuby, sometimes doubling memory use, along with something to try to mitigate the issue.


Evil Martians
An opinionated guide to handling presentation logic in Rails that does not depend on any frontend framework or the asset…
RubyGuides 

Ruby Is Hiding Errors From You!

Ruby will intentionally hide some exceptions from you. Sometimes this can be useful. Like when using the Kernel#loop method with a block, the loop will stop when a StopIteration exception is raised. But other times this can make your debugging sessions a lot harder. Let’s see some examples! Hidden Exception: Comparable Module + <=> Method […]

The post Ruby Is Hiding Errors From You! appeared first on RubyGuides. Don't miss your free gift here :)

Appfolio Engineering 

How's Progress on Ruby 3x3?

Somebody on Reddit was curious: how are the Ruby folks doing on Ruby 3x3? This answer may be useful to some of you out there as well... (Please note that I don't decide this stuff, but I do keep track of it fairly closely.)

The main announced thrusts of Ruby 3 are performance, concurrency and typing.

For performance, the work is primarily occurring in the normal Ruby trunk. Matz has announced that he wants Ruby 3 to be three times as fast as Ruby 2.0.0, and there has been great progress in that direction.  Rails Ruby Bench is (surprise) a benchmark checking Ruby's performance using a big highly-concurrent Rails app. You can see the results on this engineering blog, thanks to Appfolio, who…

All Ruby Podcasts by Devchat.tv 

MRS 024: Peter Cooper

Panel: 

Charles Max Wood

Guest: Peter Cooper

This week on My JavaScript Story, Charles speaks with Peter Cooper. Peter was one the original panelist on Ruby Rogues and JavaScript Jabber. Currently, Peter runs several weekly new letters on JS, Ruby, Go, React, etc. Peter talks about he journey as a programmer started at an early age tinkering with his father’s computer at home. Peter describes the beginning as a hobby until he learned the skills to being programming on many platforms. Peter talks about how he learn Ruby and JavaScript, and in early stages of noodling or learning code. Lastly, Peter talks about his contributions to the community and giving back.

In particular, we dive…

BigBinary Blog 

Rails 5.2 implements fetch_values for HashWithIndifferentAccess

This blog is part of our Rails 5.2 series.

Ruby 2.3 added fetch_values method to hash.

By using fetch_values we are able to get values for multiple keys in a hash.

capitals = { usa: "Washington DC",
             china: "Beijing",
             india: "New Delhi",
             australia: "Canberra" }

capitals.fetch_values(:usa, :india)
#=> ["Washington DC", "New Delhi"]

capitals.fetch_values(:usa, :spain) { |country| "N/A" }
#=> ["Washington DC", "N/A"]

Rails 5.2 introduces method fetch_values on HashWithIndifferentAccess. We’ll hence be able to fetch values of multiple keys on any instance of HashWithIndifferentAccess class.

capitals = HashWithIndifferentAccess.new
capitals[:usa] =…
Red Panthers 

Crystal tuples: the immutable data structure of crystal

Tuple is a data structure which has immutable elements and is of a fixed size. Its similar to an array, but unlike arrays in crystal and ruby which allows adding more values over time a tuple is of fixed and cannot change. (Disclaimer: This article is meant for Ruby developer and explaining what a tuple is to a ruby developer).

In crystal we have two types of tuple

1) Tuple {1, "hello", :world}
2) NamedTuple {x: 1, y:2, z: 5}

They are immutable, which means if you try changing the value of an element in a tuple you will get an exception. Since crystal programs are compiled before execution you will get to see these errors while you compile the program itself.

example:

x = {1, 2, 3}

# to get…
Valentino G. | Blog 

Tutorial: How to set up React, Webpack 3, and Babel, in 2017

React is mostly used for creating Single Page Applications. But it’s possible to integrate the library into any website by using Webpack and Babel.

Most beginners don’t know how to glue React and Webpack together so here is a short tutorial for you.

React, Webpack, and Babel: a tutorial

How to set up React, Webpack, and Babel: what you will learn

  1. how to install and configure Webpack
  2. how to install and configure Babel
  3. how to install React
  4. how to create two React components by following the Container / Presentational principle
  5. how to include the resulting bundle into an HTML page
  6. how to install and configure Webpack Dev Server

React is not limited to full blown SPA. It’s possible to integrate the library into any existing…

Notes to self 

How to keep hash keys untouched by ActiveModel::Serializer

At work we use ActiveModel::Serializer to serialize ActiveRecord objects into JSON:API-like responses for our APIs. The problem is that ActiveModel::Serializer is clever enough to dasherize our hash keys (so they can be accessed as properties instead of [] brackets syntax) and our hash keys are actually real keys that we have to serve untouched.

Luckily the solution is more than simple. Insert the following setting into AMS initializer and you are done:

ActiveModelSerializers.config.key_transform = :unaltered

:unaltered have also the added benefit of being faster as it does not modify anything. I believe it should be default, perhaps it was, I am on version 0.10.5.

Tech Tips and Freebies – Rubyroid Labs Blog 

Top 9 Ruby Articles to Improve Your Web Development

Save time and boost your skills with this bundle of articles proven by Ruby community.
Greater Than Code 

057: Everything is UI with Christina Morillo

This episode is sponsored by Upside!

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


Panelists:

Rein Henrichs | Janelle Klein | Jessica Kerr

Guest Starring:

Christina Morillo: @divinetechygirl | christinamorillo.com | WOCinTech

Show Notes:

01:08 – Christina’s Background and Superpower: Multitasking and Automation

See Also: GTC 056: Systematize Your Hustle with Kronda Adair

04:42 – Automation Processes: Discovery and Reconnaissance, and When Human Judgement and Input is Necessary

10:03 – Multitasking Timescales and Context Switching

16:39 – Decision-making Functions

23:28 – Being Kind to Your Busy Self and Choosing What NOT To Do

We’re Going to Need More Wine: Stories That Are…

All Ruby Podcasts by Devchat.tv 

RR 339: Typical Day of a Developer

Panel:

Dave Kimura

Eric Berry

David Richards

In this episode, the Ruby Rogues panel discuss the typical day of a developer. Eric, David, and Dave speak about their daily routines as far as preparation, favorite task management tools, workflows, meetings, coding and testing, home life, working remote, commuting, health/mental healthy choices, and scheduling your projects to stay on course.

Importantly, the panel discusses how to handle burnout and keeping up the inspiration to work, and build side businesses. This is a great episode to learn tips and tricks from successful developers and staying the course for further success and longevity in the industry.

In particular, we dive pretty…

Honeybadger Developer Blog 

Adding Context to Exception Classes

We recently shipped version 3.2 of the honeybadger Ruby Gem, which includes a new feature to make it easier to add context to your error reports.
AkitaOnRails.com 

Cryptocurrencies: Is it a Bubble? Does it Matter?

Obs: this is a follow up to my previous post "From 10K and Beyond".

This is the million dollar question. Or billion!

If you watched the legendary movie "The Social Network", you know about the romanticized version of the equally legendary creation of Facebook. And you probably know all about the movie antagonists, the Winklevoss Twins.

But as the movie closes in the first years of Facebook way back more than 10 years ago you probably won't know that those same Twins heavily ventured into cryptocurrencies, and while influencing NYC legislation they also invested USD 11 million out of the USD 65 million from the Facebook settlement. In 2013 this allowed them to buy into 1% of the available…

Martian Chronicles 

Evil Front Part 1: Modern Front-end in Rails

Authors:Andy Barnov, Writer at Evil Martians. Formerly international TV correspondent, now teaches Ruby and Rails basics to beginners. and Alexey Plutalov, Front-end Developer at Evil Martians

An opinionated guide to modern, modular, component-based approach to handling your presentation logic in Rails that does not depend on any front-end framework. Follow our three-part tutorial to learn the bare minimum of up-to-date front-end techniques by example and finally make sense of it all.

Here’s to confused ones

Being a fresh Rails full-stack developer out in the wild is a confusing endeavor nowadays. A “classic Rails” way to handle front-end with Asset Pipeline, Sprockets, CoffeeScript…

dejimata 

Mobility 0.3: Ready for Prime Time

Just a little over six months ago, I released the first version of the Ruby translation framework I’ve called Mobility. With the third release of the gem – and a growing list of companies using it to power their production applications – I’m happy to say that Mobility is today more stable and reliable than ever before.

Column Strategy

And we have a liftoff1

As its name implies, Mobility is all about giving you choices. Whether you store your model translations in a set of model-specific tables, in a single shared table, as columns on each model table, or as values in a Postgres jsonb or hstore column, Mobility has you covered. Whether you use fallbacks, dirty change tracking, query support, or any…

This week, I’ve released Mobility 0.3, and in the spirit of its name, this release…

Speedshop - Ruby on Rails performance consulting 

Malloc Can Double Multi-threaded Ruby Program Memory Usage


Sometimes, it really is that simple.

It’s not every day that a simple configuration change can completely solve a problem.

I had a client whose Sidekiq processes were using a lot of memory - about a gigabyte each. They would start at about 300MB each, then slowly grow over the course of several hours to almost a gigabyte, where they would start to level off.

I asked him to change a single environment variable: MALLOC_ARENA_MAX. “Please set it to 2.”

His processes restarted, and immediately the slow growth was eliminated. Processes settled at about half the memory usage they had before - around 512MB each.


Actually, it’s not that simple. There are no free lunches. Though this one might…

Drifting Ruby Screencasts 

Tracking Errors with Sentry

Sentry is an Open Source error tracking that helps developers monitor and fix crashes in real time. Learn how to add and configure Sentry to your application.
Riding Rails 

This Week in Rails: Rails 5.2 beta, new PostgreSQL features, preload link and more!

Hello everyone! This is Roque bringing you the latest news from the Rails world.

Rails 5.2.0 beta released 🎉

This release includes Active Storage, a new framework provided by Rails to make it easier to upload and process files.

This Week’s Contributors

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

Add support for PostgreSQL operator classes to add_index

The operator classes identify database operators to be used by the index for the columns. You can assign the same operator to all columns, or not. It currently only supports PostgreSQL.

Add ability to create PostgreSQL foreign keys without validation

Normally,…

Notes to self 

InvoicePrinter 1.1.0 will bring A4 page size support, command line client and more

Not so long ago I announced first stable release of InvoicePrinter. I wanted to say that the API is stable and people to experiment with it. I am happy  to see that the project got already over 3 hundred stars and 20 forks. Wow, thanks! This kind of support motivates me to work on the next version more intensively.  Speaking of which… here is what’s coming in 1.1.0 release.

A4 page size support

When I started this project I didn’t think too much about paper versions since I was always handling invoices online. Prawn default is letter size and not A4 and that’s why the first version supported only this letter page size (not to be confused with full American letter support in terms of…

Appfolio Engineering 

How Much Faster is Ruby 2.5.0 Preview 1?

Ruby 2.5 is coming! Preview 1 was released. There are a bunch of new features. I'm looking forward to delete_prefix and delete_suffix, myself. There are more articles coming.

And of course, as always, there are performance improvements.

I spend a lot of time benchmarking Ruby. I'm here answering the question, "but how much faster does this make my Rails app?" Clearly it's time for some Ruby 2.5 benchmarking.

What Are We Measuring?

My benchmark Rails Ruby Bench sets up Discourse under a pretty heavy concurrent load of user requests. It determines how fast it can handle them all as it saturates a large, dedicated EC2 instance with requests that need to be handled by Rails (e.g. no static assets.)

Rodrigo Rosenfeld Rosas 

Testing HTTPS in a Linux development environment with self-signed certificates

Note: if you only care about getting the certificates, jump to the end of the article and you'll find a button to just do that. This way you don't even need Linux to generate them.

For a long time I've been testing my application locally using a certificate issued by Let's encrypt, which I must renew every few months for domains such as dev.mydomain.com. Recently, I've been considering creating a new app and I don't have a domain for it yet.

So I decided to take some time to learn how to create self-signed certificates in such a way that browsers such as Chrome and Firefox would accept it without any disclaimer with no extra step.

It took me about 2 hours to be able achieve this task, so…

Rebased Blog 

Bindings in Ruby – Behind the Magic of Blocks

Introduction Why block can see local variables defined before him? Why can it change them? What kind of sorcery is this? I will try to answer that question in this post. We will see examples of blocks and hidden secret hero behind the magic – binding object. In our magical...
Awesome Ruby Newsletter 

Issue 81 - Rails 5.2: Active Storage, Redis Cache Store, HTTP/2 Early Hints, CSP, Credentials

AkitaOnRails.com 

From 10k and Beyond: Discussing Crypto Currencies

cryptocurrencies

After the historical USD 10,000 break a day ago, Bitcoin and cryptocurrencies in general finally reached the mainstream media in a bombastic way.

Like many in the tech industry, I tried the tech since the very beginning. I myself mined a couple bitcoins back in 2009, then lost my wallet private key, totally forgot about it, and many years later here I am, kicking myself in the butt :-)

When it reached USD 3,000 I had my interest in the platform totally renewed. And it was a very pleasant surprise to see how big it became. If you follow me, you know how eager I am to learn new things that have real potential. And also how easy I am to turn my attention full gear into something.

I can…

Ruby Weekly 

#377: Rails 5.2.0 Beta Released

Ruby Weekly Issue 377 — November 30, 2017
Official Rails Blog
The latest 5.x release targets file uploads with Active Storage, a vastly improved Redis Cache Store, HTTP/2 early hints support, and more.


Bruno Antunes
ActionCable makes it easy to work with WebSockets from Rails apps, but what about connecting a plain React frontend to a Rails API backend?


Amit Choudhary
delete_suffix is basically String#chomp and delete_prefix is the inverse.


Engine Yard  Sponsored
If you want to move your…
Honeybadger Developer Blog 

Major Client Update For Elixir

This month we released a new version of our hex package, which includes a major refactor of the internal client logic as well as some new features, improvements, and bug fixes.
Schneems - Programming Practices, Performance, and Pedantry 

Say No to Randos (in Your Database)

When I used my first ORM, I wondered “why didn’t they include a random() method?” It seemed like such an easy thing to add. While there are many reasons you may want to pull a record out of your database at random, you shouldn’t be using SQL’s ORDER BY RANDOM() unless you’ll only be randomizing a limited number of records. In this post, we’ll examine how such a simple looking SQL operator can cause a lot of performance pain, and a few different techniques we can use to fix it.

GoRails Screencasts 

Rails & Vue.js Trello Clone - Part 1

Set up Rails models, scaffolds, and webpacker with Vue.js to start rendering our views
Search Results for “ruby” – via @codeship 

Going Serverless? Compare Your FaaS Options

Reading Time: 5 minutes

As is typical with new concepts and technologies, the absolute definition of “serverless” or FaaS (Functions as a Service) is broad and undefined. In essence, it is a concept that takes cloud computing and “convenience as a service” to the extreme, spinning up processing power when your application needs it and responding with data.

Serverless is perfect for IoT devices, microservice architectures, or any other application that needs to be efficient. In this article, I will look beyond the major players (AWS, Azure, Google) to highlight lesser-known contenders for you to consider for your next project.

Many share similarities and features, some are container-based,…

All Ruby Podcasts by Devchat.tv 

RR 338: Data Warehousing with Trae Robrock

Panel:

Charles Max Wood

Dave Kimura

David Richards

Special Guest: 

Trae Robrock

In this episode, the Ruby Rogues speaks with Trae Robrock. Trae is on Ruby Rogues to talk about his current business Green Bits. Green Bits creates point of sale (POS) inventory management software for the legal cannabis industry. Green Bits has been in business for the last 3 years since 2014, and they have launched alongside Washington states recreational program. Green Bits is functioning 7 states and is running  80% of the Washington market.

Trae explains about the real-time mapping built-in the tracking system in the APIs. Furthermore, Trae talks about the tracking system between the seed to the…

EquiValent - Web Developer Blogs 

Ruby #call method

Ruby method #call is common interface protocol for calling Lambdas, Method objects, Procs,... In this article I'll try to present why it's important to name the run method #call in your custom class objects
Hi, we're Arkency 

Event Sourcing is a transferable skill

As developers we’re constantly learning to keep our axes sharp. Getting to know new concepts, patterns or paradigms broadens our horizons. It may eventually result in having new perspective how to solve business problems we’re facing.

Learning comes with a certain cost. It’s an investment we’re taking now to reap benefits from it in the future. In a longer or a shorter term. Can we always justify this cost? Will the thing we’ve learned be still useful in a year or two? Or after we’re forced to change the hammer — being it the framework or language we specialize in?

Is this whole Event Sourcing a skill worth learning?

Below you’ll find an example of Event Sourcing in Ruby. Give it a…

Hi, we're Arkency 

Why Event Sourcing basically requires CQRS and Read Models

Event sourcing is a nice technique with certain benefits. But it has a big limitation. As there is no concept of easily available current state, you can’t easily get an answer to a query such as give me all products with available quantity lower than 10.

You could read Product-1 stream of events for Product with ID=1, use them to rebuild the current state of this one product and get an answer to whether it has less than 10 available quantity. But to find all such products, you would need to iterate over all Product-* streams, and process all domain events stored for all products. That would be costly and take a lot of time.

All that use-cases that you see in your daily job get a little…

Hi, we're Arkency 

How to get an audit log with RailsEventStore today

Did you know you can already get an audit log with RailsEventStore for free?

One of the benefits of having domains events as the source of the truth in application is that they naturally form log of what happened. Such trail of outcomes is much useful in debugging — not only for us developers but mostly for business people.

I’ve been consulting on a project where we’ve built a webapp solely for the purpose of showing such log. As an operations manager you were able to examine what happened for particular order — each one had a dedicated stream that grouped significant changes over whole lifecycle. That allowed understanding what was the path that customer has taken and how to best help…

Valentino G. | Blog 

Tutorial: Javascript End to End Testing with Cypress

Are you struggling with End to End Testing? I feel you. E2E shouldn’t be hard. In the following post you’ll learn how to do Javascript End to End Testing with Cypress.

End to End Testing with Cypress

End to End Testing, also called E2E or UI testing is one the many testing phases covering a web application.

By writing an End to End Test it is possible to assert whether a web application works as expected or not. Plus, with E2E you will test the user flow of your application. Starting from the signup process.

Is End to End Testing really important?

Yes it is. But nobody likes E2E tests. They can be slow, cumbersome and expensive.

On the other hand testing gives you confidence. By testing an application you can be sure it…

BigBinary Blog 

Ruby 2.5 added delete_prefix and delete_suffix methods

This blog is part of our Ruby 2.5 series.

Ruby 2.5.0-preview1 was recently released.

Ruby 2.4

Let’s say that we have a string Projects::CategoriesController and we want to remove Controller. We can use chomp method.

irb> "Projects::CategoriesController".chomp("Controller")
  => "Projects::Categories"

However if we want to remove Projects:: from the string then there is no corresponding method of chomp. We need to resort to sub.

irb> "Projects::CategoriesController".sub(/Projects::/, '')
  => "CategoriesController"

Naotoshi Seo did not like using regular expression for such a simple task. He proposed that Ruby should have a method for taking care of such tasks.

Some of the names…

RubyGems Blog 

2.7.3 Released

RubyGems 2.7.3 includes minor enhancements 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.

Minor enhancements:

  • Removed needless version lock. Pull request #2074 by SHIBATA Hiroshi.
  • Add –[no-]check-development option to cleanup command. Pull request #2061 by Lin Jen-Shin (godfat).
  • Merge glob pattern using braces. Pull request #2072 by Kazuhiro NISHIYAMA.
  • Removed warnings of unused variables. Pull request #2084 by SHIBATA Hiroshi.
  • Call SPDX.org using HTTPS. Pull request #2102 by Olle…

Bug fixes:

  • Fix test failure on Alpine Linux. Pull request #2079 by Ellen Marie Dash.
  • Avoid encoding issues by using binread in setup. Pull request #2089 by Mauro Morales.
  • Fix rake install_test_deps once…
Giant Robots Smashing Into Other Giant Robots 

Graceful Switching of Worker Processes

A recent client project featured a subtle misconfiguration which left the application susceptible to losing jobs performed by worker processes. This post explores the issue and builds a demonstration on Heroku.

A Primer: Why Use Worker Processes?

When a user makes an HTTP request sometimes it’s necessary to perform a slow task like sending an email or generating a report. If this slow task is performed by the web server before sending an HTTP response then the user can be left staring at a blank page. That’s a poor experience for the user.

It’s also accompanied by a bunch of potential headaches: What if the request times out? And what happens if the user hits refresh in their…

Riding Rails 

This Week in Rails: expiring counters, flush db connections, connection fork safety and more!

Hi! Prathamesh here! Let’s see what we have in store today from the Rails world.

This Week’s Contributors

This week we had 25 contributors. 8 of them were first time contributors!!!! 🎉

Support expiring counters for Memcached Store

This change adds supports for passing expires_in options to the #increment and #decrement methods of the Memcached  store.

Flush idle database connections automatically

A new configuration to flush the idle database connections after a specified period. Defaults to 300 seconds. This change will ensure that you don’t have idle database connections hanging around in your connection pool.

Improve Active Record connection fork safety

This change ensures that…

Riding Rails 

Rails 5.2.0 beta: Active Storage, Redis Cache Store, HTTP/2 Early Hints, CSP, Credentials

It’s been too hard to deal with file uploads in Rails for too long. Sure, there’s been a lot of fine plugins available, but it was overdue that we incorporated something right into the framework. So now we have!

With the new Active Storage framework in Rails 5.2, we’ve solved for the modern approach of uploading files straight to the cloud. Out of the box, there’s support for Amazon’s S3, Google’s Cloud Storage, and Microsoft Azure Cloud File Storage.

If you’re dealing with images, you can create variants on the fly. If you’re dealing with videos or PDFs, you can create previews on the fly. And regardless of the type, you can analyze uploads for metadata extraction asynchronously.

Active…

zverok with ruby 

Call for apprentice

TL;DR: I propose a mentorship for those ready to collaborate on a several opensource projects for motivated developers.

You will:

  • work on one of projects, started or invented by me,
  • following the plan we’ll make together,
  • through GitHub issues and PRs,
  • with extensive and regular code reviews, advice and hints.

In a process, you’ll have a practical experience of writing good code, structuring it, optimizing, testing and documenting, as well as an overall experience of real-world gem development participation — and something to add to your CV as a project you’ve created, maintained or participated in.

Me

Commercial programming since 2003, Ruby programming since 2005. Ruby…

Martian Chronicles 

Zero downtime rebranding

Authors:Vladimir Dementyev, Back-end Developer at Evil Martians and Sergey Ponomarev, Teamlead at Evil Martians

Learn how to migrate your Heroku-hosted application from one domain name to another. See how to rewire an existing Rails project (tests included!) and make it work with multiple domains on a single Heroku instance. SSL caveats are covered too.

So, you have a web application running successfully in production. Suddenly, management decides to rebrand it. For some reasons, cows.com doesn’t cut it anymore, so your client is now a proud owner of www.bulls.com. From a user’s perspective, it should look like a simple redirect in a browser. Your turn to implement it!

“That’s…

Avdi Grimm 

MOOM Course Schedule Change

Short version: The course Master the Object-Oriented Mindset in Ruby and Rails (MOOM) will now be starting Monday, January 8 instead of December 4. The deadline for enrollment is now Friday, December 22.

The whys and wherefores:

The MOOM beta course is my first online course offering, and like any beta it’s an iterative learning process. One thing that I’ve learned so far is that I need a bit more time than I originally gave myself to fit all the various moving parts together. I considered slipping the schedule by just two weeks, but since I had already planned on a two-week break for the holidays, that would have meant kicking off the course and then almost immediately going to break. So,…

Andy Croll 

Choose UUIDs for model IDs in Rails

A universally unique identifier (UUID) is a 128-bit number used to identify information in computer systems. Sometimes it is referred to as a ‘globally unique identifier’.

These are a native column type in PostgreSQL. You can find more details on native Postgres types in the Rails Guides.

Instead of…

…using Rails’ default incrementing integer id.

Use…

…PostgreSQL’s UUID support. Ruby on Rails has had the ability to use UUIDs as the id for ActiveRecord models since version 5.0.

Enable the PostgreSQL extension

bin/rails g migration enable_extension_for_uuid

class EnableExtensionForUuid < ActiveRecord::Migration[5.1]
  def change
    enable_extension 'pgcrypto' unless extension_enabled?

Create config/initializers/generators.rb

Rails.application.config.generators do |g|
  g.
Dustin Zeisler 

Freeze Ruby Constants [Video]

An intro video to Ruby constants their enforcement pitfalls and how to fix them and why you should care in your code.

In computer programming, a constant is a value that cannot be altered by the program during normal execution, i.e., the value is constant. - Wikipedia

This is what happens in Ruby when redefining a constant with another object.

A_CONST = :first_value 
A_CONST = :new_value

It outputs a warning.

warning: already initialized constant A_CONST

If you’re not paying attention to warnings in Ruby then enforcing constants is not possible. I would recommend that you listen to this warning and fix them when they come up.

If the constant is attempted to be reassigned…

Ruby Inside - Medium 

Class Methods In Ruby: a Thorough Review & Why I Define Them Using class << self

https://pixnio.com/nature-landscapes/winter/landscape-sky-winter-snow-ice-water-tree-nature-outdoor-reflection

Class methods are the source for continuous discussions and disagreements among my colleagues. While some consider them precise and helpful, others feel they are actually pesky and that they tend to make code harder to read and manage. As for me, I find that the truth tends to lean to the latter; I embrace Ruby’s OO nature and I like to think (and read!) in objects. Having said that, sometimes class methods are indeed necessary. From factory methods to complicated metaprogrammed interfaces through ActiveRecord’s models custom query methods, class methods cannot be negated…

Awesome Ruby Newsletter 

Issue 80 - Ruby 2.5 introduces Dir.children and Dir.each_child | BigBinary Blog

Ruby – Sihui Huang 

Design Pattern: Iterator and Movie Collections

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

 

The Iterator Pattern answers this question: What’s next?

The Iterator Pattern provides a way to access the elements of an aggregate object sequentially without exposing its underlying representation.

In English, an iterator returns items from a collection one at a time until it has returned all items from the collection.

Let’s use the Iterator Pattern to build our movie collection.

Let’s pretend we have subscriptions for both Netflix and Amazon Prime. Our goal is to combine all the movies on Netflix and Amazon Prime to build our movie collection.

We can ask…

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 instead 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 :)

All talking but no coding... 

Magics that Decorator/Presenter Gems Do to Make Your Type Less

Some of you Rails developers probably have used a 'decorator' or 'presenter' library. These libraries aim to bridge between Rails model and view layers. If I am to define it, a presenter allows developers to group helper methods related to a model to be under a namespace related to that model, instead of the current global space.

But would you believe it? There are actually a dozen or more decorator/presenter gems out there. Why do we reinvent the wheels? The first reason is that there is really a demand, because keeping large amount of helper methods under the same namespace is just unrealistic. The second reason is that, these gem owners have different views on this philosophical…

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?
Ruby – AWS Developer Blog 

Introducing Support for Generating Ruby SDKs in Amazon API Gateway

We’re excited to announce support for generating Ruby SDKs from Amazon API Gateway. The Ruby SDKs you generated are compatible with Ruby 1.9 and later. Generated SDKs have first-class support for API keys, custom or AWS Identity and Access Management (IAM) authentication, automatic and configurable retries, exception handling, and all privileges of aws-sdk-core version 3 has as well. In this blog post, we’ll walk through how to create an example API and generate a Ruby SDK from that API. We also explore various features of the generated SDK. In this post, we assume you have some familiarity with API Gateway concepts.

Creating an example API

To start, let’s create an sample API by using…

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 …

RubySec 

Unsafe objects can be loaded from Redis

Rebased Blog 

SQL on Rails Part 2: How

Using SQL on Rails for fun and profit, part 2.
Test Double | Our Thinking 

There's Nothing.new

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 Wanstrath's Ruby Hoedown 2008 Keynote

Kindness

Powerful

Productive and pragmatic

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

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…

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…