Rubyland

news, opinion, tutorials, about ruby, aggregated
Sources About
Hi, we're Arkency 

Tracking dead code in Rails apps with metrics

When you work in big Rails application sometimes you would like to remove certain lines of code or even whole features. But often, you are not completely sure if they are truly unused. What can you do?

With chillout.io and other monitoring solutions that’s easy. Just introduce a new metric in the place of code you are unsure about.

class SocialSharesController < ApplicationController
  def friendster
    Chillout::Metric.track('SocialSharesController#friendster')

    # normal code
  end
end

After you add a graph to your panel, you can easily configure an alert with notifications to Slack, email or whatever you prefer, so that you are pinged if this code is executed.

Wait an…

Hi, we're Arkency 

What I learnt today from reading gems' code

Today I was working on chillout.io client and while I was debugging some parts, I had a look at some Ruby gems. This is always an interesting experience because you can learn how other developers design their API and how different it can be from your approach.

Sidekiq

So here are some interesting bits from sidekiq code.

Sidekiq::Client initializer

module Sidekiq
  class Client
    def initialize(redis_pool=nil)
      @redis_pool = redis_pool ||
      Thread.current[:sidekiq_via_pool] ||
      Sidekiq.redis_pool
    end
  end
end

Quoting the documentation:

Sidekiq::Client normally uses the default Redis pool but you may pass a custom ConnectionPool if you want to shard your Sidekiq jobs…

Schneems - Programming Practices, Performance, and Pedantry 

A Tale of Slow Pagination

When I see a query in my logs without either a limit or a count clause, alarm bells go off because it is likely a hotspot. A pagination query has alimit so it usually flies under my radar:

Ruby Weekly 

#354: Rails' CurrentAttributes considered harmful

This week's Ruby and Rails news
Read this e-mail on the Web Ruby Weekly Issue 354 — June 22, 2017
Launch School
Goes a level deeper than most Rails tutorials, looking at the how and why behind what Rails does.


Ryan Bigg
A recent commit introduces a thread-isolated attributes singleton to Rails, but how and why could global state be a bad thing? Ryan Bigg investigates.


Contactually
Contactually’s approach uses Makara, a DB connection proxy, to split query balancing among databases.


UpgradeRails  Sponsored
AkitaOnRails.com 

The Economics of Software Development

The software development community is boiling nowadays with so many options all at once. You have dozens of active and very good languages such as Go, Elixir, Clojure. Dozens of very good frameworks, both in the back-end and front-end including React, Elm. Dozens of sound methodologies from good old Agile stuff all the way to Continuous Deployment with microservices.

Now, you're a small tech startup or even a small team in a big corporation. How to even start?

And the recommendation is: do the smallest thing that works first. Always. Of course, avoid "quick and dirty" as much as you can. But don't get paranoid and over-engineer too much.

Over-engineering is as expensive as doing things…

blog of Marian Posăceanu - rubyist most of the time 

JRuby, RVM and Vim walk into a (performance) bar

I'm not sure why RVM is still my default Ruby version manager yet the issue at hand should be reproducible on rbenv too.

Let's add a bit of context to this: we have an API written in Ruby and running on JRuby i.e. via JVM which implies slow start-up times compared to CRuby (yes, even with export JRUBY_OPTS='--dev'). I use Vim 8.0.502 which of course comes by default bundled with Tim Pope's vim-ruby .

The problem: since I've switched to JRuby I started to notice a slowdown whilst working in Vim with .rb files. I did not pay too much attention to it at first (read almost for a month) but today it really started to bug me. I had no idea what was causing the slowdown so I tried Vim's trusty…

The Bike Shed 

115: I Don't Need Another Google Hangout (Cecy Correa)

We talk with Cecy Correa about how to hire and get hired.

Giant Robots Smashing Into Other Giant Robots 

Tips for Using FactoryGirl Without an ORM

FactoryGirl is one of my favourite testing tools — I was a fan prior to joining thoughtbot. It’s one of those tools I miss immediately when working outside the Ruby ecosystem.

Recently I’ve been working on a Rails project that doesn’t need any database persistence and therefore doesn’t use an object-relational mapper like ActiveRecord. Instead data is fetched from an external JSON API and parsed into value objects written in plain Ruby.

At the outset, the value objects needed for unit tests were manually written for each example. As further attributes were added to the models this quickly became tedious; the value objects created for previous tests also needed updating.

Fortunately…

Hi, we're Arkency 

Dogfooding Process Manager

Process managers (sometimes called Sagas) help us with modeling long running processes which happen in our domains. Think of such process as a series of domain events. When enough of them took place (and the particular ones we’re interested in) then we execute a command. The thing is that the events we’re waiting for might take a longer time to arrive, during which our process manager has to keep track of what has been already processed. And that’s where it gets interesting.

The Domain

Consider following example taken from catering domain. You’re an operations manager. Your task is to suggest your customer a menu they’d like to order and at the same time you have to confirm that…

AkitaOnRails.com 

Starting with Blender

Blender is a beast. A true marvel of open source technology achievement, you should applaud everyone that have been involved in making this thing work as well as it does. It rivals the most expensive commercial options out there, from Maya to the venerable Pixar's Renderman.

The Blender community is so passionate and committed that they frequently produce high quality, almost hollywood grade, short movies within Blender in order to stress test the tool, fix bottlenecks and usability issues in a real world workflow.

This is primarily a post intended for "future me" to be able to jump back into a single resource list. As being a 3D modeler is not my full time job, I will have large hiatus…

All Ruby Podcasts by Devchat.tv 

RR 315 Offshoring and Latin American Developers with David Hemmat

Offshoring and Latin American Developers - David Hemmat


For this episode of Ruby Rogues we have Jason Sweat and Brian Hogan for our panel along with Charles Max Wood and a special guest, David Hemmat from BlueCoding.com. David and the Blue Coding team work to connect developer talent to businesses in need through a thorough process of vetting as well as a database collection of potential developers. Check out this episode to learn more!

How did you get started?

1:34

David talks about going to school in the Dominican Republic worked locally, but later found work with US companies. He also set up a friend with a US job and they realized that there may be a demand as someone to bridge the…

Stories by DHH on Medium 

Uber’s CEO is out because of pressure, not some ethical epiphany from the board

It’s hard to predict exactly how much pressure is needed to affect change, but it’s clear to see when there is enough. And there was finally enough to flush out Uber’s CEO.

But let’s not kid ourselves. Kalanick didn’t get the boot because Uber’s board had some ethical epiphany. They presided over his misdeeds for years. Fat, golden years steered by toxic leadership and fueled by depraved acts.

Now greed has taken a backseat to fear. Fear that the pressure that once seemed so easy to ignore will suddenly drown them all. Flushing out the CEO goes from “impossible to even consider” to “impossible to avoid” in what seems no time at all.

On the board, it probably did look like “life comes at you…

The Life of a Radar 

Rails' CurrentAttributes considered harmful

I was made aware of this commit recently (thanks to Rebecca Skinner) to Rails which introduces what is effectively a global state to Rails applications.

Rather than writing why global state in-general is a bad thing myself, I will instead link you to this excellent question + answer on the Software Engineering Stack Exchange.

Very briefly, it makes program state unpredictable.

To elaborate, imagine you have a couple of objects that both use the same global variable. Assuming you're not using a source of randomness anywhere within either module, then the output of a particular method can be predicted (and therefore tested) if the state of the system is known before you execute the method.

This implementation also chooses to use thread-local variables which this answer over on Stack Overflow explains is not a good choice because:

  • It's harder to test them, as you will have to remember to set the thread-local variables when you're testing out code that uses it
  • Classes who use thread locals will need knowledge that these objects are not available…
Greater Than Code 

Episode 037: Failure Mode with Emily Gorcenski

Panelists:

Coraline Ada Ehmke | Sam Livingston-Gray

Guest Starring:

Emily Gorcenski: @EmilyGorcenski | emilygorcenski.com | Simple

Show Notes:

00:16 – Welcome to “Diamonds Are For Gender” …we mean, “Greater Than Code!”

00:56 – Origin Story, Superpowers, and Data Science

04:20 – Diversity and Career Paths in Data Science

10:51 – Ethical Debates Within the Data Science Field

Weapons of Math Destruction: How Big Data Increases Inequality and Threatens Democracy

Therac-25

FMEA (Failure Mode Effects Analysis)

17:21 – Software Development and Engineering; Failure Modes in Software

21:44 – Failure Modes in Democracy; Voting Machine Software

33:37 – Working for a Government Contractor

36:21 – Data…

Riding Rails 

Rails 5.1.2.rc1 has been released

Hi everyone,

I am happy to announce that Rails 5.1.2.rc1 has been released.

If no regressions are found, expect the final release on Monday, June 26, 2017. If you find one, please open an issue on GitHub and mention me (@rafaelfranca) on it, so that we can fix it before the final release.

CHANGES since 5.1.1

To view the changes for each gem, please read the changelogs on GitHub:

Full listing

To see the full list of changes, check out all the commits on GitHub.

SHA…

Appfolio Engineering 

A Story of Passion and Hash Tables

Ruby 2.4.0 introduced a lot of great new features. One of them was open addressing for hash tables - the details of open addressing are a bit obscure, but Ruby hash tables are now faster. Everybody uses hash tables, so everybody gets extra speed. Awesome!

But how did that happen? There's an interesting story there. Let's tell that story and benchmark with Rails Ruby Bench, shall we? (Don't care about the story? Scroll down to the end for graphs of the speed differences.)

A Beginning and Some Dueling Banjos

Ruby's open addressing for hash tables is recorded by a truly wonderful bug report. If you don't care about my commentary, just go read it. Seriously.

It begins with Vladimir Makarov…

Search Results for “ruby” – via @codeship 

HashiCorp Tools Useful for Continuous Integration

Reading Time: 8 minutes

HashiCorp is a company that feels like it’s always been around. Quietly plugging away just out of the limelight working on awesome products and every now and then releasing something groundbreaking that you wondered how you worked without it. I attended a couple of meetups recently that covered HashiCorp tools and felt the time was ripe I dug into all they have to offer a CI workflow.


“Digging into all that HashiCorps tools have to offer a CI workflow.” via @ChrisChinch
Click To Tweet


Vagrant

Before my writing career, I was an implementer of and contributor to Drupal. In a world of complex stacks consisting of different web servers, language versions, database…

BigBinary Blog 

Rails 5.1 has dropped dependency on jQuery from the default stack

This blog is part of our Rails 5.1 series.

Rails has been dependent on jQuery for providing the unobtrusive JavaScript helpers such as data-remote, data-url and the Ajax interactions. Every Rails application before Rails 5.1 would have the jquery-rails gem included by default.

The jquery-rails gem contains the jquery-ujs driver which provides all the nice unobtrusive features.

But now JavaScript has progressed well such that we can write the unobtrusive driver which Rails needs using just plain vanilla JavaScript.

That’s what has happened for the 5.1 release. The jquery-ujs driver has been rewritten using just plain JavaScript as part of a GSoC project by Dangyui Liu.

Now that the…

Everyday Rails 

Testing with RSpec book updated for 2017

I've released the first seven chapters (plus one) of an all new edition of my popular introduction to RSpec for Rails. Here's what's new, and what to expect next.
Riding Rails 

Rails 4.2.9.rc2 has been released

Hi everyone,

I am happy to announce that Rails 4.2.9.rc2 has been released.

This is going to be the last bug fix release of the 4.2 series, so please test this release candidate.

If no regressions are found, expect the final release on Monday, June 26, 2017. If you find one, please open an issue on GitHub and mention me (@rafaelfranca) on it, so that we can fix it before the final release.

CHANGES since 4.2.8

To view the changes for each gem, please read the changelogs on GitHub:

Full…

Riding Rails 

Rails 5.0.4 has been released

Hi everyone,

I am happy to announce that Rails 5.0.4 has been released.

CHANGES since 5.0.3

To view the changes for each gem, please read the changelogs on GitHub:

Full listing

To see the full list of changes, check out all the commits on GitHub.

SHA-256

If you’d like to verify that your gem is the same as the one I’ve uploaded, please use these SHA-256 hashes.

Here are the checksums for 5.0.4:

$ shasum -a 256…
GoRails Screencasts 

Charts with Chartkick and Groupdate

Add various types of charts to your Rails app with Chartkick and use Groupdate to make easy group queries in SQL
Depfu 

A more CI friendly Depfu

Dependency updates are important, but almost always not more important than the work your team is doing.

At Depfu our goal is to build a service that really helps your team stay up-to-date without getting annoying or in the way.

We got a lot of feedback about how Depfu’s pull requests affect your CI system and we just shipped a few improvements to make sure we’re not monopolizing your CI and blocking more important work.

Creating pull requests right away

In the past we waited with the creation of the pull request until we knew the CI results from the branch we pushed. While that still make sense in certain cases for Ruby library projects, we now push the branch and create the pull…

Tech Tips and Freebies – Rubyroid Labs Blog 

7 Types of Cyber Attack You Need to Know About

Reading Time: 3 minutes

Though cyber attacks have been with us for a while, they still seem to be something from distant worlds of Matrix or Blade Runner. They are much more real than we are used to think, so let’s have a look at the most common ones.

1. Malware

What is it?

In fact, the word Malware is a combination of two words “malicious” and “software” and there is no a better way to describe it. This type of cyber attack includes all sorts of harmful software, including Trojans, viruses and what not. It can get to your computer either from emails, system vulnerabilities and all sorts of downloads.

How can I protect from it?

In terms of combating viruses, anti-virus is your best friend.…

BigBinary Blog 

Ruby 2.4 has deprecated toplevel constants TRUE, FALSE and NIL

This blog is part of our Ruby 2.4 series.

Ruby has top level constants like TRUE, FALSE and NIL. These constants are just synonyms for true, false and nil respectively.

In Ruby 2.4, these constants are deprecated and will be removed in future version.

# Ruby 2.3

2.3.1 :001 > TRUE
 => true
2.3.1 :002 > FALSE
 => false
2.3.1 :003 > NIL
 => nil
# Ruby 2.4

2.4.0 :001 > TRUE
(irb):1: warning: constant ::TRUE is deprecated
 => true
2.4.0 :002 > FALSE
(irb):2: warning: constant ::FALSE is deprecated
 => false
2.4.0 :003 > NIL
(irb):3: warning: constant ::NIL is deprecated
 => nil
Drifting Ruby Screencasts 

Working with Subdomains

Learn to create a multi-tenant application where access to tenants are determined by the subdomain.
Riding Rails 

This Week in Rails: mailer configuration, perf improvement, and bug fixes!

Hi there! This is Andy, bringing you another edition of This Week in Rails. Let’s dive in.

Featured

🎉 This Week’s Rails contributors! 🎉

We had 23 awesome people who helped make Rails better this week, with 4 first-time contributors! Would you like to help as well? Head over to the 👉 issues list.

New

Allow mailers to configure their delivery job

In some situations, a user may want to configure the delivery job in order to have better control over errors. This adds an option to make that possible.

Perf

Improve performance of mass assignments

This change makes a small improvement to the performance of initializing an ActiveModel instance. The other interesting thing I learned about…

AkitaOnRails.com 

Ex Manga Downloadr - Part 7: Properly dealing with large Collections

In my previous post I was able to simplify a lot of the original code through the use of Flow. But the downside is that the running time actually increased a lot.

José Valim kindly stepped in and posted a valuable comment, which I will paste here:

Have you tried reducing the @max_demand instead? @max_demand is how much data you exchange between stages. If you set it to 60, it means you are sending 60 items to one stage, 60 items to the other and so on. That gives you poor balancing for small collections as there is a chance all items end-up in the same stage. You actually want to reduce max_demand to 1 or 2 so each stage gets small batches and request more than needed. Another parameter…

Rodrigo Rosenfeld Rosas 

Adopting React.js seems risky for long-term projects

Important Update

Feel free to completely skip this article as it's no longer relevant. I was confused by this part of the React documentation:

It is important to remember that the reconciliation algorithm is an implementation detail. React could rerender the whole app on every action; the end result would be the same.

It turns out "rerender", as explained in the ticket I created on the React project, means calling render in all components, it doesn't mean it could unmount and remount all components. If it remounted everything as I interpreted initially, it wouldn't be possible to integrate to any third-party library, which was my main concern.

That gives me enough confidence to adopt…

The Bike Shed 

114: Reasonably Thread Safe

We discuss a tiny DOS caused when upgrading thoughtbot.com to Rails 5.1 and how Rails could better surface warnings that only occur in your production configuration. We also get an update on multi-table joins in Rust.

BigBinary Blog 

Managing Rails tasks such as 'db:migrate' and 'db:seed' on Kubernetes while performing rolling deployments

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

Problem

We want to deploy a Rails application on Kubernetes. We assume that the assets:precompile task would be run as part of the Docker image build process.

We want to run rake tasks such as db:migrate and db:seed on the initial deployment, and just db:migrate task on each later deployment.

We cannot run these tasks while building the Docker image as it would not be able to connect to the database at that moment.

So, how to run these tasks?

Solution

We assume that we have a Docker image named myorg/myapp:v0.0.1 which contains the source code for our Rails application.

We also assume…

All Ruby Podcasts by Devchat.tv 

MRS 007 My Ruby Story Charles Max Wood

My Ruby Story with Charles Max Wood
This week’s episode is a bit different. Charles Max Wood interviews… Charles Max Wood! Hear a bit about how Charles’ grandfather inspired him towards his career in programing, how handling technical support for Mozy somehow led him to writing Ruby code, and hear a bit about what he is working on now! Stay tuned.

How did you get into Programming?
Charles talks about remembering some of his first programming exposure as far back as second grade. He talks about programming the iconic turtle to move around on the screen and draw shapes. Later on he had more experience in a particular Math class in high school, this time Pascal, then of course the TI-85.

Ins…

JRuby.org News 

JRuby 9.1.12.0 Released

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

JRuby 9000 is the newest major version of JRuby, representing years of effort and large-scale reboots of several JRuby subsystems. It is expected to be compatible with Ruby 2.x and stay in sync with C Ruby. JRuby 9.1.12.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…

BigBinary Blog 

Ruby 2.4 allows to customize suffix of the rotated log files

This blog is part of our Ruby 2.4 series.

In Ruby, The Logger class can be used for rotating log files daily, weekly or monthly.

daily_logger = Logger.new('foo.log', 'daily')

weekly_logger = Logger.new('foo.log', 'weekly')

monthly_logger = Logger.new('foo.log', 'monthly')

At the end of the specified period, Ruby will change the file extension of the log file as follows:

foo.log.20170615

The format of the suffix for the rotated log file is %Y%m%d. In Ruby 2.3, there was no way to customize this suffix format.

Ruby 2.4 added the ability to customize the suffix format by passing an extra argument shift_period_suffix.

# Ruby 2.4

logger = Logger.new('foo.log', 'weekly', shift_period_su…

Now, suffix of the rotated…

Ruby Weekly 

#353: Speed Up Rails Page Rendering with render_async

This week's Ruby and Rails news
Read this e-mail on the Web Ruby Weekly Issue 353 — June 15, 2017
Semaphore CI
render_async asynchronously calls controller actions from JavaScript and loads the HTML into the page on the fly.


Phil Nash
You can bring validations to plain old Ruby objects too with ActiveModel::Validations from Rails’ Active Model.


Noah Gibbs
In the US Ruby rides with Rails, but it’s different in Japan, which explains much of Ruby’s evolution.


Honeybadger Exception Monitoring  Sponsored
How well…
MIKAMAYHEM 

Technical Debt: Definition and Practical Approach

I know this post doesn’t invent anything new and you may have read about technical debt other hundred of times. This post is just another take on the Technical Debt matter, with the description of the practical approach we follow in Mikamai.

The process of software development is traditionally composed by three phases: development, testing, release. These phases can then be further detailed or splitted: the development phase may comprehend frequent deploys on an alpha environment which will contain incomplete features but will allow to receive feedback easily; testing might then happen on different environments, sequentially (i.e. the first one is an isolated environment with an empty data…

NRoweGT: Atlanta Ruby on Rails Consultancy 

How to Specify the Foreign Class for Rails Associations in a Different Namespace

Referencing Classes From Another Namespace

Say you’ve got the following classes:

class Foo < ApplicationRecord
end

class Foos::FooBarBazs::Baz < ApplicationRecord
    belongs_to :foo
end

Normally for Rails, we can pass a simple has_many :baz, but for models in a different namespace, you have to specify the class name, so it would look like this:

class Foo < ApplicationRecord
    has_many :baz, class_name: "Foos::FooBarBazs::Baz"
end

The above works great, and is what’s recommended in the official docs. However, it presents a problem when code is refactored and you don’t have sufficient code coverage. To remedy that, do the following:

  • enable eager loading for your test…
dry-rb news 

dry-transaction 0.10.0 brings class-based transactions and a whole new level of flexibility

We’re thrilled to announce the release of dry-transaction 0.10.0, which offers a huge improvement in ease-of-use and flexibility around designing your application’s business transactions.

dry-transaction has been around for long enough now that it’s really been put through its paces across many different apps and use cases. We’d begun to notice one big deficiency in its design: apart from defining the steps, we couldn’t customize any other aspect of transaction behavior.

This all changes with dry-transaction 0.10.0 and the introduction of class-based transactions. Instead of defining a transaction in a special DSL block, you can now define it within your own class:

class MyTransaction
  i…
Riding Rails 

Rails 5.0.4.rc1 has been released

Hi everyone,

I am happy to announce that Rails 5.0.4.rc1 has been released.

If no regressions are found, expect the final release on Monday, June 19, 2017. If you find one, please open an issue on GitHub and mention me (@rafaelfranca) on it, so that we can fix it before the final release.

CHANGES since 5.0.3

To view the changes for each gem, please read the changelogs on GitHub:

Full listing

To see the full list of changes, check out all the commits on GitHub.

SHA…

Appfolio Engineering 

How is Ruby Different in Japan?

I've had a few conversations recently where I say things like, "the Japanese Ruby community uses Ruby for different things than in America"... and I get blank stares. Specifically, I mention that America is very centered on Rails and web apps with Ruby. No surprise, right?

"But then," people ask, "if they're not using Ruby for Rails, what do they do with it?"

And why does anybody care? For the same reason I have these conversations. Because the American style of Rails usage lends itself to throwing huge amounts of memory and concurrency at your problems, and the Japanese style of Ruby usage does not. This normally comes up when they ask, "but why can't Ruby just use JIT?" JIT is complex and…

BigBinary Blog 

Ruby 2.4 added Hash#transform_values and its destructive version from Active Support

This blog is part of our Ruby 2.4 series.

It is a common use case to transform the values of a hash.

{ a: 1, b: 2, c: 3 } => { a: 2, b: 4, c: 6 }

{ a: "B", c: "D", e: "F" } => { a: "b", c: "d", e: "f" }

We can transform the values of a hash destructively (i.e. modify the original hash with new values) or non-destructively (i.e. return a new hash instead of modifying the original hash).

Prior to Ruby 2.4, we need to use following code to transform the values of a hash.

# Ruby 2.3 Non-destructive version

> hash = { a: 1, b: 2, c: 3 }
 #=> {:a=>1, :b=>2, :c=>3}

> hash.inject({}) { |h, (k, v)| h[k] = v * 2; h }
 #=> {:a=>2, :b=>4, :c=>6}

> hash
 #=> {:a=>1, :b=>2, :c=>3}

> hash = { a: 
JRuby.org News 

JRuby 9.1.11.0 Released

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

JRuby 9000 is the newest major version of JRuby, representing years of effort and large-scale reboots of several JRuby subsystems. It is expected to be compatible with Ruby 2.x and stay in sync with C Ruby. JRuby 9.1.11.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…

Schneems - Programming Practices, Performance, and Pedantry 

Meditations on Writing a Queue

What is a queue besides the line for the little teacups at Disney? In programming, a queue is a very useful data structure that can simplify our programs, especially when it comes to threading. In today’s post, I’m going to walk you through building a queue in C, talk about how to effectively use a queue, and also compare to the Queue implementation that ships with Ruby.

Red Panthers 

to_json vs as_json in Rails API

Recently we have been working on Rails API. During that time, we were curious about the difference between as_json and to_json. In this article, we are sharing the difference we learned.

to_json in Rails API

Let’s discuss how we started out building our APIs using ‘to_json’. to_json will return JSON string representing the hash. Option are passed to each element.

In to_json without any option,  the returned JSON string will include all the model attributes

user = User.find(1)
user.to_json

to_json had some great options of ActiveRecord objects. We could just tell the method to only render certain attributes, or to include association or method calls. We had:

  • only – Only show column names in…
AkitaOnRails.com 

Ex Manga Downloadr - Part 6: The Rise of FLOW

It's been way more than a year since I posted about my pet project Ex Manga Downloadr. Since then I just did small updates to keep up with the current Elixir and libraries versions.

As a quick recap, the exercise is that I want to web scrap from MangaReader.net, a bunch of images, organized in pages and chapters, and in the end it should compile organized PDFs so I can load them on a Kindle device.

Web scrapping, is a simple loop of HTTP GETs over a ton of URLs, scrapping the HTML, and fetching more URLs to download.

In many simple languages, people usually solve this naively in 2 ways:

  • A simple nested loop. One single thread, sequencial fetches. So if you have 5,000 links and each…
Riding Rails 

Rails 4.2.9.rc1 has been released!

Hi everyone,

I am happy to announce that Rails 4.2.9.rc1 has been released.

This is going to be the last bug fix release of the 4.2 series, so please test this release candidate.

If no regressions are found, expect the final release on Monday, June 19, 2017. If you find one, please open an issue on GitHub and mention me (@rafaelfranca) on it, so that we can fix it before the final release.

CHANGES since 4.2.8

To view the changes for each gem, please read the changelogs on GitHub:

Full…

Red Panthers 

Setup your rails application with one command

Generally setting up a rails app is running some same set of commands, for example installing gem, creating database, loading schema and start rails server.

bundle
bundle exec rails db:create
bundle exec rails s

We can create a script and run it to setup our application since Rails 4.2 a bin/setup file is generated by default.

Here is the example of setup script.

#!/usr/bin/env ruby
require 'pathname'
require 'fileutils'
include FileUtils

# path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)

def system!(*args)
  system(*args) || abort("\n== Command #{args} failed ==")
end

chdir APP_ROOT do
  # This script is a starting point to setup your…
Blog - Saturn Flyer 

7 ways to evaluate gems, and 1 crazy idea

I remember late nights browsing support forums ready for any answer to help. Writing a post, pleading for help, hitting refresh, and waiting for someone to reply was not efficient. But when that's all you know to do, it had to work.

Sleepless nights like those are much easier to avoid if you more carefully choose dependencies.

When I've got a problem to solve, I often look around to see if someone else has already solved it. I never want to waste my time reinventing the wheel.

Ruby has a healthy community. There are so many available gems it's not surprising to find your problem already solved. Dropping a gem into your project is easy. But if you don't understand the impact, you too…

The Miners - Medium 

From Rails to Hanami: Views

This is the third and last part of the “From Rails to Hanami” series and now we’re back to talk about Views. You can also check out the other parts about Models and Controllers.

If you are used to Rails, you may be thinking: what to say about Views? Isn’t it just the HTML files? And that’s where you are wrong! In Hanami, these files are called templates.

Templates

Templates are what you expect from a normal Rails view: an HTML ERB file with the contents to be rendered.

Taking off from our Controllers overview, the template for our “tasks index” action will live under apps/web/templates/tasks/index.html.erb, and its first version will look like this:

https://medium.com/media/5c6e5577be8b6af9b3cea…
All Ruby Podcasts by Devchat.tv 

RR 314 DynamoDB on Rails with Chandan Jhunjhunwal

RR 314 DynamoDB on Rails with Chandan Jhunjhunwal

Today's Ruby Rogues podcast features DynamoDB on Rails with Chandan Jhunjhunwal. DynamoDB is a NoSQL database that helps your team solve managing infrastructure issues like setup, costing and maintenance. Take some time to listen and know more about DynamoDB!

[00:02:18] – Introduction to Chandan Jhunjhunwal

Chanchan Jhunjhunwal is an owner of Faodail Technology, which is currently helping many startups for their web and mobile applications. They started from IBM, designing and building scalable mobile and web applications. He mainly worked on C++ and DB2 and later on, worked primarily on Ruby on Rails.

Questions for Chandan

[00:04:05] –…

BigBinary Blog 

Using prettier and rubocop in Ruby on Rails application to format JavaScript, CSS and Ruby files

Recently we started using prettier and rubocop to automatically format our code on git commit. Here is how we got started with setting up both prettier and rubocop in our Ruby on Rails applications.

Generate package.json

If you don’t already have a package.json file then execute the following command to create a package.json file with value {}.

echo "{}" > package.json

Install prettier

Now execute following command to install prettier.

npm install --save-dev lint-staged pre-commit prettier

Add scripts & ignore node_modules

Now open package.json and replace the whole file with following content.

{
  "scripts": {
    "precommit": "lint-staged"
  },
  "lint-staged": {
    "app/**/…
Black Bytes 

There Is No Magic in Ruby

You may have heard (or even said yourself) that Rails / Ruby has too much magic… …but where does that idea come from & what can you do to dispel that magic? When something feels like magic it’s because there is something you don’t know, there is some information missing. It’s just like actual magic […]

The post There Is No Magic in Ruby appeared first on Black Bytes. Don't miss your free gift here :)

Red Panthers 

Authorization with Pundit gem

Security is an important aspect of application development. Two main components of security are Authentication (Who are you?) and Authorization (are you supposed to be here?). Authentication verifies the user’s identity while authorization verifies whether that user has access rights on certain resources to perform actions on them.

Two popular gems for authorization in the rails world are CanCanCan and Pundit, we at Red Panthers prefers pundit over CanCanCan we get to write Pure Ruby Objects and keep the logic for each part separate.

The gem CanCanCan isolates (encourages) all authorization logic into a single class. It is a drawback when the complexity of application increases. Pundit gem…

Glenn Espinosa 

You Should Be Defaulting to Composition

Here’s the scenario:

Drifting Ruby Screencasts 

Geocoding, Places and Maps

Using the Geocoder gem and Google APIs, learn how to add some geolocation functionality to your application.
Schneems - Programming Practices, Performance, and Pedantry 

Bayes is BAE

Before programming, before formal probability there was Bayes. He introduced the notion that multiple uncertain estimates which are related could be combined to form a more certain estimate. It turns out that this extremely simple idea has a profound impact on how we write programs and how we can think about life. The applications range from machine learning and robotics to determining cancer treatments. In this talk we’ll take an in depth look at Bayes rule and how it can be applied to solve problems in programming and beyond.

Riding Rails 

This Week in Rails: default option for mattr_accessor, write_multi and more!

Hello everyone! Prathamesh here bringing you the latest news from the Rails world. Let’s get started 🚅

Featured

🎉 This Week’s Rails contributors! 🎉

We had 21 awesome people who helped make Rails better this week. Two of them contributed for the first time ever! Would you like to help as well? Head over to the 👉 issues list.

New

💪 mattr_accessor gets the default option 💪

Followup to adding the default option to the class_attribute macro, it is now added to mattr_accessor family of methods as well.

It can be used as follows:

mattr_accessor :always_write_cookie, default: false

💪 Write multiple cache entries at once with write_multi 💪

A new method write_multi has been added to the…

Michael Cordell's Blog 

Reading Ruby Code: ROM - DSLs

After a long hiatus, this is the fourth part of my on-going series on code reading, the beginning can be found here

The ability to easily define a domain-specific language (DSL) is one of Ruby’s powerful features. This gives us the readable syntax of RSpec test definitions:

RSpec.describe Order do
  it "sums the prices of its line items" do
    #...
  end
end

In terms of code reading, this introduces a new wrinkle. When a well-formed DSL is used, the defined language begins to blend in with the language’s own keywords. While the above is definitely ruby code, it lacks the usual module, class, and def structure we find in most other .rb files. In fact, my editor even has a plugin…

The Bike Shed 

113: Have You Considered Rust? (Matt Casper)

We talk to Matt Casper about contributing to Diesel, Rust's ecosystem, and the next big thing.

AkitaOnRails.com 

[Off-Topic] Talento é Altamente Supervalorizado: Humanizando Einstein e Matando Deuses

Uma coisa que eu vivo repetindo é: não tenha ídolos, não acredite cegamente em gurus e, principalmente, não siga falsos-Deuses.

Sou um antigo proponente em matar deuses, é praticamente um hobby. Eles dão excelentes personagens de ficção em histórias para dormir, mas obviamente não existem. Como o bicho-papão ou papai-noel ou o coelhinho da Páscoa. E não, este não é mais um artigo focado em anti-religião, calma.

Pelas mesmas razões, eu quero desmantelar o mito do "Talento" e trazer os semi-deuses de volta à humanidade.

Talento é Altamente Supervalorizado

Eu realmente detesto o uso da palavra "Talento". Ele deveria ser usado como um elogio, uma qualidade, mas é muito usado como uma…

Stories by DHH on Medium 

Celebrate the web by using another browser than Google’s Chrome

I like Chrome. It’s a great browser. But it’s not so good that it deserves to be the only browser. And that’s the unfortunate opportunity we, people browsing the web, are opening for Google by so overwhelmingly choosing to use it in face of the alternatives.

And this is what we get by doing so: DirecTV just announced that they’ll be turning their website into a Chrome desktop app on June 1st. They don’t actually say that, but that’s what they mean. You can’t call directvnow.com a website if it only works in a single browser.

You don’t have to be that old to remember the dark days when Internet Explorer strangled the web by its utter domination. When large swaths of the web was only accessible…

Ruby Weekly 

#352: Creating a Heroku-like Deployment Solution with Docker

This week's Ruby and Rails news
Read this e-mail on the Web Ruby Weekly Issue 352 — June 8, 2017
Pedro Cavalheiro
Using Docker and Ruby, learn how to build your own deployment solution similar to Heroku without the need to use any specific cloud provider.


Standard Gems
Ruby’s standard library is gradually being ‘gemified’ for the forthcoming Ruby 2.5. Read this to know how they will be organized.


AppSignal Blog
The last in a series on currency in Ruby looks at event loops using fibers to build a chat server.


Redisgreen  Sponsored
Greater Than Code 

Episode 036: Metaphors and Microservices with Matt Stine

Panelists:

Coraline Ada Ehmke | Sam Livingston-Gray | Rein Henrichs |
Astrid Countee | Jessica Kerr | Janelle Klein

Guest Starring:

Matt Stine: @mstine | mattstine.com

Show Notes:

00:16 – Welcome to “Chinchilla Chat: Where It’s All Chinchillas…All The Time…” …we mean, “Greater Than Code!”

Want to help make us a weekly show,
buy and ship you swag,
and bring us to conferences near you?
Support us via Patreon!

Or tell your organization to send sponsorship inquiries to mandy@greaterthancode.com.

03:10 – Matt’s Origin Story in Software Development

09:04 – The Business of Consulting

16:24 – Empathy in Consulting

20:07 – Rigorous Communication and Shared Language; Microservices

Ludwig…

Hi, we're Arkency 

Test critical paths in your app with ease thanks to Dependency Injection

Dependency Injection is one of my favorite programming patterns. In this short blogpost, I’ll present you how it helps testing potentially untestable code.

Imagine that your customer wants to easily identify orders in the e-commerce system which you are maintaining. They requested simple numeric identifier in a very specific 9-digit format which will make their life easier, especially when it comes to discussing order details with their client via the phone call. They want identifier starting with 100 and six random digits, e.g. 100123456.

Easy peasy you think, but you probably also know that the subset is limited to 999999 combinations and collisions may happen. You probably create a…

All Ruby Podcasts by Devchat.tv 

RR 313 Do I need a Front - End Framework?

How to Handle WTF's

Today's Ruby Rogues podcast features How to Handle WTF's. David, Brian, Jerome and Charles discuss front end frameworks. Tune in to learn more about when to use rails, and other frameworks!

How do you choose your Framework?

How do you want the app to behave, would be a good question to ask before you choose your framework. When you're mocking something up, it's paramount to think of the end product.

Who are you doing choosing your Framework for? Are you using it for you, for your peers, for your business? Tune in to hear what our panelists think!

Hey, this is cool. I want to share it.

A great way to communicate with folks in the community, is to not force newer…

Mike Perham 

Helping Others

I'm a big fan of helping and empowering others through my open source software contributions but I often get pings from people from around the world asking for help. These requests generally take two forms:

  1. "I'm having this problem with your software..."
  2. "I want help with my business idea..."

One thing I've learned over time is that talking to individuals privately does not scale. You have to arrange a date/time, determine a chat location/method, often to discuss a problem that can be solved in 3-5 minutes. Often business questions take an hour or more of due diligence, demand research into a particular vertical, etc. Here's the policies I've found work best for all parties.

Softwa…

Schneems - Programming Practices, Performance, and Pedantry 

The Programmer's Guide to Pairing on Pregnancy

You don’t have to be physically carrying a child to be involved in a pregnancy. If you pair program, you know that you don’t have to have your hands physically on the keyboard to contribute to the experience. I’m currently on track for my second little one and wanted to give a shout out to some things I’ve seen that partners of all genders have done to help with pregnancies. While I cannot physically carry my child to term, that doesn’t mean pregnancy is a passive event for me. Let’s get started.

Hi, we're Arkency 

Acceptance testing using actors/personas

Today I’ve been working on chillout.io (new landing page coming soon). Our solution for sending Rails applications’ metrics and building dashboards. All of that so you can chill out and know that your app is working.

We have one, almost full-stack, acceptance test which spawns a Rails app, a thread listening to HTTP requests and which checks that the metrics are received by chillout.io when an Active Record object was created. It has some interesting points so let’s have a look.

Higher level abstraction

require 'test_helper'

class ClientSendsMetricsTest < AcceptanceTestCase
  def test_client_sends_metrics
    test_app      = TestApp.new
    test_endpoint = TestEndpoint.new
    test_user
OmbuLabs Blog 

Announcing FastRuby.io

Today we are happy to announce the launch of our first productized service: fastruby.io - Speedy Ruby on Rails Upgrades by Ombu Labs.

We are quite familiar with this sort of projects and decided to package it under its own domain. We have been doing Ruby on Rails upgrades since 2009, for our own products and client projects, and we are looking forward to shipping more of them.

If you have been using Rails for a while, you know that big version jumps are hard. If you have a big Rails monolith with 100+ dependencies, you know that upgrading Rails is not a trivial project.

You know you need to keep your Rails app up to date, but it's usually not a priority. So you postpone upgrading until…

Semaphore CI Community Tutorials on Ruby 

Creating a Heroku-like Deployment Solution with Docker

This article is brought with ❤ to you by Semaphore.

Introduction

This tutorial will show you how to create an automation tool for deploying your software in a simple way, similar to deploying to Heroku. We'll be using Docker to version control each deploy, which makes upgrades and rollbacks fairly easy. Also, we'll use Semaphore to continuously deploy our application.

Our containers can be hosted on any Docker Registry, and only a host with Docker installed is needed to run the application.

At the end of this tutorial you'll have a simple Ruby cli script, capable of deploying a sample application to a remote host, similar to Heroku’s. It will also have other commands for rolling back to…

GoRails Screencasts 

Global Autocomplete Search

See how to add global autocomplete and search functionality to your app's navbar
Search Results for “ruby” – via @codeship 

Using Codeship for Ruby Application Deployments

Reading Time: 10 minutes

In the first part of this series, I walked through developing a simple todo API using Ruby on Rails and PostgreSQL using Docker Compose. In this post, I will cover creating a CI/CD pipeline using Codeship Pro.


“Creating a CI/CD pipeline using Codeship Pro” via @kellyjandrews
Click To Tweet


Requirements for This Tutorial

This tutorial requires you to have a few items before you can get started:

In our example, we are deploying our code directly into Heroku without Docker. While we will be using Docker locally and in CI/CD, Codeship Pro allows us to deploy Docker apps to production even when…

MIKAMAYHEM 

Devise Facebook Omniauth login with connect and disconnect functionality

When talking about users authentication in Rails land there is one name that generally stands above all the other available gems. This name is Devise.

I would not be so wrong to call it the de facto standard of Rails authentication considering the time has been around and the vast documentation it has under its belt.

Regarding for example the OAuth2 functionality there is a well documented page inside the wiki that describes how to implement it for Facebook.

Unfortunately what presented inside the documentation doesn’t always blend well with the other functionalities of an application.

In Devise documentation however there is a fundamental part regarding the implementation of the facebook …

Ruby Magic by AppSignal 

Concurrency Deep Dive: Event loops

Welcome to the last Ruby Magic article in our series about concurrency. In the previous editions we implemented a chat server using multiple processes and multiple threads. This time we’re going to do the same thing using an event loop.

Recap

We’re going to use the same client and the same server setup we used in the earlier articles. Our aim is to build a chat system that looks like this:

Chat example

Please see the previous articles for more details on the basic setup. The full source code that is used in the examples in this article is available on GitHub, so you can experiment with it yourself.

Chat server using an event loop

Using an event loop for our chat server requires you to have a…

Mike Perham 

Tracking down performance bugs in Sidekiq jobs

The Problem

A Sidekiq Enterprise customer recently emailed me to ask for help.

I'm having trouble trying to figure out why one particular worker I have takes so long per job. Some of the jobs are taking 30 minutes. What the program does is load a spreadsheet to the database. When I run "top", it looks like this. What should my next step be?

top output

The Explanation

Great question. The top screenshot tells me a few things:

  1. Each process is using ~4GB of RAM, which is a lot, but top also notes the machine has ~64GB of memory so it's not necessarily unusual.
  2. There are four Ruby 2.1 processes (which I assume are Sidekiq processes), each pegging a core at 100%. We want to track down what is…

There's a two step process to get more info:

  1. Visit the Busy page in the Web UI and see which jobs are…
Drifting Ruby Screencasts 

Autocomplete with HTML Results

Working with an autocomplete can be very simple. However, things get complicated when you try to use HTML markup in the displayed results. Learn how to use HTML markup within your autocomplete results!
Giles Bowkett 

Reddit Users Are A Subset Of Reddit Users

An interesting blog post on view counting at Reddit reminded me of an old post I wrote almost ten years ago. Reddit engineer Krishnan Chandra wrote:

Reddit has many visitors that consume content without voting or commenting. We wanted to build a system that could capture this activity by counting the number of views a post received.

He goes on to describe the scaling and accuracy problems in this apparently simple goal. But he never addresses a few really weird assumptions the Reddit team appears to have made: that every Reddit user is logged in, or even has an account in the first place; that every Reddit user has only one account; and that every account is only ever used by one person.

As I…
Riding Rails 

This Week in Rails: class_attribute default, mini_racer and more!

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

Featured

This Week’s Rails contributors!

We had 32 people who helped make Rails better this week. Three of them contributed for the first time ever! If you would like to help out, check the issues list.

Allow a default value to be declared for class_attribute

Rails will now make it easier to set default values to class attributes like class_attribute :timeout, default: 5

Replace therubyracer with mini_racer

New apps generated with JavaScript and Sprockets support will use mini_racer for the Ruby platform. A faster and more reliable interpreter.

New

Add previous and next day of week API to Active Support

Stories by DHH on Medium 

You are going to die, isn’t it wonderful?

This might sound morbid, but I think about death all the time. Not with dread or romanticism, but with purpose. This is all going to end some day, and I’m glad that it will.

Don’t worry. It’s not like I’m suicidal. No need to send me the number of any hotlines. It’s rather that I accept, nay, embrace the arc of life with gusto.

Knowing that I will die is an immense source of both strength and relief. Strength to stick with a set of convictions that seem worthy of my brief role in history. Relief that I won’t be condemned to be pushing them forever.

Life is long if you know how to use it, as Seneca said.

Like 40 hours per week is more than plenty to do great work, 10 years is more than plenty to…

Hi, we're Arkency 

Testing cookies in Rails

Recently at Arkency I was working on a task, on which it was very important to ensure that the right cookies are saved with the specific expiration time. Obiovusly I wanted to test this code to prevent regressions in the future.

Controller tests?

Firstly I thought about controller tests, but you can use only one controller in one test (at least without strong hacks) and in this case it was important to check values of cookies after requests sent into few different controllers. You can now think, that controller tests are “good enough” for you, if you don’t need to reach to different controllers. Not quite, unfortunately. Let’s consider following code:

class ApplicationController
  be…
RubyLetter 

Time Off

We’re going to be taking some time off from the Rubyletter newsletter and podcast.

More and more we find ourselves in a catch-22. Producing Rubyletter takes time. So does promoting it. Since this is a side project, we don’t really have time to do both. So we find ourselves either rushing to put out content that isn’t very special, or creating really nice content that only a few hundred people will ever see. That’s not a very fun game to play.

We’re going to keep publishing occasional blog posts on the site and perhaps send out a newsletter when inspiration strikes. But it won’t be weekly.

AkitaOnRails.com 

Participando em Podcasts

Este ano, por total coincidência, tive a oportunidade de participar de 3 canais de podcast. Quero deixar meus agradecimentos ao Paulo Silveira, Charles Max Wood, Lucas Caton, Fellipe Azambuja e Ramon Sanches.

O primeiro na verdade saiu no fim do ano passado, em Novembro, pelo Ruby Rogues com o tema "Ruby Conf Brazil and Building Communities" (em inglês) onde o Charles Wood e eu discutimos um pouco sobre a história da comunidade Ruby no Brasil, como eu tentei começar, o que tentei fazer, blog, palestras, eventos. Além de pontos mais específicos como um pequeno panorama da linguagem Ruby e meu conceito sobre não se limitar a somente uma linguagem ou tecnologia. Se você é novo na comunidade…

Blog - Sandi Metz 

The Half-Life of Code

This post originally appeared in my Chainline Newsletter.


I've been thinking about the half-life of code.

In his Software that Fits in Your Head talk, Dan North defines the half-life of software as (I'm paraphrasing) "the amount of time required for half of an application's code to change so much that it becomes unrecognizable."

In that talk he tells the story of working on a high quality, non-trivial application whose code's half-life was six weeks.

Yup. Six. Weeks.

I saw that talk nearly a year ago and have been distracted by its implications ever since.

The upsides of a short code half-life are significant. Imagine how much better your life would be if your application's code always…

AkitaOnRails.com 

Conference Talks, Interviews, and the Pen!

"Sell me this pen!"

Sell me this Pen

This is a very old tricky question used in interviews. And if you at least watched Scorcese's magnificent "Wolf of Wall Street", you will remember this phrase.

But how many of you actually thought through this tricky question?

Introduction

There are many number of ways you can try to sell me the pen. You can tell me about the tradition of its manufacturer brand. You can tell me about its outstanding smoothness. You can try to persuade me on the availability of different colors and sizes. You can even steer away from the pen and start bragging about how many hundreds of pens you sold already, your tour de force.

I will argue that you can do all of those, but you…

Glauco Custódio 

Windows Automation with AutoIt

I know, this post is a bit odd comparing to what I am used to write.

You (developer) are doing your job, when your boss turn to you and say:

- "Hey, let's make a robot to automate the payment routine?!".

- "Ok, what do you need?"

- "It needs to access the bank website, sign in and schedule some payment transactions".

- "Ok, let me try"

Some could think in making use of Selenium to pull it off, but here are some caveats:

  • The financial pc runs Windows (the one used to run the robot)
  • The bank website uses a Java applet and requires a USB token to sign in

Selenium didn't seem to be the best option for me.

The solution

I was fortunate enough to remember I was told about AutoIt

Ruby Weekly 

#351: Using React Inside Your Rails Apps

This week's Ruby and Rails news
Read this e-mail on the Web Ruby Weekly Issue 351 — June 1, 2017
Alex Castaño
Even though splats (and double splats) in Ruby are common, there are some complex edge cases that can be misleading.


Leigh Halliday and Marian Serna
An exploration of different ways to bring React into your new or existing Rails apps.


Nate Berkopec
A high-level summary of various performance talks and panels from RailsConf 2017 and their practical impact.


reinteractive  Sponsored
24/7 monitoring &…
Hi, we're Arkency 

Handling SVG images with Refile and Imgix

My colleague Tomek today was responsible for changing a bit how we handle file uploads in a project so that it can support SVG logos.

For handling uploads this Rails app uses Refile library. And for serving images there is Imgix which helps you save bandwith and apply transformations (using Imgix servers instead of yours).

The normal approach didn’t work because it did not recognize SVGs as images.

attachment :logo, type: :image

So instead we had to list supported content types manually.

attachment :logo, 
  content_type: %w(image/jpeg image/png image/gif image/svg+xml)

There is also a bit of logic involved in building proper URL for the browser.

= link_to image_tag(imgix_url("/sho…
All Ruby Podcasts by Devchat.tv 

MRS 006 My Ruby Story Jamis Buck

Today's episode features the Ruby Story of Jamis Buck. James guested on episode 268, where he talked about Mazes for Programmers. For 9 years, he worked at 37Signals as Software Developer. How did he get into programming, and what is he currently up to? Tune in!

The Bike Shed 

112: Lifecycles Are Dead, Long Live Lifecycles!

Amanda joins Sean to discuss all the Android news to come out of Google I/O, Kotlin as a "first class language", and features of Android "O"!

Greater Than Code 

Episode 035: Behind the Scenes at npm with Laurie Voss

Panelists:

Coraline Ada Ehmke | Sam Livingston-Gray | Rein Henrichs | Astrid Countee

Guest Starring:

Laurie Voss: @seldo | seldo.com

Show Notes:

00:16 – Welcome to “Yes, SJWs Do Actually Code” …we mean, “Greater Than Code!”

01:22 – Superpower Origin Story

06:00 – “Real Programming”

08:45 – Being Gay in the Tech Industry; Micro Activism

16:17 – Setting Workplace Culture

21:20 – Working in Open Source While Working in a Company like npm

25:50 – Monetizing npm

npm Enterprise

32:55 – npm@5

Support us via Patreon!
Get instant access to our Slack Channel!
Thank you to Linnea Kylén Rönnqvist!

Thank you to Jacob Stoebel for submitting our first guest blog post, “Honesty, Kindness and Inspiration:…

Submit your own guest blog post to mandy@greaterthancode.…

42:00 – The 10x Engineer

44:19

The Miners - Medium 

NPM@5 arrived. But is it as fast as Yarn?

NPM@5 Arrived. But is it as Fast as Yarn?

Earlier this month, I posted about how yarn is much faster than npm, but today NPM itself posted on Medium about npm@5 and how fast it has become. I fell like I needed to add it to my former comparison, so here it goes.

New Lockfile

Shrinkwrap is (finally) deprecated. Now NPM creates/uses a package-lock.json (much better name :D) that is always created/updated much like the way Yarn does.

That means all installations, for all devs on a team, will look the same.

Speed improvements

NPM says all package metadata and cache have been reworked to make it from 20% to 100% faster. Cache is also self-healing to prevent corruption.

So let’s update our later…

Search Results for “ruby” – via @codeship 

Using React Inside Your Rails Apps

Reading Time: 10 minutes

I have never felt as productive as I do in Rails. Yet, with front-end seemingly moving further away from server-rendered views toward React, Angular, Vue, and Ember, I was unsure where Rails fit into this picture. Would it be relegated only to apps with “simple” front-ends, where holding things together with jQuery still managed to work, or perhaps to its new API mode, serving up data via RESTful JSON feeds to be consumed by client-side code and mobile apps?

The answer to that question may be yes, because Rails still does an amazing job at that. But perhaps the answer lies more in the realm of “maybe…it depends”. Would it be better to bring the best of the front-end…

Test Double | Our Thinking 

Going to Eleven

Your mission

100,000 simultaneous users. 38 days. 9 systems. One launch. Ready?

Are you sure you want to do this?

  • What is it like to go from zero users to all the users in one day? How do you prepare for that?
  • Have you ever dealt with perfomance problems in systems you don't control?
  • Have you ever negotiated a large-scale test with an external partner?
  • Have you built an AWS architecture with the biggest possible pieces?
  • Have you ever DDoSed your own site?
  • Have you ever lost sleep because your application won't horizontally scale?

Can't back out now

This is the story of a real-life product "land rush". It starts with designing a load test, picking tools, and isolating a slew of…

Stories by DHH on Medium 

First of all, I’m not interested in “crushing” anything.

First of all, I’m not interested in “crushing” anything. Not crushing the competition, not crushing my life. So I reject the entire premise.

Yet Basecamp is more popular than it’s ever been in the history of the product! We have more customers than we’ve ever had. More usage. More everything. AND IT’S PLENTY! I don’t desire anything more, what we have, the sustainable pace of which we’re growing is beyond bountiful.

I’ve made more money running Basecamp as a profitable business than I would ever need. There are no financial milestones left for me to clear to be happy (not that there ever really were).

What does make me happy, though, is to continue working on a wonderful business with 50-some…

Test Double | Our Thinking 

Under Pressure.

The video above was recorded at Agile and Beyond 2017 earlier this month.

It’s an accepted truth in software development; when deadlines loom the team will be pressured to GO FASTER. Unable to convince management of the risks, we resign to cutting corners and working longer hours. Unfortunately the result is just as predictable, a short spike in velocity and many delays to come.

This talk is an exploration of how to reverse the velocity spiral by building high trust relationships with management. We'll discuss root causes of our distrust like estimation, communication, and abuse of power so that the team can resist short sighted solutions that will plague them for years to come.

BigBinary Blog 

Rails 5.1 adds delegate_missing_to

This blog is part of our Rails 5.1 series.

When we use method_missing then we should also use respond_to_missing?. Because of this code becomes verbose since both method_missing and respond_to_missing? need to move in tandem.

DHH in the issue itself provided a good example of this verbosity.

class Partition
  def initialize(first_event)
    @events = [ first_event ]
  end

  def people
    if @events.first.detail.people.any?
      @events.collect { |e| Array(e.detail.people) }.flatten.uniq
    else
      @events.collect(&:creator).uniq
    end
  end

  private
    def respond_to_missing?(name, include_private = false)
      @events.respond_to?(name, include_private)
    end

    def meth…

He proposed to use a new method delegate_missing_to. Here is how it can be used.

class Partition
  delegate_missing_to :@events

  def initialize(first_event)
    @events = [ first_event ]
  end

  def people
Tech Tips and Freebies – Rubyroid Labs Blog 

INTERVIEW: Aaron Patterson, Rack, Github and BBQ

Reading Time: 13 minutes

Aaron Patterson is one of the most respected and appreciated developers in Ruby world. Member of Ruby and Ruby on Rails core Team he is known for his great professional skills and even greater personality. Our CEO Valentine Zavadskiy and Dmitry Zhlobo from Datarockets have met with Aaron at Ruby Conf to ask him all sorts of questions from future of Ruby to his favorite barbecue recipe.

– Aaron, you are currently working at Github. Could you please tell us what you do in Github with your experience and background.

– Sure. I work for Github and pretty much my recent project has been working on Ruby’s garbage collector. I’m on a System Platform Team and we do…

Stories by DHH on Medium 

I don’t think you have to cold-turkey it.

I don’t think you have to cold-turkey it. You can start by carving out sacred zones. Like, hey, I’m going to stop working on the weekends. And then put yourself in situations where that’s just not an option. Whether that’s an outdoor hobby or other obligations away from work.

Also, taking the longest vacation you possibly can (preferably 3+ weeks) is going to give you an entirely new perspective.

Finally, knowing and internalizing that you are going to die always helps :). Stoic philosophy is a great path through that realization and its consequences.

All the best!

Kevin Menard’s Weblog 

A Systematic Approach to Improving TruffleRuby Performance

Summary

We care a lot about performance in the TruffleRuby project. We run a set of benchmarks on every push in a variety of VM configurations and use those as proxies for system-wide issues. The problem with benchmarks, however, is unless you’re intimately familiar with the benchmark it’s hard to tell what your reported values should be. Looking at a graph, it’s easy to see if you’ve regressed or improved. It’s easy to see how you compare to other implementations. But it’s not terribly useful once you’ve leveled off. We really need another way to analyze performance.

This is a bit of a lengthy post that introduces some of the tools available to Truffle language developers for performance…

Schneems - Programming Practices, Performance, and Pedantry 

Writers Write

I’ve been writing more recently. One of the biggest reasons is that I’ve been writing more recently. Writing begets writing; the more I do it, the easier it is to do it more. I’ve found diet to be similar. When I’m eating fresh fruits and veggies, it’s what my body craves. But as soon as I “treat” myself with a bag of chips or a fatty big honking slice of greasy pizza, guess what my body wants? More of the same.

Stories by DHH on Medium 

Thank you. I started writing in English as a teenager. Game reviews and news!

Thank you. I started writing in English as a teenager. Game reviews and news!

I don’t spend that much time writing for public consumption, though. Maybe an hour or two per week, tops? I do spend lots of time writing in Basecamp and on pull requests, though!

Stories by DHH on Medium 

When we started Basecamp, we worked LESS than what we work now.

When we started Basecamp, we worked LESS than what we work now. Basecamp was a 3rd client for 37signals, the consulting business, and my side-gig while in school. As the sole programmer on the project, I was working 10 hours/week on Basecamp. So we built habits of getting a lot out of a little right from the get go. When we then started working full-time on Basecamp, the 40 hours per week seemed like an abundance.

Blog - Saturn Flyer 

Why write code when more dependencies will do?

What do you do when you need your code to work in different environments?

New versions of Ruby or important gems are released and we begin to consider how to switch between them. If your code needs to work in old as well as current versions of Ruby, how do you approach it? Or how do you handle changes in Rails for that matter?

Surely, there's a gem out there that would solve your problem for you...

Balancing the need for new features

A few years ago I was working on a project and was looking for a way to make Casting work in versions of Ruby 1.9 and 2.0. I had to write code that would determine what could be done and ensure it would behave.

When Ruby 2.0 was released, it allowed methods…

Stories by DHH on Medium 

Trickle-down workaholism in startups

“And then I said anyone not willing to break their backs working for me was a tourist!”

If you want to understand why so many startups become infected with unhealthy work habits, or outright workaholism, a good place to start your examination is in the attitudes of their venture capital investors.

Consider this Twitter thread involving two famous VCs, Keith Rabois and Mark Suster:

These sentiments are hardly aberrations. There’s an ingrained mythology around startups that not only celebrates burn-out efforts, but damn well requires it. It’s the logical outcome of trying to compress a lifetime’s worth of work into the abbreviated timeline of a venture fund.

It’s not hard to understand why such a…

Drifting Ruby Screencasts 

DataTables

The DataTables Javascript library creates a powerful display of your application's data. Some of the features include pagination, server side processing, sorting and search.
Riding Rails 

This Week in Rails: ActiveSupport::CurrentAttributes, AEAD and more!

Hi there!

This is Vipul bringing you all the latest news about Rails from the hopefully ending summer here in Pune🔥

Featured

This Week’s Rails contributors!

We had 36 people who helped make Rails better this week.
Six of them contributed for the first time ever!
If you would like to help out, check the issues list.

New

ActiveSupport::CurrentAttributes provides a thread-isolated attributes singleton

If you’ve used current_user from Devise, you’ve already come across what CurrentAttributes partly provides, but wait there’s more!

Using CurrentAttributes you can start using per request variables that are accessible across the whole system like Models, Controllers, Views, during a…

Confreaks.tv - RailsConf 2017 Videos 

RailsConf 2017 - Data Corruption: Stop the Evil Tribbles

Bad data breeds like Tribbles. Coddle even one bit of it, and your entire database will fill up with junk. And it's got so many causes! Weird user input. Data races under load. Changing business needs. We can't fully prevent data corruption, so how can we recover from it? In this talk, you'll learn how to fix bad data at every level of your system. You'll learn UX techniques for incremental, mistake-reducing input. You'll get a rubric for validation design that accomodates new features. And you'll learn auditing techniques to catch bad data early, before your database fills up with evil Tribbles.
Confreaks.tv - RailsConf 2017 Videos 

RailsConf 2017 - Cultivating a Culture of Continuous Learning

Tuft & Needle is a bootstrapped, Phoenix-based company that pioneered the disruption of a the mattress industry using a software startup’s mindset when it was founded in 2012 and has grown to over $100 million in annual revenue. A commitment to skill acquisition has led to a happier and more productive team, and is a core to the company’s success. In this session, learn how to cultivate a culture of continuous learning and skill acquisition through apprenticeships and group learning sessions.
Confreaks.tv - RailsConf 2017 Videos 

RailsConf 2017 - ​Postgres at Any Scale​

Postgres has powerful datatypes and a general emphasis on correctness which makes it a great choice for apps small and medium. Growing to very large sizes has been challenging—until now! First you'll learn how to take advantage of all PG has to offer for small scales, especially when it comes to keeping data consistent. Next you'll learn techniques for keeping apps running well at medium scales. And finally you'll learn how to take advantage of the open-source Citus extension that makes PG a distributed db, when your app joins the big leagues.
Confreaks.tv - RailsConf 2017 Videos 

RailsConf 2017 - Google Cloud <3 Ruby

Ruby developers welcome! Our dedicated Google Cloud Platform Ruby team has built a great experience for Ruby developers using GCP. In this session, we'll walk through the steps to deploy, debug and scale a Ruby on Rails application on Google App Engine. You'll also learn about some of the exciting Ruby libraries available today for adding features to your app with GCP services like BigQuery and Cloud Vision API.