Rubyland

news, opinion, tutorials, about ruby, aggregated
Sources About
Scout ~ The Blog 

Deploying to AWS Part V: the final punch list (load balancer, CDN, SSL)

Looking for a fresh, 2018 approach to deploying a Rails app to AWS? We've partnered with DailyDrip on a series of videos to guide you through the process. We're covering how to Dockerize a Rails app, AWS Fargate, logging, monitoring, setting up load balancing, SSL, CDN, and more.

In our previous videos, we dockerized our Rails app, setup an ECS container, deployed to AWS Fargate, configured logging, and monitored our app's performance. However, we still have a few remaining items.

What's left in our AWS production deployment punch list? Configuring a load balancer, SSL, and a CDN. We're using containers, which gives us a great way to scale, but have left out some pretty important pieces…

The Bike Shed 

139: Red, Green, Refactor (Alex Clark & Sean Doyle)

Derek is Joined by coworker Sean Doyle and Codecademy’s Alex Clark to discuss the process of test-driven development and the development of a new TDD course for Codecademy.

Valentino G. | Blog 

Webpack 4 tutorial: All You Need to Know, from 0 Conf to Production Mode

The webpack team is working hard on the next generation of the popular module bundler: webpack 4.

webpack 4 logo

The following post is a living, breathing introduction to webpack 4. I’ll update it as soon as new info will come in.

webpack 4 as a zero configuration module bundler

webpack is powerful and has a lot of unique features but one of its pain point is the configuration file.

Providing a configuration for webpack is not a big deal in medium to bigger projects. You can’t live without one. Yet, for smaller ones it’s kind of annoying, especially when you want to kickstart some toy app.

That’s why Parcel gained a lot of traction.

Sean and the webpack team are going to change that: webpack 4 doesn’t…

Engine Yard Blog 

Using Ruby 2.5.0 with Docker

Ruby 2.5.0 was released last Christmas and it's available through the usual places -- rvm , rbenv , chruby , homebrew. One tool I like to use is Docker.

All Ruby Podcasts by Devchat.tv 

RR 345: App Failure Emergencies and Holidays

Panel:

Charles Max Wood

Dave Kimura

David Richards

Special Guest: 

Amit Choudary

In this episode, the Ruby Rogues speaks with Amit Choudary, Amit is based in India as a Ruby and Ruby on Rails, Javascript, and Fullstack Developer. Amit is working with a company called Big Binary.  Big Binary builds web apps and a variety of mobile applications.  Amit mentions his informative blog on Ruby 2.5 at blog at Big Binary.

Amit and the panel discuss app failure emergencies and holidays. Importantly this episode is about how holidays affect the schedules, staff, and emergency deploying apps or repairing crashes and servers. This is a great episode to learn about strategies to recover from…

rossta.net 

Animating Connect Four with Vue.js

When we left off our Connect Four game last, we used Vue.js components to convert a static HTML view of the Connect Four board into a playable interface. In this post, we'll animate the checkers falling and bouncing into place when added to the game board.

Here's how the game behaved at the end of the previous post:

See the Pen Connect Four Vue.js, SVG: first pass by Ross Kaffenberger (@rossta) on CodePen.


Clicking columns simply adds new checkers to the board in the first available slots. Though it works, it doesn't quite feel like Connect Four; we want checkers falling to the bottom of each column.

Vue transitions

Vue.js…

Awesome Ruby Newsletter 

Issue 88 - Things I wish ActiveRecord had after using Ecto

rossta.net 

Animating Connect Four checkers with Vue.js

When we left off our Connect Four game last, we used Vue.js components to convert a static HTML view of the Connect Four board into a playable interface. In this post, we'll animate the checkers falling and bouncing into place when added to the game board.

Here's how the game behaved at the end of the previous post:

See the Pen Connect Four Vue.js, SVG: first pass by Ross Kaffenberger (@rossta) on CodePen.


Clicking columns simply adds new checkers to the board in the first available slots. Though it works, it doesn't quite feel like Connect Four; we want checkers falling to the bottom of each column.

Vue.js can help us here. It provides a number of features to support transitions,…

ruby – Bibliographic Wilderness 

attachment filename downloads in non-ascii encodings, ruby, s3

You tell the browser to force a download, and pick a filename for the browser to ‘save as’ with a Content-Disposition header that looks something like this:

Content-Disposition: attachment; filename="filename.tiff"

Depending on the browser, it might open up a ‘Save As’ dialog with that being the default, or might just go ahead and save to your filesystem with that name (Chrome, I think).

If you’re having the user download from S3, you can deliver an S3 pre-signed URL that specifies this header — it can be a different filename than the actual S3 key, and even different for different users, for each pre-signed URL generated.

What if the filename you want is not strictly ascii? You might just…

Pat Shaughnessy 

Learning Rust: If Let vs. Match


Human languages have similar words with different
shades of meaning. Some computer languages do too.
(from: Wikimedia Commons)

This year I’ve decided to try to learn Rust. I’m fascinated by its ownership model for memory management; I’m curious what the claims about safety are all about; and, I love how it incorporates ideas from the functional programming world. But I haven’t gotten to all of that yet – I’m just getting started learning the basic syntax.

Learning a computer language is just like learning a human language. You have to try to read and write it everyday, even if just for a few minutes. You need to get to know some native speakers. And there’s no way around it:…

Ruby Weekly 

#382: Upgrading a Rails App Incrementally

Ruby Weekly Issue 382 — January 18, 2018
Jesus Castello
A few gems to use to track allocations along with their impact on common programming scenarios. When are objects allocated, and why?


Scout Blog
How to add distributed tracing to your Sinatra webapps with OpenTracing, a vendor-neutral tracing API, and Jaeger, a distributed tracing system.


Luke Francl
It’s unlikely that you’ll be able to catch all upgrade issues outside of production, so a procedure like this is a great way to go.


Linode Cloud Hosting  Sponsored
Semaphore Engineering Blog 

Dec 12-17 Network Incident Report

From Tuesday, December 12 until Sunday, December 17, the Semaphore build cluster suffered from sporadic network instabilities due to a faulty device at a Tier 1 network provider. We know how much you rely on Semaphore, and our top priority is to provide a reliable service. To the customers that were affected: we are deeply sorry for the instabilities that you were facing during these days. In this post, we will share what were the technical details and challenges that we faced, the steps we took to resolve the issues, and what we plan to do to prevent similar issues from happening in the future.

Events

Day 1 – Tuesday, December 12, 2017

The first report of network instabilities arrived at…

Depfu 

The whole picture

We’ve heard from several users that once you start using Depfu, you trust us fully with keeping you up-to-date. Which is great and exactly what we want!

But it also made us a little bit uncomfortable about the amount of insight we give you into the state of your dependencies.

So today we’re launching a new dashboard that shows you a detailed overview of your dependencies and their status in Depfu.

Depfu vs bundle outdated

If you ever ran bundle outdated after using Depfu for a while, you’ll notice that there are still a few gems listed as outdated, even if you’ve merged all Depfu pull requests. Why is that?

There are two categories of updates that Depfu is missing out on:

  • Bundler…
All talk but no code... 

Pundit and controller based authorization

If we have an Order class, pundit gem will figure out to use the OrderPolicy for authorization. But what if we have multiple domains using the same item?

For example an online auction site, there will be a Seller::OrdersController and a Buyer::OrdersController. They will manage the two sides of the same order. The idea is that, buyer should be allowed to only update via Buyer::OrdersController but not Seller::OrdersController. And vice versa for seller. Obviously we would want to have two sets of policies.

However in Pundit namespaced policy require us to call authorze [:seller, item], in order for it to use the Seller::ItemPolicy. This can become repetitive.

For me, there is less room…

Sam Saffron 

Debugging 100% CPU usage in production Ruby on Rails systems

How do you go about debugging high CPU usage in a production Rails system?


Today I noticed one of our customer containers was running really high on CPU.

# top -bn1 

190 discour+  20   0 2266292 205128  15656 S  86.7  0.3   9377:35 ruby

# ps aux

discour+   190 19.4  0.3 2266292 207096 ?      Sl    2017 9364:38 sidekiq 5.0.5 discourse [1 of 5 busy]

Looks like sidekiq is stuck on a job.

Where is it stuck?

Usually, this is where the story ends and another series of questions start

  • Can we reproduce this on staging or development?

  • What code changed recently?

  • Why is perf trace not giving me anything I can work with?

  • How awesome is my Sidekiq logging?

  • Where is my divining rod?

Jul…

Notes to self 

Do not run Rails with pending migrations

Database migrations are the tricky part of any deployment. They make zero-time deploys problematic. They requires special attention since they can break stuff. Some might choose to run migrations automatically, some of us run them manually. But one thing is almost always true; the production code without migrations should not ever run. So how not to run your code without doing migrations first?

In the project I am working on we have our production processes defined in a file called Procfile. It can look like this:

web: bundle exec puma -C config/puma.rb
worker: bundle exec sidekiq -C ./config/sidekiq.yml
...

So we have a standard Puma process serving the requests and one Sidekiq worker…

Scout ~ The Blog 

Tutorial: Distributed Tracing in Ruby with OpenTracing

ruby-opentracing

It's a lot harder connecting the dots of the request lifecycle when the final response is built from a number of separate microservices.

However, distributed tracing - which connects a transaction trace across microservices - is getting a lot easier. In this short tutorial, I'll show how to add distributed tracing to your Sinatra web apps via OpenTracing, a vendor-neutral tracing API, and Jaeger, an opensource distributed tracing system.

OpenTracing, a vendor-neutral tracing API

Enter OpenTracing, a vendor-neutral open standard for distributed tracing. OpenTracing loosens the chains on tracing instrumentation: if we trace our method calls via OpenTracing APIs, we can swap out our…

Greater Than Code 

063: The Distribution of Brilliance and Opportunity with Rehema Wachira

Panelists:

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

Guest Starring:

Rehema Wachira: @remy_stack | Andela

Join Our Slack Channel!
Support us via Patreon!

Are you Greater Than Code?
Submit guest blog posts to mandy@greaterthancode.com

Show Notes:

01:22 – Rehema’s Superpower: Empathy

02:53 – Rehema’s “Untypical” Origin Story

07:20 – Enjoying Coding Because of the Complexity Behind It

11:21 – Creating a “Culture of Saving”

14:52 – “Diversity of Thought” and Seeing the World Through Others’ Eyes

22:20 – Being Creators and Makers

Indie Hackers

30:28 – How Technology Empowers People

38:27 – The Distribution of Brilliance and Opportunity

47:01 – Freedom…

Christoph Lupprich 

Routing form objects with Rails

Reading through the Release Notes of Rails 5.2, things like ActiveStorage made me curious so that I wanted to give it a try. I went ahead and installed a pre-release version to build a simple app.

My goal was to create an application that allows a user to create questionnaires and then collect answers. I started out with a form object, that would take the title of a questionnaire and a list of questions.

# db/migrate/create_questionnaires.rb
create_table "questionnaires", force: :cascade do |t|
  t.string "title"
  t.string "questions", default: [], null: false, array: true
  t.datetime "created_at", null: false
  t.datetime "updated_at", null: false   
end

#…

Wh…

Scout ~ The Blog 

A tour of Python monitoring tools

The Python ecosystem has a wealth of monitoring tools. That said, making sense of each tool's specialty - and where overlaps exist - is a challenge.

In this post, I hope to give a clear picture of the different monitoring and debugging tools available in the Python world and explain how they fit together.

Before we talk about specific tools, lets talk about how to categorize them.

Categorizing Monitoring Tools

Inspired by Cindy Sridharan's Logs and Metrics blog post, here's how I roughly sort monitoring tools (click image for full-size):

python monitoring tools

Note that some tools cross boundaries. For the tools in this post, I've included their primary area of focus.

Logging

Logging is the lowest common…

The Bike Shed 

138: I Don't Know How the World Works Anymore

We chat about how shared global state in tests can cause you to doubt foundational truths of the universe, some issues with Rails system tests, and recent changes in browser behavior.

Scout ~ The Blog 

Deploying to AWS Part IV: Performance monitoring with Scout

Looking for a fresh, 2018 approach to deploying a Rails app to AWS? We've partnered with DailyDrip on a series of videos to guide you through the process. We'll be covering how to Dockerize a Rails app, AWS Fargate, logging, monitoring, and CDN support.

Today, we're configuring application performance monitoring for our Rails app using Scout. In the last video, we configured AWS to ship our logs to LogDNA, but logging is just one of the three pillars of observability. With Scout's transaction traces we can easily find performance bottlenecks within our app and database layers.

Let's dive in.

Getting Started

Let's get started by visiting Scout and creating a new account. Once we've…

BigBinary Blog 

Ruby 2.5 allows creating structs with keyword arguments

This blog is part of our Ruby 2.5 series. Ruby 2.5 was recently released.

In Ruby, structs can be created using positional arguments.

Customer = Struct.new(:name, :email)
Customer.new("John", "john@example.com")

This approach works when the arguments list is short. When arguments list increases then it gets harder to track which position maps to which value.

Here if we pass keyword argument then we won’t get any error. But the values are not what we wanted.

Customer.new(name: "John", email: "john@example.com")
=> #<struct Customer name={:name=>"John", :email=>"john@example.com"}, email=nil>

Ruby 2.5 introduced creating structs using keyword arguments. Relevant pull request is here.

Drivy Engineering 

Pro tips for productivity

Every 2 weeks we hold Tech Talks here at Drivy. These are an opportunity for our now 17-strong team of developers to gather for 1 hour in a non-squad setting. The Tech Talks are emphatically not about tackling issues or solving problems, but are instead an opportunity to explore new ideas, ask questions, or to return to discussions started in a different context.

As a recent new hire to Drivy in a junior capacity, I quickly recognised that the Tech Talks were going to be a valuable addition to my onboarding experience. Any junior, joining an established tech team with rigorous working practices in place, will likely feel daunted as I did. One way I combatted this was by trying to learn as…

Capsized Eight 

Things I wish ActiveRecord had after using Ecto

A few years ago, I wrote an article about moving from Django to Rails. As I said there, I don't find it too hard moving from one programming language to another, as long as you have good knowledge on concepts they all share. Each language, of course, brings something on its own.

Last year, I decided to try something new. As a Ruby developer, Elixir proved to be a logical choice, and I have to admit, I am not disappointed. I fell in love with it at first sight, and I enjoy working with Elixir/Phoenix now.

Elixir Ecto illustration

One thing that I especially like is Ecto, a database wrapper, and a domain-specific language for writing queries in Elixir. Although it's not entirely the same thing as Rails' Active…

Ruby Tuesday 

Issue #7

  • One feature I overlooked in Ruby 2.5: you can now initialize Structs with keyword arguments. All you need is to append keyword_init: true as option. More information in this blog post.
  • Mike Perham, author of Sidekiq and Faktory, reminds about great advice coming straigh from Ruby docs:

    It is recommended that a library should have one subclass of StandardError or RuntimeError and have specific exception types inherit from it. This allows the user to rescue a generic exception type to catch all exceptions the library may raise even if future versions of the library add new exception subclasses.

  • If you need yet another idea for your microservices architecture, take th…
Scout ~ The Blog 

Tutorial: Tracing Python Flask requests with OpenTracing

flash and opentracing

A transaction trace is a GPS system for web performance: it paints a rich picture of the flow of a web request through your code.

So, why doesn't everybody trace? I believe there are two reasons:

  1. Complex instrumentation: Adding in-app tracing instrumentation is more involved than calling logger.info() for logging or statsD_client.incr() for metrics.
  2. Vender lockin: You aren't committing to a vendor when you log and record metrics: you can easily swap out different services to aggregate your logs and store your metrics. Even though APM vendor tracing libraries are remarkably similar, there hasn't been a vendor-neutral standard for tracing. Adding complex, vendor-specific instrumentation…

OpenTracing, a vender-neutral tracing API

Enter OpenTracing, a vendor-neutral open standard for distributed…

Engine Yard Blog 

Ruby 2.5.0 New Features

 

 The Ruby team has a tradition of releasing new Ruby versions during Christmas. 2017 is no exception as they released Ruby 2.5.0. This is the first stable release of the Ruby 2.5 series.

BigBinary Blog 

Rails 5.2 allows mailers to use custom Active Job class

This blog is part of our Rails 5.2 series.

Rails allows sending emails asynchronously via Active Job.

Notifier.welcome(User.first).deliver_later

It uses ActionMailer::DeliveryJob as the default job class to send emails. This class is defined internally by Rails.

The DeliveryJob defines handle_exception_with_mailer_class method to handle exception and to do some housekeeping work.

def handle_exception_with_mailer_class(exception)
  if klass = mailer_class
    klass.handle_exception exception
  else
    raise exception
  end
end

One might need more control on the job class to retry the job under certain conditions or add more logging around exceptions.

Before Rails 5.2, it was not…

Notes to self 

Editing XFA PDF forms on Linux/Fedora

PDF should be this nice universal format that many government institution now work with. But what if they require you to fill in XFA forms inside their template PDFs? The ones I need to fill for my insurance company are certainly not supported in the standard Document Viewer shipped with Fedora. This weekend I tried installing Master PDF Editor and guess what? It works like a charm for me. They even offer various RPM builds for CentOS 6/7. And they work on my Fedora out of the box. Lucky me. Thanks a lot for this!

Paweł Urbanek 

Limit Rails memory usage, fix R14 and save money on Heroku

Pig and money

In theory, you can run both Rails web server and Sidekiq process on one 512mb Heroku dyno. For side projects with small traffic, saving $7/month always comes in handy. Unfortunately when trying to fit two Ruby processes on one dyno you can run into memory issues. In this post, I will explain how you can limit memory usage in Rails apps.

Recently, I read a great article by Bilal Budhani explaining how to run Sidekiq process alongside Puma on one Heroku dyno. After applying it to one of my side projects, I started running into those dreaded R14 errors.

R14 fixed

Memory usage spiked followed by a bunch of memory errors and automatic restart

I did some digging and, after a couple of optimizations…

rossta.net 

Building basic Connect Four with Vue.js

This post is part of a series on building Connect Four with Vue.js, SVG, Elixir, and the Phoenix framework.

Lately, I've gotten excited about the Vue.js JavaScript framework view rendering due to its versatility, low barrier to entry, and community supported extensions for state management and routing. In this post, we'll use Vue.js 2 to dynamically render the Connect Four game board we started last time. This will not be a complete tutorial on Vue.js, but it hopefully will illustrate some of Vue's basic concepts and its powerful and intuitive features. Check out the excellent Vue.js guides for a thorough introduction to the framework.

To see where we'll end up, here's a pen:

See the…

bogdanvlviv / Bogdan 

Мій 2017

2017-ий був продуктивним.

Навчився змінювати колесо на автомобілі.

Провів курс по Ruby on Rails.

Отримав Візу в США.

Giant Robots Smashing Into Other Giant Robots 

Why Factories?

These days, most Rails projects use some form of factories in their test set up. What problem do they solve and why are they needed?

Too much info

Given a User model with first_name, last_name, and location fields, we could write a test like:

describe "#full_name" do
  it "combines first and last name" do
    user = User.new(
      first_name: "Joël",
      last_name: "Quenneville",
      location: "Boston"
    )

    expect(user.full_name).to eq "Joël Quenneville"
  end
end

This test has too much information in our test setup. The location is irrelevant to the output of the full_name method yet it’s hard to know that just reading the test. It looks like location has some…

RubyMine Blog 

Active Storage Support in the newest RubyMine

Hi there, and welcome to 2018!

RubyMine 2017.3.2 RC (build 173.4301.17) is here featuring Active Storage, which means autocompletion and resolution now works for storage usages:

This build also contains some minor bug fixes. Find more in the release notes.

Download RubyMine 2017.3.2 RC

Feel free to try it, and please submit any issues to our bug tracker.

Cheers,
Your RubyMine team

rossta.net 

Connect Four with SVG pattern masking

This post is part of a series on building Connect Four with Vue.js, SVG, Elixir, and the Phoenix framework.

One of my recent side projects to learn new technologies has been to build a browser-based rendition of Connect Four. The fully-functional version of the game will have both a backend and frontend component with some good challenges including animating checkers falling into place and connecting two players over the network.

In this post, we'll demonstrate rendering the static board with SVG, including the use of pattern masking to emulate a game board wall with portholes through which to view the checkers.

Let's talk about SVG

Awesome Ruby Newsletter 

Issue 87 - Top 5 Reasons for Ruby-ists to Use Crystal

Scout ~ The Blog 

Are You Monitoring Your Machine Learning Systems?

We're partnering with FusionCell to survey folks about how they monitor machine learning learning applications. FusionCell's Robert Dempsey joins us today to share some of the personal pain he's faced monitoring machine learning apps. Robert has been helping companies and engineers learn about, build and leverage machine learning systems.

When StackOverflow surveyed 64,227 software developers from 213 countries, Python came out as the programming language most wanted by employers.

Why?

Machine learning, or "ML" for short.

Over the past few years Python has taken over in machine learning thanks to libraries like Pandas and Scikit-learn.

But everything needs time to mature.

When it comes…

Scout ~ The Blog 

Deploying to AWS Part II: Running a Rails app on Fargate

What's the 2018 approach to deploying a Rails app to AWS? We've partnered with DailyDrip on a series of videos to guide you through the process. We'll be covering how to Dockerize a Rails app, AWS Fargate, logging, monitoring, and CDN support.

Today's video is the next in the series of setting up our produciton app for production use in AWS ECS. In our last video, we Dockerized the app to prepare it to run on ECS / Fargate; in this video, we will work on doing just that.

Introduction to AWS ECS and Fargate

So, what are Amazon's Elastic Container Service and Fargate?

Here are some quick snippets from Amazon's website:

  • ECS: "a highly scalable, high-performance container orchestration…
Scout ~ The Blog 

Deploying to AWS Part III: Log aggregation

Looking for a fresh, 2018 approach to deploying a Rails app to AWS? We've partnered with DailyDrip on a series of videos to guide you through the process. We'll be covering how to Dockerize a Rails app, AWS Fargate, logging, monitoring, and CDN support.

In our last video, we deployed our Rails app to AWS ECS with Fargate. In this video, we'll walk through logging. We'll switch to a more useful log output format and learn how to ship Cloudwatch logs to an external log aggregation service (LogDNA in our case).

Recap

In our last video, we didn't spend much time going over how we configured our logging. So, let's take a moment to talk about our current situation.

One of the first steps we…

Giles Bowkett 

Quick Terminal/iTerm2 Hack

My shell prompt uses unix status codes to either return a go-get-em Unicode smiley, when everything's going well, or a shrug, when a command failed.

To get this into my shell prompt, I use a shell prompt function, which sets than the usual $PS1 environment variable. You need the function because it sets the value of $PS1 every time something changes. This also makes it easy to, for example, display whatever git user, or set of users, I happen to "be," since I use git pair.

A nice side effect is that you can call arbitrary functions in there. tab-title $(this) sets the title of the Terminal or iTerm2 tab to whatever my current git branch name is. Since the shell prompt function is executed…
All Ruby Podcasts by Devchat.tv 

RR 344: What Are You Working On?

Panel:

Charles Max Wood

Dave Kimura

David Richards

Brian Hogan

Eric Berry

In this episode, the Ruby Rogues panel discuss things they are playing with or working on now.  Much of the discussion covers technologies in Rails and Ruby, Rails. 5.2 beta, React, Sprinkles, redux, and more details with these technologies. Each of the Ruby Rogues members comment on their workflows and personal applications for apps and web applications. Also, how playing with things or technologies, helps build your skills and development.

In particular, we dive pretty deep on: 

  • What are the things you have been playing with? Rails, Ruby, React
  • React, react components
  • JS Sprinkles
  • Tubo Links
  • Hybrid Apps
Search Results for “ruby” – via @codeship 

Tracking Object Allocation in Ruby

Reading Time: 6 minutes

Whenever you do something like MyClass.new, Ruby creates a new object, which uses a little bit of memory. But that’s not the only way you are creating objects. Many actions will create objects, including strings and arrays. Even if you don’t say String.new or Array.new, it’s still a new object that is being created for you.

Because memory is not unlimited and memory allocation has an impact on performance, it’s important to understand the answer to the following questions:

  • When is exactly a new object created and why?
  • Are there tools to help you see when your code is creating new objects?

In this article, I want to answer these questions for you, starting with the O…

All Ruby Podcasts by Devchat.tv 

MRS 026: Michael DiBernardo

Panel: 

Charles Max Wood

Guest: Michael DiBernardo

This week on My Ruby Story, Charles speaks with Michael DiBernardo. Michael is a return guest, previously on Ruby Rogues Episode 256. Micheal talks about his journey into programming via building a PC with an uncle and learning about programming games. Micheal mentions teaching programming at a university and learned that most students interests in programming began with gaming. Micheal continues to talks about the many different paths in his development career, including teaching and going back to college to learn other programming languages.

In particular, we dive pretty deep on:

  • How did you get introduced to programming?
  • Games
  • F…
Ruby – Sihui Huang 

Design Pattern: Builder and Car

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


The builder pattern is a very commonly used pattern. But its definition can be a bit confusing at first glance.

The builder pattern separates the construction of a complex object from its representation so that the same construction process can create different representations.

Fear not. The definition will become much clearer after we build some cars. 🚗 🚙 🚓 🚃

Let’s start by building a standard car.

View the code on Gist.

To keep our example simple, we will only pay attention to car frames, engines, wheels, dashboard, and energy sources and ignore the rest.

The…

Drivy Engineering 

Highlights from the 2017 dotJS

Marcy Sutton speaking at the 2017 dotJS

Last month was the dotJS conference in Paris, which we attended, along with some 1400 developers from all over the world. As you could expect, the speakers were stellar. Some talks made us want to ponder our assumptions about how we write JavaScript and come to a more elevated understanding of our front-end ways, and some of them made us want to grab the nearest keyboard and tinker frantically with WebAssembly, TypeScript, or WebGL.

If you don’t have a full day of free time ahead of you to watch all the talks, here are some highlights of the ones we recommend checking out first.

Wes Bos - Async & Await

If you haven’t had time to play with async and await, you could take a look at the…

Ruby Weekly 

Ruby 2.5 Released

Ruby Weekly Issue 381 — January 11, 2018
ruby-lang.org
It’s 5-10% faster than 2.4, rescue/else/ensure can now be used directly on blocks, hashes get new transform_keys & slice methods, pp.rb is loaded by default, ERB is 2x faster, and.. a lot more.


Basecamp
From Basecamp comes a new JavaScript framework well suited for Rails apps. Rather than replace your HTML or rendering mechanisms, Stimulus augments existing HTML with functionality.


Noah Gibbs
The story and status of Just-In-Time compilation in Ruby 3 along with preliminary…
Honeybadger Developer Blog 

Webpack Plugin for Source Maps

Announcing Honeybader's Webpack Plugin to upload JavaScript Source Maps to our API.
Junior Developer 

Viewing migration SQL without running the migration

I've seen the question "how can I get the SQL for a migration without running it?" come up a few times. The low-tech answer is to ignore the "without running" part of the question and just run the migration, grep the log file for the SQL output, and then do a db:rollback. But that seems like cheating and is kind of a pain, too. So, how can we make it better?

My initial approach was to intercept a method call pretty far down in the Active Record stack and, if it was the particular migration I was looking for, print the SQL rather than executing it. I'm using PostgreSQL, and I'd like to intercept the ActiveRecord::ConnectionAdapters::PostgreSQLAdapter#execute method, so here's a proxy:

BigBinary Blog 

Rails 5.2 supports descending indexes for MySQL

This blog is part of our Rails 5.2 series.

An index is used to speed up the performance of queries on a database.

Rails allows us to create index on a database column by means of a migration. By default, the sort order for the index is ascending.

But consider the case where we are fetching reports from the database. And while querying the database, we always want to get the latest report. In this case, it is efficient to specify the sort order for the index to be descending.

We can specify the sort order by adding an index to the required column by adding a migration .

add_index :reports, [:user_id, :name], order: { user_id: :asc, name: :desc }

PostgreSQL

If our Rails…

Greater Than Code 

062: The Beauty of Art and Technology with Jamey Hampton

Panelists:

Jessica Kerr | Sam Livingston-Gray | Astrid Countee

Guest Starring:

Jamey Hampton: @jameybash | jameybash.com | Agrilyst |
Sugar City Arts Collaborative

Join Our Slack Channel!
Support us via Patreon!

Are you Greater Than Code?
Submit guest blog posts to mandy@greaterthancode.com

Show Notes:

01:22 – Jamey’s Superpower: “The Fharlanghn Sense”

02:40 – Working in Agriculture

04:03 – Theories on Automation

05:56 – Pivoting Into Computer Science and Software Development

10:35 – Feeling Like You Need to Know Everything

Stella Report from the SNAFUcatchers Workshop on Coping With Complexity

15:47 – ‘Zines and Being a ‘Zine Librarian

27:50 – The Beauty of Art and Technology and…

AkitaOnRails.com 

My Notes about a Production-grade Ruby on Rails Deployment on Google Cloud Kubernetes Engine

I've been using Google Cloud with Kubernetes Engine for 2 months and change, from zero to production. Actually, it didn't take me a month to put it all together but it did take an extra month to figure out some nasty rough edges.

TL;DR: Google is actually doing a pretty good job being a counterbalancer so AWS doesn't slack off. If you already know everything about AWS, I'd encourage you to test out Google Cloud. Possibly because of muscle memory, I would still be more comfortable with AWS, but now that I forced myself to suffer the learning process, I am pretty confident with Google Cloud and Kubernetes for most of my scenarios.

Full disclaimer that I am not an expert, so take what I say…

Hi, we're Arkency 

Process Managers revisited

Process Managers revisited

I’ve been telling my story with process managers some time ago. In short I’ve explored there a way to source state of the process using nothing more but domain events. However I’ve encountered an issue which led to a workaround I wasn’t quite happy about. With the release of RailsEventStore v0.22.0 this is no longer a case!

Let’s remind ourselves what was the original problem to solve:

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 caterer can deliver this particular menu (for given catering conditions). In short you wait for CustomerConfirmedMenu and CatererConfirmed…

Mike Perham 

Faktory 0.7.0 Released

Faktory is my brand-new background job system for every programming language. If you want to learn more, see the intro. It's been three months since the initial launch in October and I've heard of several successful rollouts to production. If you were reluctant to try out Faktory before, it's time to start looking into it because the biggest release of Faktory yet is now available to all. November and December saw lots of changes and improvements; here's a recap.

logo

Job Priorities

Jobs can now be prioritized from 1-9 within a queue! The initial release of Faktory was focused on replicating Sidekiq's existing functionality but Faktory's different architecture allows us to implement…

Engine Yard Blog 

Ruby Still isn't dead

A few years ago there was a whole lot of hubbub in various spots about Ruby being dead. Here we are, three years later, and the same arguments are being bandied about. Ruby is a programming language built for happiness - that’s the underlying principle. Why would a community of happy individuals and teams let that die?

BigBinary Blog 

Ruby 2.5 adds Hash#transform_keys method

This blog is part of our Ruby 2.5 series. Ruby 2.5 was recently released.

Ruby 2.4 added Hash#transform_values method to transform values of the hash.

In Ruby 2.5, a similar method Hash#transform_keys is added for transforming keys of the hash.

>> h = { name: "John", email: "john@example.com" }
=> {:name=>"John", :email=>"john@example.com"}

>> h.transform_keys { |k| k.to_s }
=> {"name"=>"John", "email"=>"john@example.com"}

The bang sibling of this method, Hash#transform_keys! is also added which changes the hash in place.

These two methods are already present in Active Support from Rails and are natively supported in Ruby now.

Rails master is already supporting using the native…

Everyday Rails 

Upgrading to RSpec 3.7.2 and system specs

Support for Rails 5.1 system testing is now available to RSpec fans like you and me. Here's how I moved my book's feature specs to system specs.
Ruby Together News 

December Monthly and 2017 Yearly Update

Hello, and welcome to a year-end special edition of the monthly update: Ruby Together’s Yearly Update for 2017! There are more details in the following sections, but here’s the tl;dr. During 2017, we took in $284,481.28, we spent $241,973.01, and we paid for 1,169 hours of developer work on Ruby open source.

Some highlights from the year include shipping 21 Bundler releases, shipping 11 RubyGems releases, kicking off Ruby Toolbox 2.0, Bundler almost shipping with Ruby 2.5, and defending RubyGems.org against a DoS attack on Christmas Day.

Ruby Together news

During December, our work was supported by 76 different companies, including reinteractive, Stripe, thoughtbot, Travis CI, and many…

Bundler Blog 

Monthly update for December and yearly update for 2017

Welcome to the Bundler monthly (and yearly) update! We’ve been writing monthly updates about Bundler for several years as part of the Ruby Together monthly updates, and finally realized that we should be posting those monthly updates here, as well. Here’s to many more monthly updates to come!

As you may have noticed, Bundler didn’t end up shipping with Ruby 2.5. The Ruby language core team has yet to announce why they decided to remove Bundler a few hours before Ruby 2.5 was released on Christmas Day. Hopefully, we’ll find out the story there soon.

In the meantime, Bundler 1.16.1 has been released, with fixes or workarounds for all known issues. If you were waiting to upgrade to version…

Riding Rails 

Happy New Year! Ruby 2.5, bugfixes, and more!

Happy New Year, Rubyists on Rails! This is Tim here bringing you all the latest in Rails from the Holiday and New Year period. We hope you got to unwind during this time of year (if that is your thing) and are well rested for all that 2018 has to bring. Rails, on the other hand, saw a flurry of activity including many, many bug fixes. So, without further ado…..

This Week’s Contributors

Since our last issue, 36 people gave the gift of Pull Request 🎁 to Rails. 6 of those contributed for the very first time! A big thank you to everyone who contributed during a time that is typically reserved for performing upgrades and fixes to extended family members’ devices.

Ruby 2.5.0 added to Rails CI…

Paweł Urbanek 

Productive Laziness - optimize your shell workflow

lazy cat

I would like to share a simple productivity tip that probably helped me save thousands of keystrokes so far.

I’ve been using this technique for a while now to maximize my laziness (productivity) during work and so, recently I wrapped it up in an easy to use Ruby Gem. It simply counts your shell commands and displays them sorted by usage frequency. Using it is as simple as typing:

gem install lazyme
lazyme

This is how my most used commands look now. Top hits are usually a good candidate for new aliases:

+---------------------------------------------+-------+
|                     Lazyme                          |
+---------------------------------------------+-------+
|...             …
Janko’s Blog 

Better File Uploads with Shrine: Direct Uploads

This is 6th part of a series of blog posts about Shrine. The aim of this series is to show the advantages of using Shrine over other file attachment libraries.


So far we were talking about the server side of handling file uploads. However, there is a lot that we can also do on the client side to improve user experience and performance.

Let’s say we have a Photo model with an #image attachment attribute handled by an ImageUploader:

class Photo < Sequel::Model
  include ImageUploader::Attachment.new(:image)
end
class ImageUploader < Shrine
  # ...
end

The simplest file upload worfklow is having a vanilla form with a file field for selecting files, and also a hidden field for retaining…

Andy Croll 

Be sparing when using unless

One of Ruby’s strengths is its delightful, built-in syntactic sugar. One example of this is the keyword unless, which you can use in place of using if combined with a negative statement.

However, given the flexibility of Ruby’s syntax, it is easy to make code harder to understand than it needs to be.

Instead of…

…using unless in ways that makes your brain hurt.

# Example 1
unless something?
  # do something
else
  # do other thing
end

# Example 2
unless something? || another_thing?
  # do something
end

Use…

if where it makes the code clearer.

# Example 1
if !something?
  # do other thing
else
  # do something
end

# Example 2
if !something? && !another_thing?
  # do something
end
BigBinary Blog 

Rails 5.2 allows passing request params to Action Mailer previews

This blog is part of our Rails 5.2 series.

Rails has inbuilt feature to preview the emails using Action Mailer previews.

A preview mailer can be setup as shown here.

class NotificationMailer < ApplicationMailer
  def notify(email: email, body: body)
    user = User.find_by(email: email)
    mail(to: user.email, body: body)
  end
end

class NotificationMailerPreview < ActionMailer::Preview
  def notify
    NotificationMailer.notify(email: User.first.email, body: "Hi there!")
  end
end

This will work as expected. But our email template is displayed differently based on user’s role. To test this, we need to update the notify method and then check the updated preview.

What if we could…

Drifting Ruby Screencasts 

Ruby on Rails 5.2.0 Changes and New Features

Upcoming features include ActiveStorage, built-in Redis Cache Store, updated Rails Credentials and a bunch of other cool things! Honorable mentions also to the new Stimulus Javascript Framework.
RubyGuides 

The Definitive Guide to Loops in Ruby

In this article you will learn many different ways to write a Ruby loop. A loop lets you repeat some action a number of times. You can also go over a list of things, like an array or a hash, and work with each individual element. If you are a beginner I don’t want you […]

The post The Definitive Guide to Loops in Ruby appeared first on RubyGuides. Don't miss your free gift here :)

Notes to self 

Invoicing from the command line

Are you a freelancer? You don’t need to leave your command line to create invoices for your clients. InvoicePrinter is a Ruby library for producing PDF invoices without too much hassle. If you haven’t seen it before, you can read more about it in the announcement or its GitHub page. With the upcoming 1.1.0 release (currently as release candidate) a command line executable is included so you can now use command line to invoice your clients. No need to learn Ruby, just pass the data in the familiar JSON format! Here is how to create your first invoices.

Installation

InvoicePrinter requires Ruby. If you are on Fedora or Fedora-based systems just run:

# dnf install ruby

And then install the…

Drifting Ruby 

Ruby on Rails 5.2.0 Deprecations

With Ruby on Rails 5.2.0.Beta2 out now, its release candidate and official release is probably right around the corner. In efforts to clean up some of the code base, some methods have been deprecated. If you have been keeping your apps up to date with the latest stable releases, chances are that you have noticed these for some time coming as the via the deprecation notices in the application logs.

For easy searching purposes, I’ve parsed through the logs of all of the upcoming deprecations in Ruby on Rails 5.2.0. These were taken straight out of the CHANGELOGs.

We will be releasing January’s free screencast of some of the upcoming features in Ruby on Rails 5.2.0.

Overall, this has been a…

dry-rb news 

dry-system 0.9 released with new plugins

Hello in 2018! We’re starting the year with a couple of new releases, including dry-system 0.9 which comes with support for dry-monitor’s notifications and a new plugin API. There are already six built-in plugins that you can enable, and it’s very easy to write your own. This release is also sort of a clean up, as a bunch of features that we previously had in dry-web, have been ported to dry-system’s plugins.

Logging support

You can now enable a default system logger by simply enabling :logging plugin, you can also configure log dir, level and provide your own logger class.

class App < Dry::System::Container
  use :logging
end

# default logger is registered as a standard object, so you…
The Bike Shed 

137: What's Up, Docs

Who should library documentation be written for? How do you, as an author, know what your users will need to know? Should you have long form guides in addition to API documentation? We ask and answer these questions in the context of Sean's work to document Diesel 1.0.

Stick around for the spoiler-filled after show about Star Wars: The Last Jedi.

All Ruby Podcasts by Devchat.tv 

MRS 025: Tyler Renelle

Panel: 

Charles Max Wood

Guest: Tyler Renelle

This week on My Ruby Story, Charles speaks with Tyler Renelle. Tyler is a contractor and developer who has worked in many web technologies like Angular, Rails, React and much more! Tyler is a return guest, previously on Adventure in Angular and JavaScript Jabber talking Ionic and Machine learning.

Tyler has recently expanded his work beyond JavaScript and is on the show to talk his interest in AI or Artificial intelligence and Machine Learning. Furthermore, Tyler talks about his early journey as a game developer, web developer, and work with some content management systems, and more recently, his development in various technologies.

In…

Awesome Ruby Newsletter 

Issue 86 - Rails 5.2 adds bootsnap to the app to speed up boot time

Schneems - Programming Practices, Performance, and Pedantry 

Get your SVGs out of your HTML

After this holiday season many of us would like to lose a little weight, page weight that is. In my app CodeTriage I make extensive use of SVG elements for images, the logo, and icons. Until recently, I’ve been rendering the SVG elements directly in the HTML. This was the easiest thing to do. As you might guess by my intro sentence, I’ve been working on decreasing page weight by removing SVG elements from the HTML. How well did it work? Before making changes the homepage was 14kb (77kb unzipped). After the change, the homepage is 6kb (30kb unzipped). That’s a 57% reduction in “over the wire” bytes per page load. What exactly did I do, and what were the trade-offs I made to get to a smaller…

Appfolio Engineering 

Quickie: Building Ruby with Memory Profiling

Ruby's garbage collector has some really interesting memory profiling capabilities. If you build with them turned on, they'll be reported as extra entries in GC.stat.

But how do you turn them on? I mean, without downloading the Ruby source code and configuring everything manually...

If you use rvm, it's pretty easy:

cflags="-D RGENGC_PROFILE=2 -DRGENGC_PROFILE_MORE_DETAIL -DRGENGC_PROFILE_DETAIL_MEMORY -DPROFILE_REMEMBERSET_MARK" rvm install --disable-binary --reconfigure 2.4.1-gcprofile

When you use "rvm --disable-binary --reconfigure" you're making sure it rebuilds Ruby even if it could give you an off-the-shelf binary. When you ask for "2.4.1-whatevername" you're saying to install CRuby…

Search Results for “ruby” – via @codeship 

The Top Four Exception Tracking Services

Reading Time: 11 minutes

Software development is both challenging and complex. Specifically, whether we’re developing landing page apps or Linux kernel drivers, developing software often requires recording and analysis of vast swathes of information.

Of that information, application exceptions are essential. Well, if you want to find out why a user encountered a problem, why an error occurred, and why an application crashed.

Take the example below. The exception’s message shows that a PDOException was thrown, because a database table, tblmovies, wasn’t found. You can also see the original point of execution, right through to the class and line that threw the exception (edited for readability

PDOException thrown with…
Ruby – Sihui Huang 

Design Pattern: Proxy and Agent

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


Imagine yourself as a movie star, a big one. You are so famous that everyone in Hollywood wants to work with you. You never lack acting opportunities. So many requests come to you that you need an agent to handle them.

Here is what you want your agent to do.

  1. When a new filming request comes, the agent first checks to see if it fits your schedule.
  2. If so, the agent then checks your preferences. (For example, you have been in too many comedies, and you want your next film to be a drama.)
  3. Finally, if the new film fits both your schedule and preferences, the agent…

 

The agent is essentially a proxy that sands in for you.

This is a case calls for the Proxy Pattern.

The Proxy Pattern provides a surrogate or…

Ruby Inside - Medium 

Design Patterns in Ruby: Strategy Pattern

Illustration by x6e38 on Flickr. (CC 2.0)

Design patterns can be powerful conceptual models for thinking about how to solve problems in software development. Popularized in the ’90s by the Gang of Four, many of them have remained relevant to this day.

They can also be great shortcuts for understanding the architecture of a system. As soon as you recognize the presence of a pattern, your mental model of that system snaps into focus, and you suddenly have a high-level idea of the structure while you wade through individual classes and methods.

When I’m learning new concepts and patterns, I always like having practical examples. Since I was brushing up on my patterns recently, I thought I would…

All Ruby Podcasts by Devchat.tv 

RR 343: Ruby 2.5 with Jesus Castello

Panel:

Charles Max Wood

Dave Kimura

David Richards

Eric Berry

In this episode, the Ruby Rogues panel discuss Ruby 2.5 with Jesus Castello. Jesus has been a developer for several years, and has learned Ruby 6 years ago and is now teaching Ruby. Jesus is on Ruby Rogues to talk about Ruby 2.5 and performance improvements and performance documentation. Also, Jesus talks about the everything Ruby 2.5 and the next editions for the language.

In particular, we dive pretty deep on: 

  • Improvements and documentation
  • Changes to the library
  • RVM - Is Great
  • System Ruby
  • What feels most natural working with
  • Preventing SkyNet!
  • Language changes
  • Top-level constant lookup is removed.
  • Rescue/else…
Gavin Miller 

2017 Year In Review

Hello! This is the second installment of my year in review “series”. Last year I did a year in review and found it to be very beneficial and so the tradition continues.

Blog / Community

My goals for 2017 centered around a few items: finishing an ebook info product, writing on the blog, and mentoring with Chic Geek.

The idea for the ebook was to create something based on my experience in Ruby & Security. This did not happen. I started working on the project and came to the realization that I didn’t want to do an info product. My heart wasn’t there and I killed the goal!

The second bit of work that I wanted to accomplish was writing more for the blog. This also did not happen. Primarily…

Appfolio Engineering 

Ruby and Nested Exceptions

Often, one exception causes another.

A library tries to read a configuration file with File.read, which raises an exception of type Errno::ENOENT with the message "No such file or directory @ rb_sysopen". That library then raises another exception to let you know: it couldn't find its configuration, possibly after looking in several different places.

Older versions of Ruby used to throw away this inner exception. The library rescued the "no such file" exception, swallowed it, and raised an entirely new one. Indeed, some libraries still do. Folks like Avdi Grimm and Charles Nutter were in favor of the inner exception sticking around. Ruby isn't the only language to do this. It's common…

All talk but no code... 

《深入理解運算原理》的翻譯慘不忍睹

《Understand Computation》這本書原本我很期待的,聽 Ruby Rouge 的介紹,似乎可以讓讀者理解許多有趣的計算機科學原理,像是正規表示式等等。原本都快要去買英文版了,想不到12月初碁峰資訊代理的中文版竟然上市了,於是我就很高興的買了一本回家看。

結果越讀越不對勁,很多地方不大理解,於是去找了英文版來對照,才發現翻譯實在不行,大概每四到五頁就會出現巨大的錯誤。沒有對照就看不懂。這邊列出最明顯的四個例子:

漏了一個 No 意思差很多

原文中這句話被這樣翻譯:

That all works as expected, but it would be nice if we could support conditional state-
ments with no « else » clause, like « if (x) { y = 1 } »

所有工作都一如預期,但我們若能以 else 子句支援條件陳述式,就像if (x) { y = 1 },那就更棒了。(40頁)

少了「no」結果意思變反了。這個問題在 31 頁也出現過。

例2

小步語意使得我們必須從諸如 3 的不可約運算式辨識出像是 1 + 2 的可化簡運算式。

當初看到這句的時候愣了一下,為何能從前者辨識出後者,所以去找了原文:

With small-step semantics we had to distinguish reducible expressions like « 1 + 2 » from irreducible expressions like « 3 »

Running with Ruby 

Kafka on Rails: Using Kafka with Ruby on Rails – Part 2 – Getting started with Ruby and Kafka

  1. Kafka on Rails: Using Kafka with Ruby on Rails – Part 1 – Kafka basics and its advantages
  2. Kafka on Rails: Using Kafka with Ruby on Rails – Part 2 – Getting started with Ruby and Kafka

Kafka Docker local setup

Before we proceed with combining Kafka with Ruby, it would be good to have a workable local Kafka process. Kafka requires Zookeeper and to be honest, a local setup can be a bit tricky. The easiest way to do that is by running a docker container for that. Here’s an example script that should be enough for the basic local work. It will spin up a single node cluster of Kafka that you can use out of the box:

KAFKA_ADVERTISED_HOST_NAME=127.0.0.1

docker stop zookeeper
docker stop…
Greater Than Code 

061: Destruction-Focused Development with Safia Abdalla

Panelists:

Jasmine Greenaway | Jessica Kerr | Coraline Ada Ehmke

Guest Starring:

Safia Abdalla: @captainsafia | safia.rocks | Zarf | Tanmu Labs

Join Our Slack Channel!
Support us via Patreon!

Are you Greater Than Code?
Submit guest blog posts to mandy@greaterthancode.com

Show Notes:

00:53 – Safia’s Superpower: Sight

03:04 – Learning Languages — Both Human and Programming

The Sapir Whorf Hypothesis

07:56 – Being Empathetic in an International Perspective and Building Universal and Approachable Tech

11:19 – What does success look like for minorities in the Silicon Valley monoculture?; Being Tokenized

Admiral Grace Hopper

21:59 – Accepting Speaking Engagements Because of Who You Are (i.e. as…

Test Double | Our Thinking 

Getting started with FFI: Rust & Unity

In my slack time, I've started writing games in Unity again.

As I've been going, though, I found myself wanting some of the tools and features from Rust. I've grown accustomed to Rust for performance-sensitive applications; it has several tools and features that make writing those applications easier for me. More and more I found myself thinking, "Wouldn't it be better to be able to write this feature in Rust?"

Time to break out some FFI magic.

What is FFI?

The term "Foreign-Function Interface" refers to any mechanism that allows code written in one language to directly invoke code written in another language. If "microservices" allow you to write individual networked services in whatever…

avdi.codes 

Retrospective 2007-2017: Losing the Joy of Coding

At the transition of 2017-2018, prompted in part by upheaval in my personal life, I did some reflecting on my intellectual journey as a software developer over the last decade. I originally wrote this up as part of a New Year's not-quite-resolutions post, but that post felt like both too much and not enough. In this update I've preserved the retrospective part of that post, and added a new conclusion.

Finding and Losing Joy

In 2007, after nine years as a relatively anonymous coder, I started building a public profile for myself as a programming enthusiast. I dabbled a bit in being an advocate for robust engineering practices, following in the footsteps of many of the programmers I admired.…

Scout ~ The Blog 

Deploying to AWS Part I: Dockerizing a Rails app

What's the 2018 approach to deploying a Rails app to AWS? We've partnered with DailyDrip on a series of videos to guide you through the process. We'll be covering how to Dockerize a Rails app, AWS Fargate, logging, monitoring, and CDN support.

Today, we will be working through a few steps to get our app Dockerized and our image pushed to a hosted Docker registry.

Introduction to Docker

Docker is a tool that allows you to package your application code and any supporting libraries so you can ship and run that code anywhere. If you're familiar with virtual machines, it's similar, but avoids costly side effects, since it doesn’t need an entire operating system to run. A container runs on…

Appfolio Engineering 

CRuby, MRI, JRuby, RubySpec, Rubinius, YARV: A Little Bit of Ruby Naming

If you've spent a little time in Ruby-land, you have have encountered the names "CRuby" or "MRI". You've almost certainly heard of JRuby, and perhaps a few "other" Rubies like Rubinius, TruffleRuby and maybe even a few "exotic" Rubies like Opal, IronRuby, MacRuby or MagLev.

What are all of these?

CRuby (formerly MRI) Plus YARV

If you're using Ruby then you know about CRuby even if you don't know that name. The default Ruby, the one people think of as "just Ruby," is CRuby. We used to call it MRI for "Matz's Ruby Interpreter." Matz (who wrote Ruby) is a modest guy and Ruby is a team effort, so he has asked us to call it "CRuby." It's a Ruby interpreter written in C, so "CRuby" works. Fair…

CR…

Andy Croll 

Year in Review 2017

This is the first one of these I’ve done. It’s all part of trying to be more cognisant and reflective of what I’m actually doing with my time. And to write more, so in writing I can know what I actually think.

January-March

Mostly taken up with three things:

  1. Starting with the lovely team at CoverageBook
  2. Working on a large Rails upgrade for BreatheHR
  3. The aftermath (both administrative and emotional) of my Dad’s death.

I definitely slightly broke myself. Probably booking myself slightly more than full-time in the aftermath of Dad wasn’t wise. I’m pretty sure the constant cold and flu I endured through to late Spring was a direct result of the stress I put myself under.

CoverageBo…

Valentino G. | Blog 

React Redux Tutorial for Beginners: learning Redux in 2018

The simplest React Redux tutorial I wish I had when I started learning

The Redux logo - React Redux tutorial

When I first started learning Redux I wish I could find the simplest tutorial ever.

Despite the great resources out there I couldn’t wrap my head around some of the Redux concepts.

I knew what’s the state. But actions, action creators, and reducers? They were obscure for me.

Last but not least I didn’t know how to glue React and Redux together.

During those days I started writing my own React Redux tutorial and since then I learned a lot.

I taught myself the Redux fundamentals by writing this guide. I hope it’ll be useful for all those learning React and Redux.

Enjoy the reading!

React Redux tutorial: who this guide is…

BigBinary Blog 

Ruby 2.5 enumerable predicates accept pattern argument

This blog is part of our Ruby 2.5 series. Ruby 2.5 was recently released.

Ruby 2.5.0 was recently released.

Ruby has sequence predicates such as all?, none?, one? and any? which take a block and evaluate that by passing every element of the sequence to it.

if queries.any? { |sql| /LEFT OUTER JOIN/i =~ sql }
  logger.log "Left outer join detected"
end

Ruby 2.5 allows using a shorthand for this by passing a pattern argument. Internally case equality operator(===) is used against every element of the sequence and the pattern argument.

if queries.any?(/LEFT OUTER JOIN/i)
  logger.log "Left outer join detected"
end

# Translates to:

queries.any? { |sql| /LEFT OUTER JOIN/i === sql }

This…

Ruby Tuesday 

Issue #6

Welcome to the first issue of Ruby Tuesday in 2018! Are you ready to start a new year with great Ruby-only and Rails-free content? Here are some things (some from 2017 though) to set you on track:

  • As every year, new Ruby version has been released on Christmas day. I’m sure you have read tons of articles about that, but if you need a recap, here’s one. Or if you are a performance freak, there are some benchmarks available too.
  • It’s a new year’s resolutions time so why not try to look into something completely different in programming? If, like me, it’s gamedev and maybe some roguelike, you might like this awesome terminal UI library called RETerm. It lets you compose your command line…
Junior Developer 

An encouraging podcast

I mentioned it briefly in my last post, but lately I've been listening to The Bike Shed podcast starring - at least in the episodes I've heard so far - Sean Griffin and Derek Prior. I've got a hefty commute, so I'm listening to it straight through from the beginning and am about 30 episodes in. I've been really encouraged by the episodes I've listened to so far and a couple of things have struck me:

  • Open source framework maintenance is a ton of work. These early episodes were back around the Rails 4.1-4.2 timeframe and Sean and Derek spend a lot of talking about various features and refactorings that might get pushed to 5.0, or just aren't ready for the next minor release. You can…
RubyGuides 

Everything You Need to Know About Nil

Nil… What is it, really? Well, nil is just a Ruby object. As you can see here: [crayon-5a612c0037290918520575/] There is only one nil object, with an object_id of 4 (8 in 64 bit Ruby). [crayon-5a612c003729f713814330/] NilClass Just like any other Ruby object nil has a set of methods. Here’s the class definition from Rubinius: [crayon-5a612c00372a3330703410/] […]

The post Everything You Need to Know About Nil appeared first on RubyGuides. Don't miss your free gift here :)

Andy Croll 

Truthiness in Conditionals

Ruby’s conditional syntax is ‘truthy’, meaning that any statement in a conditional that evaluates to nil is considered to be equivalent to false and anything not-nil can be considered to be true.

Instead of…

…overcomplicating your conditions.

# Example 1
unless something.nil?
  # do something
end

# Example 2
if !something.nil?
  # do something
end

# Example 3
if !!something
  # do something
end

Use…

# Instead of Examples 1,2 & 3
if something
  # do something
end

But why?

Performing a #nil? check as part of a statement in a negative conditional, as in the first two examples (unless or if !), is often redundant. Any nil value is ‘falsey’, so you can achieve the same result with a…

BigBinary Blog 

Rails 5.2 adds bootsnap to the app to speed up boot time

This blog is part of our Rails 5.2 series.

Rails 5.2 beta 1 was recently released.

If we generate a new Rails app using Rails 5.2, we will see bootsnap gem in the Gemfile. bootsnap helps in reducing the boot time of the app by caching expensive computations.

In a new Rails 5.2 app, boot.rb will contain following content:

ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)

require 'bundler/setup' # Set up gems listed in the Gemfile.
require 'bootsnap/setup' # Speed up boot time by caching expensive operations.

if %w[s server c console].any? { |a| ARGV.include?(a) }
  puts "=> Booting Rails"
end

This sets up bootsnap to start in all environments. We can toggle it per…

Ruby Conferences ‘n’ Camps in 2018 - What’s Upcoming? 

What’s Up in 2018/1? - Ruby Conferences ‘n’ Camps in January 2018 from Around the World

Conferences & Camps

Ruby on Ice - Jan 26-28th, 2018 (3d) Fri-Sun • (Updates)

Conference in Tegernsee, Bavaria, Germany

Talks include:

  • Where do Rubyists go?
  • Fortunately, maths!
  • Spotting unsafe concurrent Ruby patterns
  • The Good Bad Bug: Fail Your Way to Better Code
  • The Impermanence of Software
  • My Ruby is a Paintbrush. My Ruby is a Synth
  • Compiling Ruby
  • Don’t aim for reusability
  • Better developer relations start with the interview
  • How Music Will Make You REALLY Excited About Programming
  • Rails in the long run: Maintaining an app through the years
  • Introducing Tensorflow Ruby API
  • Ruby’s Gems
  • and more

See all Conferences & Camps in 2018 ».

See all Conferences &…

Ruby Conferences ‘n’ Camps in 2018 - What’s Upcoming? 

What’s Up in 2018/1? - Ruby Conferences &amp; Camps in January 2018 from Around the World

Conferences & Camps

Ruby on Ice (Updates) - Fri-Sun Jan 26-28th, 2018

Conference in Tegernsee, Bavaria, Germany

Talks include:

  • Where do Rubyists go?
  • Fortunately, maths!
  • Spotting unsafe concurrent Ruby patterns
  • The Good Bad Bug: Fail Your Way to Better Code
  • The Impermanence of Software
  • My Ruby is a Paintbrush. My Ruby is a Synth
  • Compiling Ruby
  • Don’t aim for reusability
  • Better developer relations start with the interview
  • How Music Will Make You REALLY Excited About Programming
  • Rails in the long run: Maintaining an app through the years
  • Introducing Tensorflow Ruby API
  • Ruby’s Gems
  • and more

See all Conferences & Camps in 2018 ».

See all Conferences & Camps @…

Kir Shatrov 

2017 in review

At the end of the year it’s time to do a review of what I’ve been through this year! It’s been a challenging year: switching teams at Shopify, leaving Canada, moving to the UK and a lot of travel in the meanwhile.

January

My team at Shopify shipped a year-long project, and I started thinking about new challenges. I spent most of my career working with Rails, and I realized that I want to explore more areas of Site Reliability Engineering. So-called “Pods” team was one of the teams at Shopify that worked on the edge of SRE (scaling Shopify horizontally across multiple datacenters), but at the same time, that kind of work still required deep knowledge of Ruby and Rails. In middle January I…

Scout ~ The Blog 

Observability: the new wave or another buzzword?

I think you'll be hearing more about observability in 2018. In this post, I share why I believe the term has emerged and why you'll be hearing more about observability vs. monitoring.

Failing Softly

The human body is remarkably good at isolating soft failures. When I catch a cold, I'll have less energy. I'll be a bit grumpy. But, I'm still generally functioning: I can still work, eat, breath, and sleep.

Like the human body, our software systems have evolved over the past several years to fail hard…

Giles Bowkett 

Pricing Cryptocurrencies Is Basically Impossible

This is NOT investment advice. This is a web developer, with no background in economics or finance, thinking out loud.

With the price of bitcoin skyrocketing, and other cryptocurrencies following it up, there's a pretty obvious question: what are cryptocurrencies actually worth?

Back in the day, Rick Falkvinge argued that bitcoin's killer app was international money transfers, and, therefore, that the total value of all bitcoin in circulation should be equal to the total value of the international money transfer market, which he estimated at 1% of total money in circulation. I liked this argument and found it compelling enough to buy a few bitcoins at $14 (which I then sold at around $60,…
Glauco Custódio 

Pentaho Data Integration: A Tool to Have on Your Toolbelt

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

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

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

How it works

The building blocks of PDI are: job and transformation.

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

Both can be stored locally or in a remote repository accessible to all your teammates.

You can also have a remote server responsible for running your jobs in a scheduler like crontab.

Setup

PDI is a paid…

Junior Developer 

Advanced Active Record ebook available now

I've finished my ebook! You can buy Advanced Active Record on leanpub for $20. You can also see the table of contents and some helpful Active Record-related links and whatnot on the book's site.

Really the subtitle is more accurate - "A Collection of Practical Deep Dives into Active Record Topics". Or maybe that could have been "Things That I Think You as a Fellow Experienced Active Record Developer Will Find Interesting". At any rate, the book has a bunch of things that I've run into over years of working on various Rails apps, and writing it gave me an excuse to dig into some of those.

Writing this ebook has given me even more respect for the Rails core team and especially folks who…

Ruby News 

2018 Fukuoka Ruby Award Competition - Entries to be judged by Matz

Dear Ruby Enthusiasts,

The Government of Fukuoka, Japan, together with “Matz” Matsumoto would like to invite you to enter the following Ruby competition. If you have developed an interesting Ruby program, please be encouraged to apply.

2018 Fukuoka Ruby Award Competition - Grand Prize - 1 Million Yen!

Entry Deadline: January 31, 2018

Fukuoka Ruby Award

Matz and a group of panelists will select the winners of the Fukuoka Competition. The grand prize for the Fukuoka Competition is 1 million yen. Past grand prize winners include Rhomobile (USA) and APEC Climate Center (Korea).

http://myfukuoka.com/category/news/ruby-news/

Programs entered in the competition do not have to be written entirely in Ruby but…

RubyMine Blog 

Fixed Indent in Rescue Blocks

Hey all,

RubyMine 2017.3.2 EAP, the last build we roll out this year, is now available. This update fixes the incorrect indentation in rescue blocks that suddenly showed up after the 2017.3 release.

This update also improves the highlighting of some RuboCop inspections, and has a number of other bug-fixes.

See the release notes for the full list of improvements, and let us know about any issues you face.

Looks like this is it for the year! Hope you enjoyed 2017, and we’ll see you soon in 2018!

Cheers,
Your RubyMine team

Awesome Ruby Newsletter 

Issue 85 - translation missing: en.blog_post.title

Scout ~ The Blog 

What we shipped in 2017

In 2017, we focused our engineering time on reducing the painful, time-consuming investigation workflow that comes with fixing performance issues. We think that approach is working: we're now analyzing billions of web requests and background jobs every day.

Here's some of the highlights from 2017:

Database Monitoring

The database is the most common bottleneck for web applications. In the fall, we released our database monitoring addon. The addon provides a high-level view of database activity and fast access to expensive SQL queries and their source code location.

db

Elixir Support

Elixir is an exciting, developer-friendly functional language that is a great compliment to Ruby. We…

Ruby – Sihui Huang 

Design Pattern: State and Combination Locks

Object-Oriented Design Patterns in Life Series – gain an intuitive understanding of OO design patterns by linking them with real-life examples.

 

The State Pattern allows an object to alter its behavior when its internal state changes. The object will appear to change its class.

The State Pattern is a beautiful example of how combining simple classes with clean interfaces can produce great power.

This is a long post. But stay with me. We are going to witness the beauty and power of object-oriented design together.

Build a combination lock

We will learn the State pattern by building a combination lock.

According to WikiHow, opening a combination lock involves three steps:

  1. Spin the dial…
Tech Tips and Freebies – Rubyroid Labs Blog 

10 Best Ruby on Rails Articles of 2017

New Year’s Eve is not only a great time to get together with your family and enjoy the happiest times of your life, it is also a great chance to look back and to say thank you to everyone who has been with you during the year passed. We’d like to congratulate every out of...
Kitty Con Gato 

A Better Time with Rails url_helpers

A boy was given a knife. He was told "this is a sharp knife," but then when he tried to cut something with it, like a piece of meat or something, it didn't really work that well. And so the boy thought, "this knife isn't actually very good," but then the person who gave him the knife said "here...tilt it a little bit and do this other obscure thing with the way you're holding the knife", and lo and behold...the knife cut the meat.

Life and open source software sometimes give us knives that seem dull until we learn how to use them properly. And sometimes, knives just legitimately have problems with them. And sometimes, internet tutorials just give us bad advice on how to use the knife, but…

GoRails Screencasts 

Vue.js Trello Clone in Rails - Part 5

Improve the design of our Vue.js & Rails clone of Trello by making lists more visually distinct and setting up horizontal scrolling