Rubyland

news, opinion, tutorials, about ruby, aggregated
Sources About
Riding Rails 

Rails 6.1 RC2 and some enhancements

Hi, Wojtek from this side with a small set of changes since the last week.

Rails 6.1 RC2 released

The second release candidate for Rails 6.1 has been released and brings a more robust experience for those already trying this version.

Add option for “default_scope” to run on all queries

This change allows for applications to optionally run a default_scope
on update and delete queries in addition to current behavior on get and insert statements, by adding all_queries: true.

Add “id” and “field_id” methods to FormBuilder

Ease generating consistent DOM ids in given form context.

New default for “local” option on “form_with”

With Rails 6.1 version form_with will generate non-remote…

Remote Ruby 

Bridgetown, APIStruct, Hashie, and generating PDF forms in Rails

[00:05:05] What’s new in Ruby and Rails Land?  Andrew announces RubyConf 2020 (virtual) is next week.
[00:09:20] Jason spun up a Bridgetown site with Tailwind and said it was fun. Andrew says he’s been playing around with it a lot this week and made a short video on how to add Tailwind, and he went full hog into Snowpack again. [00:10:12] Jason asks Andrew if he ever gut the Webpack setup in Bridgetown and replace it with a Snowpack setup. Andrew talks about the video he made (link below). Jason mentions how he found it really easy to deploy Bridgetown on Netlify and he’s excited to expand on it. [00:15:24] Andrew tells us the one thing with setting up Bridgetown and the way…
Everyday Rails 

Everyday Rails now uses Plausible for analytics

Why I've moved to the simple, privacy-focused Plausible for my visitor analytics needs.
Awesome Ruby Newsletter 

💎 Issue 237 - 1.5 the midpoint between 0 and infinity in Ruby

Ruby Weekly 

3 is the magic number

#530 — December 3, 2020

Read on the Web

Ruby Weekly

The 2020 Ruby Advent Calendar 2020 — An article per day about a Ruby gem. So far, local_time, elastic-enterprise-search and Blazer have been covered.

Best of Ruby Gems Series

Squash 'Unexpected end' Errors with syntax_search — How a misleading error and years of simmering frustration fueled Richard to create a handy gem that will show you the real error that’s occurring in your code.

Richard Schneeman

Free eBook: How to Get a 3x Performance Improvement on Your Postgres Database — Learn our best practices for optimizing Postgres query…

katafrakt's site 

Solving AOC#2 with Parslet

It’s December again and this means that another edition of Advent of Code is under way. Most of us have probably already solved day 3 challenge, but I want to go back a bit and show an alternative solution to Day 2: Password Philosophy.

tl;dr (for those who don’t want to read the whole backstory): you are given 1000 lines like these: 1-3 a: abcde. What it means is: an abcde string should contain between 1 and 3 letters a. You need to count for how many lines this is true.

For most of us probably an intuitive solution is to take each line, apply some regex (or even string splitting) on it, do some casting and checking on matches/split results, and, based on the result, increment some…

The Rails Tech Debt Blog 

How to Pitch a Rails Upgrade to Your Boss (Without Any Tech Speak)

If you’re a developer you know the reasons why you should be using the latest Rails framework. You understand the implications of performance gains, dependency issues and unsupported versions.

But these big picture benefits get lost in translation when talking to non-technical executives. What they need to know is the business case for an upgrade, how the work will translate into increased revenue.

So, here is an article to use or forward to communicate why an upgrade should be a priority. We also wrote an article on the more technical reasons if you are interested.

Old Rails = Decaying Equipment

At an overall level, using an old Rails framework is like a restaurant letting its…

Engine Yard Blog 

BALANCING DEVELOPER PRODUCTIVITY & CODE QUALITY

Balancing Developer Productivity andSoftware Quality

Engine Yard Blog 

Ruby On Rails Web Development

Honeybadger Developer Blog 

A big change: Accounts

I'm delighted to announce a change to Honeybadger that I've wanted to have for several years: Accounts. Now, it might be a head-scratcher for you that I would be excited about accounts, but it's true — I'm excited about launching a feature that is one of the more basic parts of a typical SaaS app.

Just in case you're thinking, "but you already have accounts — I'm logged in to mine right now!", then let me digress a bit. Yes, we already had what you can call a user account... the thing you log in to with your email address and password. This new thing that I'm calling accounts, though, is at an organizational level above users, or, in other words, a way to group of set of users together. In…

Scott Watermasysk 

Ruby Enumerable#tally

10+ years in, and Ruby continues to surprise me.

I am trying to complete the Advent of Code this year. For day two, I needed to be able to sum the number of items in an array.

array = ["a", "a", "b"]
# {"a" => 2, "b" => 1}

One of my favorite little Ruby hacks is setting the default value of Hash: Hash.new(0).

I have done something like this hundreds of times for quick counts:

array = ["a", "a", "b"]
hash = Hash.new(0)
array.each { |item| hash[item]+=1 }
# {"a" => 2, "b" => 1}

For the Advent of Code, I was curious if there was a good way to do this in one line[1] (no technical reason, just because...)

Not sure why, but it dawned on me this was likely something that Ruby would have built in…

Code with Jason 

Capybara expect page to have button

expect(page).to have_selector(:link_or_button, 'Button Text')

The post Capybara expect page to have button appeared first on Code with Jason.

Ruby Magic by AppSignal 

Building a Multi-tenant Ruby on Rails App With Subdomains

According to a definition of multitenancy, when an app serves multiple tenants, it means that there are a few groups of users who share common access to the software instance. An excellent example of an app that supports multitenancy is the Jira platform, where each company has its subdomain to access the software, for example, mycompany.atlassian.net.

In this article, I’m going to familiarize you with both theoretical and practical aspects of multitenancy. After discussing a few popular types of approaches to implement support for multiple tenants in your application, I will show you how you can implement two of them in your Rails application. We will build together a simple app with…

Ruby on Rails Podcast 

347: The Southwest Airlines of File Uploading with Colleen Schnettler

Colleen Schnettler is an independent Ruby on Rails developer and consultant. She just launched her first product, Simple File Upload, and was eager to answer all of Brittany's questions about it and her experience with Active Storage.

Links for this episode:

Brought to you by:

Command Line Heroes

Command Line Heroes is a podcast that tells the epic true tales of developers, programmers, hackers, geeks, and open…

Greater Than Code 

211: Becoming Humble and Kind with Brandon Weaver

01:16 - Brandon’s Superpower: Recognizing Others’ Superpowers and Spotting Potential Talent

  • Convincing Others
  • Recognizing and Talking About Failure(s)

09:23 - Brandon’s Personal Journey & Transformation Towards Humility

  • Wanting To Be Heard
  • Placing Identity
  • Developing Empathy
  • Speaking Candidly Re: Growth
  • Talking About Negatives in Your Past

25:40 - The Importance of Community and Community Leaders

34:35 - Being Kind vs Being Nice

  • Privilege

40:59 - Being Austistic and Being Visible

52:…

Engine Yard Blog 

Best Docker Container Tools and Resources

Docker is one of the fastest-growing technologies in 2020, and with good reason. Docker is a piece of software for performing virtualization. Essentially, Docker mimics the environment that an operating system provides. However, it uses containers to make sure these resources stand alone and are isolated from the settings, dependencies, and environment of the host machine. Containerization allows a developer to package up an application with all of the parts it needs, such as libraries and dependencies, and deploy it as one package. This package is then stored as a docker image. You can create Docker images using the following steps:

BigBinary Blog 

Setting up wild card SSL on heroku

Setting up wild card SSL on heroku can be complicated. Recently I had to set it up for a new domain and this time I recorded the whole process.

The ssl certificate in this example was bought from namecheap but the same process would apply for other vendors too.

The video of the whole process is available here.

Script to generate keys

$ openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server.csr

Script to generate ssl bundle

$ cat __neetohelp_net.crt __neetohelp_net.ca-bundle > ssl-bundle.crt

Note that the order of the crt and bundle files matters when combining them.

Secondly, as shown in the video, we might have to split the combined line. Now let’s examine the…

Riding Rails 

Rails 6.1 RC2: Horizontal Sharding, Multi-DB Improvements, Strict Loading, Destroy Associations in Background, Error Objects, and more!

The second release candidate for Rails 6.1 has been released and brings a more robust experience for those already trying this version. We’ve been hard at work tweaking and adjusting the nobs to have so using this version is a smooth ride to everyone. The final release is scheduled to happen next week.

It’s amazing how Rails has grown over the years and while we have some improvements to make to the onboarding process, Rails has never been better. The features in this release focus on adding the functionality you need to keep your application up and running for years to come.

Let’s look at some of the new functionality:

Multi-DB Improvements

Per-database Connection Switching

Rails 6.1…

RubyMine: The Ruby on Rails IDE – RubyMine Blog | JetBrains 

RubyMine 2020.3 Released

RubyMine 2020.3 released

RubyMine 2020.3 is now available!

To learn about all the new features, please visit our What’s New page. Here are some of the biggest highlights of this year’s last major release.

Git staging support

The long-awaited support for Git staging is here! Now you will be able to stage changes directly from the IDE.

Git staging

Interactive hints in the debugger

You can now click on interactive inline hints while debugging your application. These hints show all of a variable’s fields, and you can even update their values.

Interactive hints in the debugger

Improved user experience

RubyMine 2020.3 comes with a load of improvements for the user experience, including:

  • A redesigned Welcome screen.
  • The option to sync your IDE theme with your OS…
Schneems - Programming Practices, Performance, and Pedantry 

Squash Unexpected-End errors with syntax_search

Have you ever hit an error that you just plain hate? Back in 2006, I was learning to program Ruby and following an example from a book. I typed in what I saw, hit enter, and ran into a supremely frustrating error message:

Rails with Jason 

073 - [How I'd Build It] Building a Sailing Membership Feature with Adam Hawkins

This is another How I'd Build It episode, where listeners send in their feature requirements and we discuss them on the show. In this one we talk about a sailing application where there's a need to keep track of whether members' payments are up-to-date. Adam and I also talk about the YAGNI principle as well as why it's not possible to have high-quality code without tests.

Links:

All Ruby Podcasts by Devchat.tv 

RUBY 480: The Sounds of Silence: Lessons From an API Outage with Paul Zaich

Paul Zaich from Checkr tells us about a critical outage that occurred, what caused it and how they tracked down and fixed the issue. The conversation ranges through troubleshooting complex systems, building team culture, blameless post-mortems, and monitoring the right things to make sure your applications don't fail or alert you when they do.

Panel

  • Charles Max Wood
  • Dave Kimura
  • Luke Stutters

Guest

  • Paul Zaich

Links

Picks

Long live Ruby 

Gentle introduction to RSpec

Writing useful tests is as important as writing the right code. The good news is that with Ruby, testing the code is a friendly and grateful task. The bad news is that it might be a little hard for you if you never wrote a single line of code. However, once you understand why tests are needed and how to write efficient tests, it will become a habit to always assure good code coverage for things you create.
The Bike Shed 

270: Both Nothing and Deeply Special

In this week's episode, Chris and Steph discuss redirecting requests for various hostnames to one canonical host, creating student personas to improve educational content, and walking away from failing tests. They also embark on a Hollywood themed tour of RSpec mocks, stubs, and spies, when to use each approach, and discuss the types of tests they do (or do not) write.


This episode is brought to you by:

  • ScoutAPM - Give Scout a try for free today and Scout will donate $5 to the open source project of your choice when you deploy
  • Remote Works Podcast

Sponsored By:

Julia Evans 

An attempt at implementing char-rnn with PyTorch

Hello! I spent a bunch of time in the last couple of weeks implementing a version of char-rnn with PyTorch. I’d never trained a neural network before so this seemed like a fun way to start.

The idea here (from The Unreasonable Effectiveness of Recurrent Neural Networks) is that you can train a character-based recurrent neural network on some text and get surprisingly good results.

I didn’t quite get the results I was hoping for, but I wanted to share some example code & results in case it’s useful to anyone else getting started with PyTorch and RNNs.

Here’s the Jupyter notebook with the code: char-rnn in PyTorch.ipynb. If you click “Open in Colab” at the top, you can open it in…

Riding Rails 

New Active Record and Action View capabilities, bug fixes and more!

Hello! Andy here, highlighting some of the contributions to Ruby on Rails over the last week. Let’s dive in!

Add where.associated to check association presence

The Changelog covers how to use where.associated to check for the presence of an association. This also mirrors where.missing.

Include stylesheets, JS and ERB in stats

With this change, stats from the app/views and app/assets/stylesheets directories are now included with rails stats.

Add support for eager loading all rich text associations

Add the with_all_rich_text method to eager load all rich text associations on a model at once.

Bugfix: Preserve application time zone with travel_to

When parsing a time value as a string…

code.dblock.org | tech blog 

Migrating Classic Slack Ruby Bots to Granular Permissions

Slack recently introduced granular permissions and is now requiring all new apps to use those. The old apps are called classic apps, and new apps are called … apps. Slack also provided a migration guide.

As of December 4th, 2020 Slack no longer accept resubmissions from apps that are not using granular permissions. On November 18, 2021 Slack will start delisting apps that have not migrated to use granular permissions. So you better get going with a migration ASAP.

I found the migration quite challenging for my many real-time bots with existing customers. New bots cannot use real-time, and there’s no way to automatically migrate existing installations - users must reinstall a newer…

AkitaOnRails.com 

[Akitando] #87 Turing Complete, Emuladores e o Chip ARM M1

DESCRIÇÃO

Continuando o assunto sobre máquinas de Turing hoje resolvi pegar parte do material que eu cortei do episódio anterior e aproveitar o lançamento do chip Apple M1 pra dar uma introdução ao assunto de emuladores usando aspectos das diferenças de arquitetura RISC/CISC e como ARM e x86 se comparam.

Índice:

00:00 - Introdução 01:10 - Turing Complete 09:37 - Doom roda em QUALQUER lugar :-) 11:58 - Apple M1 / ARM x x86 21:40 - Pirataria

ERRATA:

No teste de gravidez, eu não prestei atenção e deixei passar que na verdade o @foone teve que trocar alguns componentes então o teste de gravidez não foi usado 100% como veio de fábrica e portanto NÃO, ele não é um computador universal…

Engine Yard Blog 

Docker Vs Virtual Machines Explained

Docker is a software solution for performing virtualization. With so many eyes on this cloud computing technology, it is hard to distinguish between Docker containers and virtual machines as two different technologies. 

Ruby Yagi 🐐 

Automatically migrate database when pushing to Heroku

Heroku makes deploying Ruby web app a breeze, however it doesn’t run rake db:migrate automatically each time you push a new commit to it.

You might have seen the error screen below after deploying your Rails app on Heroku:

error

I used to freak out when seeing this, but most of the time it is caused by me forgetting to run rake db:migrate after deploying a feature which has new database migrations.

If you view logs of the app, and see there’s an error saying ‘relation “table_name” does not exist’ , it means the database migration is not run hence no table is created.

log saying table name does not exist

Wouldn’t it be good if there’s a way to tell Heroku to automatically run “rake db:migrate” after each git push? 🤔

Heroku…

avdi.codes 

Why you shouldn’t inherit from Ruby’s core classes (and what to do instead)

Sooner or later you’ll want to subclass Ruby’s String, Array, or Hash. In this now-free RubyTapas video, you’ll learn why that’s a bad idea… and what to do instead.

Director’s commentary: This was originally published as RubyTapas episode #18 in November 2012. I think this one actually holds up pretty well in terms of script and pacing. And a quick IRB investigation seems to indicate that the demonstrated behavior is still true in Ruby 2.7.1: adding two Array subclasses with the + operator returns a raw Array.

Here’s the video, and beneath it you’ll find the script and code.


Sooner or later you will find yourself wanting a data structure which is almost, but not…

All Ruby Podcasts by Devchat.tv 

BONUS: How to do LARGE Volumes of HIGH Quality Work - While Spending Fewer Hours Working

 

Get the Black Friday/Cyber Monday "Double Your Productivity by 5pm Today" Deal
Coupon Code: "DEEP" for a GIANT discount

Mani provides us with strategies and tactics to get Deep Work time and how to get our minds into that focused state for hours at a time.

He has read hundreds of books that have taught him the secrets to getting more done by getting into this state.

He starts by telling us how he was passed over for a promotion at Qualcomm in favor of someone younger and less experienced and how that inspired him to figure out what the other guy was doing differently. He learned that he needed to get more done with the time he was spending on his projects.

The trick? Deep…

RubyMine: The Ruby on Rails IDE – RubyMine Blog | JetBrains 

RubyMine 2020.3 Release Candidate

RubyMine 2020.3 Release Candidate is now available! This build adds some finishing touches in preparation for the final release.
To catch up on what has already been implemented in v2020.3, check out our previous EAP blog posts. In this post, we’ll talk about a couple of features that we haven’t announced yet.

LightEdit improvements

We introduced LightEdit mode in v2020.1 as a lightweight text editor that comes with RubyMine. Since then, we’ve been polishing it for a better user experience.

LightEdit mode in v2020.3 is now independent of other IDE sessions and has a separate launch script option.
Launching from the command line has changed a bit:

  • If…
Remote Ruby 

Modernizing A Community Is Hard

[00:00:34] Jason and Chris chat about voting, election, and COVID. Chris mentions a GitHub repository that posts the election votes in real time. 
[00:9:56] Chris tells us there is good news on the horizon with Ruby 3.0 and Rails 6.1 coming out soon, and the guys chat about the changes. [00:13:10] Jason is curious on Chris and Andrew’s thoughts on how Turbolinks is going to affect the adoption and the use of StimulusReflex. [00:19:37] Andrew talks about how the messaging around Turbolinks has never been as good as it could have been. Chris talks about the biggest flaws with Turbolinks and Stimulus. [00:23:30] Jason touches on something deeper talking about people contributing to…
EquiValent 

Ubuntu OpenSSH Server config

Generate ssh key

ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

Install ssh server

sudo apt install openssh-client

sudo apt install openssh-server

Add public key

Add public key from laptop you want to login (cat .ssh/id_rsa.pub) to server you want to ssh with key.

To do that on server open: .ssh/authorized_keys (if it doesn’t exist create new file)

vim ~/.ssh/authorized_keys

Paste in there the content of your laptop’s .ssh/id_rsa.pub & save

note: there are 2 online tools dead drop & msg drop that will make your life easier if you…

Awesome Ruby Newsletter 

💎 Issue 236 - Component based web UIs in pure Ruby

John Nunemaker 

Imgproxy is Amazing

One of the cruftiest pieces of the Box Out rails app was file previews (for customer uploads and created graphics). Background jobs, backups, errors, and waiting are all bemoaned and later stupified (sorry I just watched Harry Potter) in this post.

The Needles: So prickly…

Here is a quick overview of the flow (so you can feel the pain):

  1. Our file uploads and created graphics go direct to AWS S3, but we needed previews for the images and movies so we could show them in the UI.
  2. Needing previews meant after the upload succeeded, we would enqueue a background job. The job would download the original file, resize it, and then upload the preview to S3.
  3. Needing a background job to…
Ruby Weekly 

How fast are Ruby 3.0's Ractors

#529 — November 26, 2020

Read on the Web

Ruby Weekly

Static Typing for Ruby and Adopting Sorbet at Scale — A walkthrough of the process Shopify followed to support developers and measure their progress toward static typing with Sorbet. In the second part, Adopting Sorbet at Scale, they dig more into the technicalities of the benefits obtained.

Shopify

Moving My Serverless Project to Ruby on Rails — When your serverless project grows from one function, to two, then to a whole collection of them, the complexity grows too, and using something more integrated like Rails might suit you better after all.

Alex…

All Ruby Podcasts by Devchat.tv 

RUBY 479: Mistakes Were Made with Jesse Spevack

Jesse Spevack tells us about a conference topic he gave where big mistakes were made at his company. Having lived through the choices that they made, we chat about the lessons learned.

Links

Picks

Luke

Amerliorated Windows 10

John -

Dave -

Jesse -

RubyMine: The Ruby on Rails IDE – RubyMine Blog | JetBrains 

RubyMine 2020.2.4 Is Available

RubyMine 2020.2.4, a bug-fix update for v2020.2, is now available!

You can update to it using the Toolbox App or right from inside the IDE. You can also download RubyMine 2020.2.4 from our website.

You’ll find the following improvements in this update:

  • Fixed an issue with opening projects on macOS Big Sur: JBR-2879
  • Fixed an issue with the Markdown editor: JBR-2866
  • Fixed a couple of issues causing IDE crashes: JBR-2746, JBR-2562

Check out the release notes for the complete list of closed tickets. And, as always, please report any issues you find.

Happy developing!
The RubyMine team

EquiValent 

ImageMagic cache resources exhausted

We are living in a age of ridiculous smartphone cameras. Chances are you will see user uploading 108 Megapixel images and your ImageMagic crushing when processing it.


convert source.jpg  -auto-orient -auto-orient -rotate 0 -resize 1024x1024 destination.jpg


convert-im6.q16: DistributedPixelCache '127.0.0.1' @ error/distribute-cache.c/ConnectPixelCacheServer/244.
convert-im6.q16: cache resources exhausted `source.jpg' @ error/cache.c/OpenPixelCache/3984.
convert-im6.q16: DistributedPixelCache '127.0.0.1' @ error/distribute-cache.c/ConnectPixelCacheServer/244.
convert-im6.q16: cache resources exhausted `source.jpg' @ error/cache.c/OpenPixelCache/3984.

Solution

open file /etc/ImageMag…

Drifting Ruby Screencasts 

A Rubyist's Apple M1 Review

A broad look into the Apple M1 from the perspective of a Ruby Developer. We look at a lot of the different aspects; Docker, asdf Ruby, Visual Studio Code, and more.
John Nunemaker 

Imgproxy is Amazing

One of the cruftiest pieces of the Box Out rails app was file previews (for customer uploads and created graphics). Background jobs, backups, errors, and waiting are all bemoaned and later stupified (sorry I just watched Harry Potter) in this post.

The Needles: So prickly…

Here is a quick overview of the flow (so you can feel the pain):

  1. Our file uploads and created graphics go direct to AWS S3, but we needed previews for the images and movies so we could show them in the UI.
  2. Needing previews meant after the upload succeeded, we would enqueue a background job. The job would download the original file, resize it, and then upload the preview to S3.
  3. Needing a background job to generate previews…
Honeybadger Developer Blog 

Understanding Object Instantiation and Metaclasses in Python

In this article, we will cover the object instantiation process followed by Python internally to create objects. I'll start with the fundamentals of object creation, and then we'll dive deep into understanding specific methods, such as __new__, __init__, and __call__. We will also understand the Metaclass in Python, along with its role in the object creation process. Although these are advanced topics, the article explains each topic step-by-step and from scratch so that even beginners can understand it.

Please note that this article is written with Python3 in mind.

Table of Contents

Riding Rails 

Bugfixes, improvements and more!

Hey, this is Greg, bringing you the latest news about Ruby on Rails!

Fix db:schema:load when table definition contains partitions

This PR fixes a bug with loading the schema to MySQL if the schema contains table definitions with partitions.

Add strict loading to Active Storage

The strict_loading option has been added to Active Storage, you can enable it like this:

has_one_attached :logo, strict_loading: true
has_many_attached :images, strict_loading: true

Fixed odd behavior of inverse_of with multiple belongs_to to the same class

An issue was introduced when foreign key validation was added to automatic_inverse_of and it is fixed by this PR. You can find an example and detailed…

Ruby on Rails Podcast 

345: Packwerk with Maple Ong

Maple Ong is a health researcher turned software developer. She currently works on the Modular Monolith team at Shopify. Maple helped develop and open source Packwerk, a Ruby gem to enforce modularity in Rails applications.

Links for this episode:

Brought to you by:

Headspace

You deserve to feel happier, and Headspace is meditation made simple.

That’s headspace.com/rails for a free one month…

Ruby on Rails Podcast 

346: Elixir and Phoenix with Jesse Herrick

Jesse Herrick is a software engineer based in Columbus, Ohio at Little Lines, a RoR development company. Jesse often works in Rails for work, but his main software passion is Elixir and Phoenix. He dazzles Brittany with how great Phoenix LiveView is.

Links for this episode:

Brought to you by:

Headspace

You deserve to feel happier, and Headspace is meditation made simple.

That’s headspace.com/rails for a free one month trial with access…

Greater Than Code 

210: Getting Sh*t Done with Harini Gokul

01:30 - Harini’s Superpower: Getting Sh*t Done

04:19 - Putting Technology to Use For Those Who Need it the Most

  • Co-Creation and Co-Shaping
  • Public & Private Partnerships
  • Breaking Barriers to Entry

14:04 - Crisis Management and Rethinking Blueprints

  • Life After COVID / Reframing Crisis As Opportunity
  • Creating Space / Amplifying Others
  • Leadership Perspective

39:45 - Duality: Humans As Interconnected Systems

  • Solidarity and Humanity
  • Facade Breaking
  • Rationality
  • Empathetic Leadership

48:16 - What do we do now (to get sh*t done)?

  • Storytelling
  • D&I (Diversity & Inclusion)
  • Futureproofing Education and Skilling

Reflections:

Amy: If we end up back where we were pre-pandemic,…

Planet Argon Blog 

When Should You Upgrade Your Rails Application?

When Should You Upgrade Your Rails Application?

Is your application running on an at-risk version of Ruby on Rails? Let's discuss the risks and organize a remediation plan.

Continue Reading

BigBinary Blog 

Using Cloudfront CDN to reduce asset delivery time from 30 seconds to 3 seconds

AceInvoice, one of BigBinary’s products, was facing high page load times. AceInvoice is a React.js application, and the size of application.js has gone up to 689kB compressed. Folks from India would sometimes have to wait up to 30 whole seconds for the application.js to load.

AceInvoice is hosted at heroku. Heroku serves assets from a limited number of servers in select locations. The farther you are from these servers, the higher the latency of asset delivery. This is where a CDN like Cloudfront can help.

How does Cloudfront work?

Simply stated CDNs are like caches. CDNs caches recently viewed items and then these CDNs can access stuff from the cache at great speeds.

Let’s take a…

Rails with Jason 

072 - Release Toggles, Feature Branches and Continuous Deployment with Matt Swanson

It's commonly accepted that it's better to deploy frequently than to only deploy once in a while. However, an obstacle to achieving this ideal is when you have a long-running feature that can't be released until it's all the way done. In this episode Matt Swanson and I talk about the solution to this problem: release toggles, also known as feature flags.

Links:

ruby – Bibliographic Wilderness 

Are you talking to Heroku redis in cleartext or SSL?

In “typical” Redis installation, you might be talking to redis on localhost or on a private network, and clients typically talk to redis in cleartext. Redis doesn’t even natively support communications over SSL. (Or maybe it does now with redis6?)

However, the Heroku redis add-on (the one from Heroku itself) supports SSL connections via “Stunnel”, a tool popular with other redis users use to get SSL redis connections too. (Or maybe via native redis with redis6? Not sure if you’d know the difference, or if it matters).

There are heroku docs on all of this which say:

While you can connect to Heroku Redis without the Stunnel buildpack, it is not recommend. The data traveling over…

Ruby Together News 

October 2020 Monthly Update

Hello! Welcome to the monthly update. During October, our work was supported by Zendesk, Bleacher Report, Stitch Fix, and many others.

ruby together news

In October, Ruby Together was supported by 43 different companies, including Ruby member Zendesk and Sapphire member Stripe. 5 companies joined as new members.

On top of those companies, 5 new developers signed up as members, including Aleksandar Krastev, Exequiel Rozas, and Joel Hawksley. In total, we were supported by 104 developer members. Thanks to all of our members for making everything that we do possible. <3

rubygems news

In October we released Bundler version 2.2.0.rc.2 and RubyGems version 3.2.0.rc.2.

In addition to…

EquiValent 

Pitfalls of Rails db transactions

Rollback Rails transaction and rescue error to display it

good:

This is fine

record = MyModel.last
error_for_user = nil

begin
  ActiveRecord::Base.transaction do
    # ...
    record.save!
  end
rescue ActiveRecord::RecordInvalid => e
  # do something with exception here
  error_for_user = "Sorry your transaction failed. Reason: #{e}"
end

puts error_for_user || "Success"

source, source2, source3

This is ok as well, but pls realize StandardError is base for many errors that may happen not related to valid record

record = MyModel.last
error_for_user = nil

begin
  ActiveRecord::Base.transaction do
    # ...
    record.save!
  end
rescue StandardError => e
  # do something with…
The Rails Tech Debt Blog 

How Fast are Ractors?

Ruby 3x3 is coming in about a month. One of its new concurrency primitives is Ractors, which used to be called "Guilds." (The other new concurrency primitive is Autofibers.)

Ruby has a Global VM Lock (GVL), also called the Global Interpreter Lock (GIL), that prevents running Ruby code in more than one thread at once. So Ruby threads are great for I/O like waiting on files or databases. And they're great for cases where a C extension can keep calculating in a background thread while a foreground thread runs Ruby. But you can't do calculations in Ruby in more than one thread at once within the same process.

At least not until Ruby 3 and not without Ractors.

Great! Now how fast is the…

Engine Yard Blog 

Migrating from Engine Yard Cloud to Engine Yard Kontainers

 

Mike Perham 

Running Ruby on RISC-V

With the release of the new arm64 architecture M1 Macbooks, I started wondering about x86 alternatives and came across RISC-V. RISC-V is an open source ISA (the set of instructions documented by a CPU) which does not cost anything to use. Anyone can take the ISA, build a chip which implements the ISA and then any software compiled for RISC-V will run on that chip. Several generations of RISC ISAs were created at UC Berkeley in the 1980s; RISC-V denotes their fifth generation ISA.
EquiValent 

How to store image width & height in Rails ActiveStorage

According to ActiveStorage Overview Guild there is already existing solution image.file.analyze and image.file.analyze_later (docs ) which uses ActiveStorage::Analyzer::ImageAnalyzer

According to #analyze docs :

New blobs are automatically and asynchronously analyzed via analyze_later when they’re attached for the first time.

That means Given model like this:

class Image < ApplicationRecord
  has_one_attached :file
end

…you can access your image dimensions with:

image.file.metadata
#=> {"identified"=>true, "width"=>2448, "height"=>3264, "analyzed"=>true}

image.file.metadata['width']
image.file.metadata['height']

So your model can look like:

class Image < ApplicationRecord
 …
GoRails Screencasts 

Continuous Deployment with Rails & GitHub Actions

Continuous Deployment is the automation of deploying any code that gets merged into your main or release branch. We can easily set up GitHub Actions to run CI and CD for us to automate everything.
Ruby Yagi 🐐 

Introduction to API testing using RSpec Request Spec

If you are new to Rails testing and RSpec, I recommend going through the beginner tutorial for Rails testing using RSpec and Capybara before proceeding with this tutorial. RSpec is the testing framework we will be using for this tutorial.

Sometimes your Rails app might have API endpoints exposed for mobile apps, separate web frontend like React or even for third party to consume, it is important to write test for these API endpoints to ensure they are returning the correct response and also perform actions as specified.

For this tutorial, we will create a Rails app with API mode (no UI) and write specs to test the API endpoints, you can use your own Rails app and follow along as long as…

Julia Evans 

New zine: Hell Yes! CSS!

Hello! Last Friday I released a new zine called Hell Yes! CSS!

You can get it for $12 here: https://wizardzines.com/zines/css, or get a 9-pack of all my zines here for $88.

Here’s the cover and table of contents:

why CSS?

I’ve been writing CSS on and off (mostly off) for about 15 years. For almost all of that time, CSS really felt impossible to me – every time I did a seemingly simple task (like the classic “center a div”), I had to Google how to do it, then it wouldn’t work the way I expected, than I’d change random things, and eventually the thing would kind of sort of work. Then I’d never really internalize what I’d learned and I’d start again from scratch the next time. I…

Soulcutter 

My Dad’s Hamburgers

I think I make Pretty Good Hamburgers. My ‘recipe’ is something my dad taught me. It’s simple but effective – there are definitely more-refined burgers out there, but this is the Keep It Simple way to make a good burger. Follow these instructions:

  1. Obtain fresh 80% lean, 20% fat ground beef.
    • 450 grams (1 pound) makes 4 patties.
    • 900 grams (2 pounds) makes 7 patties.
    • The math doesn’t make sense, it just is.
  2. Separate beef into patties equal sizes according to the guidance above.
    • You don’t have to measure this, eyeballing it is fine.
    • Don’t over-smush the meat. If you can preserve the grain from how the beef was ground it gives the hamburger a…
ruby on Occasionally consistent 

Ruby Symbol to Proc explained, the short version

What does an ampersand followed by a symbol as an argument to a ruby method actually do? It creates a proc.
Julia Evans 

Day 10: Training an RNN to count to three

Yesterday I was trying to train an RNN to generate English that sounds kind of like Shakespeare. That was not working, so today I instead tried to do something MUCH simpler: train an RNN to generate sequences like

0 1 2 0 1 2 0 1 2 0 1 2

and slightly more complicated sequences like

0 1 2 1 0 1 2 1 0 1 2 1 0 1 2 1 0

I used (I think) the exact same RNN that I couldn’t get to work yesterday to generate English by training it on Shakespeare, so it was cool to see that I could at least use it for this much simpler task (memorize short sequences of numbers).

the jupyter notebook

It’s late so I won’t explain all the code in this blog post, but here’s the PyTorch code I wrote to train the…

Tom Dalling 

Consistent Hammer Man

This is a short parable I came up while discussing linters, in response to someone asking if I think it’s good to be inconsistent.

avdi.codes 

Safely Call Superclass Methods from Ruby Modules

In today’s RubyTapas throwback, we tackle a metaprogramming topic. How do you reliably call superclass methods from included modules… when you can’t know for sure if those methods exist, or if they have been overridden out from under you? This video and article will show you some techniques you can use.

Director’s commentary: This was originally published on RubyTapas October 29th, 2012. The metaprogramming techniques shown here are still valid, if rarely needed. The video quality, on the other hand, makes me cringe… I wasn’t nearly as good at pacing back then, and I had a lot more tolerance for “whoopsies” in a three-minute video.

By the way, if you want to learn more about this…

RubyMine: The Ruby on Rails IDE – RubyMine Blog | JetBrains 

RubyMine 2020.3 Beta 2: Support for Ruby 3.0, Code With Me, and More!

RubyMine 2020.3 Beta 2

As our Early Access Program is coming to an end, we are happy to announce that RubyMine 2020.3 Beta 2 is now available! While we are adding the finishing touches to the last major release of 2020, here are some more details about the improvements you will get in 2020.3:

Support for the upcoming Ruby 3.0 release

With the long-awaited release of Ruby 3.0 coming closer, we’re working on having support ready for it in RubyMine as soon as it gets here.

RubyMine 2020.3 will already…

Remote Ruby 

Reimagined Rails views using Matestack with Jonas Jabari

[00:00:48] The guys catch up on what’s been going on this week. Chris tells us he’s been using Jumpstart in rebuilding Hatchbox this week. Andrew has been on PTO all week, so he’s been chilling, cleaning, and in the middle of refactoring. Jason tells us about a call he got from someone who had signed up for HopeGrid.
[00:07:22] Jonas tells us about himself and what Matestack is. [00:10:38] Find out how Matestack is different from View Component or a traditional kind of component type gem.  [00:12:34] Jonas explains what the Component UI’s written in Ruby look like.
[00:15:09] Chris asks Jonas if the responses are rendered in the JavaScript or is it actually making an Ajax request to…
JetRockets 

Libraries & Licenses

Julia Evans 

Day 9: Generating a lot of nonsense with an RNN

Hello! On Monday I posted about generating faces with sketch-rnn, which I did using a pre-trained RNN model.

I want to train that model to genreate more complicated faces (which may or may not work!), but I decided that since I knew literally nothing about neural networks it would be good to start with something simpler: this char-rnn model from Karpathy that generates text that sounds vaguely Shakespearean.

After spending some time playing with Tensorflow, I decided to use PyTorch with the fast.ai helper libraries because it’s what my friend Ray was using for his project.

Here are some initial things I’ve learned about training neural networks. All of this is pretty disjointed and I…

Awesome Ruby Newsletter 

💎 Issue 235 - Why the Release of Ruby 3 Will Be Monumental

ruby – Bibliographic Wilderness 

Comparing performance of a Rails app on different Heroku formations

I develop a “digital collections” or “asset management” app, which manages and makes digitized historical objects and their descriptions available to the public, from the collections here at the Science History Institute.

The app receives relatively low level of traffic (according to Google Analytics, around 25K pageviews a month), although we want it to be able to handle spikes without falling down. It is not the most performance-optimized app, it does have some relatively slow responses and can be RAM-hungry. But it works adequately on our current infrastructure: Web traffic is handled on a single AWS EC2 t2.medium instance, with 10 passenger processes (free version of passenger, so…

zverok with ruby 

Fun with Ruby method argument defaults

Just yesterday I suddenly understood that there is a small neat trick, allowing to provide friendly error messages for missing method parameters:

# default way to do things:
def read_data(file)
  # ...
end

read_data('1.txt') # => works
read_data
# wrong number of arguments (given 0, expected 1) (ArgumentError)
# ^^ not really friendly

def read_data(file:)
  # ...
end

read_data
# missing keyword: file (ArgumentError)
# ^^ at least some hint of what was expected

# But how about this?
def read_data(file = raise(ArgumentError, '#read_data requires path to .txt file with data in proper format'))
  # ...
end

read_data
# #read_data requires path to .txt file with data in proper format…

Of course, it is not that useful with a simple method with one argument, but for complicated APIs with several keyword args, it might be of some use. But what I was pleasantly surprised with is how simple it is—and that it works.

How it works?

The argument = raise(...) is not some separate Ruby feature, but it is a natural consequence of two facts:

  1. You can put any Ruby expression as the argument’s…
Janko’s Blog 

Adding Authentication in Rails 6 with Rodauth

In this tutorial, we’ll show how to add fully functional authentication and account management functionality into a Rails 6 app, using the Rodauth authentication framework. Rodauth has many advantages over the mainstream alternatives such as Devise, Sorcery, Clearance, and Authlogic, see my previous article for an introduction.

We’ll be working with a fresh Rails app that has basic posts CRUD and Bootstrap installed:

$ git clone https://gitlab.com/janko-m/rails_bootstrap_starter.git rodauth_blog
$ cd rodauth_blog
$ bin/setup

Installing Rodauth

Let’s start by adding the rodauth-rails gem to our Gemfile:

$ bundle add rodauth-rails

Next, we’ll run the rodauth:install generator provided…

Ruby Weekly 

Benchmarking two high performance JSON parsers

#528 — November 19, 2020

Read on the Web

Such a busy week that we've had to bump a few items to next week! Nonetheless, thanks for all of your submissions – the Ruby ecosystem shows no sign of slowing down as we approach the Ruby 3.0 release 😄
___
Peter Cooper, your editor

Ruby Weekly

SuperDiff: View Differences Between Complex Data Structures in RSpec — When you’ve got something that’s expected and what actually came back, distinguishing the difference between them can be a pain. This attempts to make it easier... McFly???

Elliot Winkler

Setting Up Cypress, Rails, and CircleCI — If you’ve been in the…

Ruby Pigeon 

My Beef With RuboCop

Consider a hypothetical class that filters out unsafe HTML elements:

class SanitizingFilter < HTMLFilter
  def render_element(name, attrs, content)
    if safe?(name, attrs)
      super
    else
      nil
    end
  end
end

The default RuboCop settings would have us change it to this:

class SanitizingFilter < HTMLFilter
  def render_element(name, attrs, content)
    super if safe?(name, attrs)
  end
end

Let us feast on a three-course meal of opinion about why this is worse.

That nil Was Written For A Purpose

My first beef — the hors d’oeuvre, if you will — is that Style/EmptyElse wants us to change from an explicit nil return value to an implicit one. It says there is a…

Julia Evans 

Day 8: Start with something that works

Today at RC I’m a little stuck so here’s a very short reflection on how to do hard programming problems :)

I was talking to a friend yesterday about how to do programming projects that are a bit out of your comfort zone, and I realized that there’s a pattern to how I approach new-to-me topics! Here I’m especially thinking about little side projects where you want to get the thing done pretty efficiently.

When I start on a new project using some technology I haven’t worked with before, I often:

  1. Find some code on the internet that already does something a little like what I want
  2. Incrementally modify that code until it does what I want, often completely changing everything about the…

Here are a couple of quick thoughts about this process:

Honeybadger Developer Blog 

Exploring Merge Sort with Ruby

This is part 3 in a series looking at implementing various sorting algorithms with Ruby. Part 1 explored bubble sort, and part 2 explored selection sort.

As we've discussed in the previous posts in this series, understanding how to sort data is an integral part of any software engineer's toolkit. Luckily, most higher-level languages, like Ruby, already have built-in methods that are efficient in sorting arrays. For instance, when you call .sort on an array, you are using quicksort under the hood. In this post, we're going to learn a similar algorithm to quick sort -- merge sort. Both of these algorithms utilize a "divide and conquer approach." Merge sort was invented by John von Neumann…

Passenger - Phusion Blog 

Passenger 6.0.7

Passenger 6.0.7

Version 6.0.7 of the Passenger application server has been released. This release adds compatibility for Ubuntu Groovy, and addresses several regressions.

Passenger 6, introduced Generic Language Support, or: the ability to support any and all arbitrary apps.

Updates & improvements

  • Addresses regression introduced in 6.0.5 when attempting to establish database connection after fork and activerecord is not configured in the expected way. Closes GH-2281.
  • Addresses regression introduced in 5.1.5 where hook scripts would fail to run. As a result the PASSENGER_ERROR_PAGE and PASSENGER_CONFIG_MANIFEST env vars have been removed from the passenger hook script environment.
  • Match static rails assets…
Saeloun Blog 

Rails 6.1 adds support for destroying dependent associations in the background

The dependent: option which is built into Rails allows us to specify what happens to the associated records when their owner is destroyed.

Until now, the dependent: option accepted :destroy, :delete_all amongst other values.

:destroy and :delete_all are very similar with the only difference being :delete_all causes all the associated objects to be deleted directly from the database preventing any callbacks from being executed.

When we have a large system with multiple layered hierarchies of associated objects, cascading deletes might fail. A model could have associations that are destroyed which in turn trigger other deletions and this can continue down a complex tree. Such cascading…

Ruby in Source Diving on Medium 

A Fight to Deliver Apps to the Globe Faster

https://pixabay.com/photos/courier-night-panning-warsaw-1214227/

At Cookpad, we build a global community to make everyday cooking fun. We deliver an iOS app to the worldwide market that supports 26 languages and about 74 regions as of today. It is always challenging to develop and ship apps on that scale. Release management is vital to be able to deliver new features or bug fixes to our customers quickly and continuously. In order to do this, we automate our release flow with using fastlane, Jenkins, and Slack. Thanks to this automation, we have been able to do weekly release cycles for a while.

However, we have recently faced an issue where submission by fastlane's deliver was getting…

Ruby on Rails Podcast 

344: Strategic Programs & Arctic Code Vault @ Github with Kyle Daigle

Former host of the podcast, Kyle Daigle is a Senior Director of Strategic Programs at GitHub working on cross company projects to help GitHubbers and the developer community accomplish the best work of their life with GitHub. He and Brittany catchup and discuss the incredible Arctic Code Vault.

Links for this episode:

Brought to…

Ruby Magic by AppSignal 

Ruby on Rails Model Patterns and Anti-patterns

Welcome back to the second post in the Ruby on Rails Patterns and Anti-patterns series. In the last blog post, we went over what patterns and anti-patterns are in general. We also mentioned some of the most famous patterns and anti-patterns in the Rails world. In this blog post, we’ll go through a couple of Rails model anti-patterns and patterns.

If you’re struggling with models, this blog post is for you. We will quickly go through the process of putting your models on a diet and finish strongly with some things to avoid when writing migrations. Let’s jump right in.

Fat Overweight Models

When developing a Rails application, whether it’s a full-blown Rails website or an API, people tend to…

Ruby on Rails Podcast 

345: Packwerk with Maple Ong

Maple Ong is a health researcher turned software developer. She currently works on the Modular Monolith team at Shopify. Maple helped develop and open source Packwerk, a Ruby gem to enforce modularity in Rails applications.

Links for this episode:

Brought to you by:

Headspace

You deserve to feel happier, and Headspace is meditation made simple.

That’s headspace.com/rails for a free one month…

Greater Than Code 

209: Self-Identity and Parenting in Tech with Mia Mollie De Búrca

01:25 - Mia’s Superpower: Adaptability

  • Applicable Skills to Basic Computer Programming
    • Parsing Information
    • Research

05:31 - Linguistics and Cultural Anthropology

08:36 - Parenting While Having a Career in Tech

09:42 - Objectivity and Truth in Software Development

11:04 - Tech Parenthood (Cont’d)

  • Maternity Leave and Returning to Work
    • Part-Time Flexibility
    • “Keep-in-Touch Days”
  • Returning to Work as an Individual Experience
  • Discrimination & Stigma
  • Multitasking Expectations For All
  • Geographic Differences
  • Company Culture

24:21 - Tenure in Tech, Job-Hopping, and Juggling Parenthood

  • Parenting in View During the New…
Josh Software 

5 simple examples to understand Elasticsearch aggregation

Elasticsearch aggregation give us the ability to ask questions to our data. The ability to group and find out statistics (such as sum, average, min, max) on our data by using a simple search query.  In this post, we will see some very simple examples to understand how powerful and easy it is to use Elasticsearch … Continue reading 5 simple examples to understand Elasticsearch aggregation
Ruby – AWS Developer Blog 

AWS SDK For Ruby V2 Maintenance Mode Reminder

This is a reminder that AWS SDK For Ruby Version 2 will enter planned Maintenance Mode starting November 20, 2020. APIs and features released after that date will only be available in Version 3.

Upgrading from Version 2 to Version 3 is easy! If you haven’t migrated already, please see the V3 upgrading guide.

The full maintenance mode announcement includes additional details about the maintenance plan and migration steps. For more general information about our product lifecycle, please see the SDKs and Tools maintenance policy.

BigBinary Blog 

Rails 6.1 adds values_at attribute method for Active Record

This blog is part of our Rails 6.1 series.

Rails 6.1 simplifies retrieving values of attributes on the Active Record model instance by adding the values_at attribute method. This is similar to the values_at method in Hash and Array.

Let’s check out an example of extracting values from a User model instance.

class User < ApplicationRecord
  def full_name
    "#{self.first_name} #{self.last_name}"
  end
end

 >> user = User.new(first_name: 'Era', last_name: 'Das' , email: 'era@gmail.com')

=> User id: nil, first_name: "Era", last_name: "Das", created_at: nil, updated_at: nil, email: "era@gmail.com", password_digest: nil

Before Rails 6.1

As shown below using values_at for full_name, which…

Martian Chronicles, Evil Martians’ team blog 

Reusable development containers with Docker Compose and Dip

Author: Vladimir Dementyev, Lead Developer at Evil Martians

Run and test your code in multiple Docker environments with minimal effort while keeping Docker Compose files under control. Spend less time wrangling YAML and drop into a container of choice from any host folder with one simple command. See examples for Ruby, Node.js, or Erlang, and adapt them to your stack.

It all started with a new Mac. As a polyglot developer who works on commercial projects and maintains about a dozen popular open source libraries, I need to make sure that Ruby, Node.js, Go, and Erlang will co-exist on my machine with minimal hassle. I also need a way to switch easily between different contexts and…

Rails with Jason 

071 - Stripe Checkout with CJ Avilla, Developer Advocate at Stripe

In this episode I talk with CJ Avilla, Developer Advocate at Stripe about integrating Stripe with web applications using Stripe Checkout. We also digress into mechanical keyboards and the challenges of keeping APIs up to date.

Links:

All Ruby Podcasts by Devchat.tv 

RUBY 478: 2020 Ruby on Rails Community Survey Results

2,049 members of the Rails community from 92 countries kindly contributed their thoughts on tools, frameworks, and workflows in their day to day development lives. From these responses we hope to get an understanding of where Rails stands as a framework in 2020.

Sponsors

Panel

  • Dave Kimura
  • John Epperson
  • Charles Max Wood

Links

Picks

Chuck:

John Epperson:

Dave Kimura::

Engine Yard Blog 

Engine Yard’s Evolution: Support for Containers

Cloud infrastructure has become elastic, agile, and resource-efficient over the past decade - particularly with containerization and broad adoption of Docker and Kubernetes.

Alfredo Motta 

Not So Random Software #44 – Happiness, and LSTM networks

Hello everyone and welcome back to Not So Random Software! This week I have been thinking about memory and how the simple act of remembering …
The Bike Shed 

269: Things are Knowable (Gary Bernhardt)

Steph's taking a quick break this week, but while she's away, Chris is joined by special guest Gary Bernhardt. Gary is the creator of Destroy All Software screencasts as well as his more recent venture, Execute Program. Between Execute Program, his screencasts, conference talks, and more Gary has consistently provided some of the highest quality and most impactful educational content around building great software and has been a huge inspiration to the hosts of this show.

In the episode, Chris and Gary discuss Gary's recent work with TypeScript and how it compares with Gary's focus on testing, they revisit some of Gary's ideas around software architecture and how they map to his…

Julia Evans 

Day 5: drawing lots of faces with sketch-rnn

Hello! This week it’s generative art week at RC, and I thought it would be fun to generate drawings of faces.

Someone suggested the Google Quickdraw dataset, which has a lot of pictures of faces. And even though I think most of the faces in there are not really that interesting, I really quite like some of them, like these two:

So that seems like somewhere to start!

step 1: get the sketch-rnn model

sketch-rnn is an RNN trained on the quickdraw dataset that generates line drawings. You can see it in action in Monica Dinculescu’s very fun magic sketchpad demo here – you start making a drawing, and it’ll complete you drawing as a cat / bridge / whatever you want.

I figured that would…

Boring Rails: Skip the bullshit and ship fast 

Hacktoberfest Recap: Open source Ruby/Rails work in 2020

Hacktoberfest is a month long event that encourages developers to contribute to open source – submit four valid pull requests and you win a tshirt. Despite the criticisms and controversy this year, I’m a fan of the event and it did help motivate me to make some contributions.

I wanted to share a recap of my submissions for Hacktoberfest because I think it’s a good sampling of what options are available to folks looking to contribute to Ruby and Rails. There are lots of ways to give back outside of the main rails/rails repository!

My 2020 Hacktoberfest Contributions

ViewComponent

Repository: github/view_component

Pull request: Allow preview controller to be customized via config options

The view_component gem helps you…

RubyGems Blog 

October 2020 RubyGems Updates

Welcome to the RubyGems monthly update! As part of our efforts at Ruby Together, we publish a recap of the work that we’ve done the previous month. Read on to find out what updates were made to RubyGems, Ruby Toolbox and RubyGems.org in September.

RubyGems News

In October we released a new Bundler version — 2.2.0.rc.2 and RubyGems version — 3.2.0.rc.2.

We also made the following changes and improvements:

  • upgraded Bundler & RubyGems vendored Molinillo to 0.7.0 (it’s latest release). - #3402, #3388
  • fixed an issue with the specific_platform setting.
  • merged a PR that stops changing the CWD for building extensions, which should allow concurrent extension compilation without any…
avdi.codes 

SIGAVDI #89: Apple Pie Funnel Cake Edition

Hello friends,

There’s a shiny red convertible in my garage. Some mornings I look out the window and it’s sunny and bright and I think, what a perfect day to go for a drive. Then I discover that since the last time I took the car out, one tire has gone soft, the battery is dead, and someone (me) deposited three milk crates of old Dr. Dobbs’ Journals on the seats for lack of a better place to put them.

I don’t actually own a convertible, but that’s what this newsletter feels like sometimes. I want so badly to correspond to you but somehow I leave it juuuuuuust long enough to make it difficult to get started again.

Partly it’s the lack of time.…

Ruby Yagi 🐐 

Insert page specific CSS or JS using content_for

There might be cases where you want to insert some CSS or JS snippet into a specific page only , for example inserting Stripe JS and CSS only on the payment page, but not on other pages of the same controller.

If you insert the snippet into layout/application.html.erb , it will be available to all the pages, which might slow down the load time of other pages which doesn’t use the script!

<!-- app/views/layout/application.html.erb -->
<!DOCTYPE html>
<html>
  <head>
    <title>My awesome app</title>
    <%= csrf_meta_tags %>
    <%= csp_meta_tag %>

    <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
    <%= javascript_pack_tag 'application', 'data…
Saeloun Blog 

Rails 6.1 adds support for role switching and sharding in database.

Rails 6.1 adds the ability to switch a role or shard for an application with multiple databases. This means it is possible to switch connections for one database instead of all databases globally.

To use this feature we need to set the below config in our application

config.active_record.legacy_connection_handling = false

Let’s say we have two databases, primary and vehicles. And we have shards and replica configured for each of them in database.yml as below

production:
  primary:
    database: primary_database
    adapter: mysql
  primary_replica:
    database: primary_database
    adapter: mysql
    replica: true
  primary_shard_one:
    database: primary_shard_one
    adapter: mysql
Julia Evans 

How do you write simple explanations without sounding condescending?

Sumana Harihareswara wrote an interesting blog post Plain Language Choices recently, about writing about complicated topics using simple language and how it can sometimes come off as condescending.

I really like explaining complicated topics while trying to avoid unnecessary jargon, and I realized that I’ve thought a lot about how to do it well. So here are a bunch of things I try to do when I use simple language to avoid coming off as condescending.

use some jargon to give the reader search terms

Sometimes I see writing that completely avoids all jargon and instead substitutes simple language for all “jargon”-y words.

I like to include some jargon in my explanations because otherwise…

Kir Shatrov 

Organizations and layers of abstraction

This post is a reflection on being part of making a maturing infrastructure organization for nearly five years.

When I joined Production Engineering at Shopify, it was barely 30 people. We went for a team dinner around that time and I remember how my manager paid for it with his credit card because points. Now we are at >200 people, and at the last pre-pandemic offsite we had a huge ballroom booked for the dinner. Clearly it wasn’t billed to an individual’s credit card.

Through my there years there, I’ve seen how we’ve solved scalability and growth by introducing boundaries and new levels of abstraction.

Now that I’m noticing this pattern at other companies too, I believe that managing…

Saeloun Blog 

Rails 6.1 allows attribute's default to be configured but keeping its type

Rails allows us to change the type and set the default value of the attribute.

Let’s consider Message class with sent_at attribute of type datetime.

class Message
end

> Message.type_for_attribute(:sent_at)
=> <ActiveRecord::Type::DateTime:0x00007fa01c1fd650 @precision=6, @scale=nil, @limit=nil>
> Message.new.sent_at
=> nil

We can change the sent_at attribute’s type to integer in the following way:

class Message
  attribute :sent_at, :integer
end

> Message.type_for_attribute(:sent_at)
=> <ActiveModel::Type::Integer:0x00007fa01bd86ba8 @precision=nil, @scale=nil, @limit=nil, @range=-2147483648...2147483648>

We can also set the default value by providing a default option:

class Message
OmbuLabs Blog 

Cross-Browser Mobile Web Apps (Snap Minis Part 2)

In keeping with the first part of this series, I'll list a few interesting issues we found when making the apps work as similar as possible for Android's webview and iOS' webview.

Some of these issues are related to mobile web development in general, it's not something specific to Snap Minis but Snapchat uses the native webview components to display your Mini. Since you'll want your Mini to work properly for all users you'll have to make fixes for specific issues you may encounter for each webview implementation.

Android uses Chrome by default for the webview, but it is different than desktop Chrome. iOS uses Safari for the webview, but it is also different than desktop Safari. Keep in…

Riding Rails 

Enhanced strict loading, multiple databases and more!

Hi, Wojtek from this side with a summary of the latest changes that will be available in the upcoming Rails 6.1.

Rails 6.1 RC1 released

Release candidate of Rails 6.1 is ready for testing.

Enhance strict loading to log violations

This change allows for an application to optionally log instead of raise when using strict_loading.

Add connected_to_many for multiple databases

This would come in especially handy for deeper nesting past 2 databases when declaring connections.

Add request exclusion to host authorization

Host authorization checks can be skipped for specific requests. This allows for health check requests to be permitted for requests with missing or non-matching host headers.

Remote Ruby 

Webpacker in Engines & Dealing with Burnout

[00:01:25] Chris talks about going down the rabbit hole since their discussion last week about Webpacker and Rails Engines which was on his to-do list, and he finds out it is rough.
[00:05:31] Andrew asks Chris if there was anything in the Webpack or Docs that made him think that maybe he should add this, or did he already cover it and he explains.
[00:07:46] Chris explains a problem he ran into with JavaScript and CSS to display graphs and about using a JavaScript pack tag in the Main Rails App.
[00:14:17] Chris tells us why he loves Devise and Andrew asks how long Chris thinks it will be before we are going to be able to see madmin and installing Action Active Mailbox is…
Awesome Ruby Newsletter 

💎 Issue 234 - Why Shopify's engineering team stuck with Ruby when rewriting their storefront

Ruby Weekly 

A Ruby quine that cycles through 128 languages

#527 — November 12, 2020

Read on the Web

Ruby Weekly

Listen: 'Listens' to File Modifications and Notifies You About The Changes — OS-optimized on each of macOS, Linux, BSD and Windows, and can detect file modification, creation or deletion in one or more directories. With v3.3.0 out this week, it's great to see a mature library continue to develop and become more resilient with initial Ruby 3 and TruffleRuby support.

Guard

How to GraphQL with Ruby, Rails, Active Record, and No N+1 — These Martians are big GraphQL fans and know a lot about using it with Rails. Dmitry explains the ins-and-outs of several…

Soulcutter 

Ruby Refinements Have One Good Use Case

Preface

This article is not going to explain what Ruby refinements are. I do not assume that all Rubyists know what they are - in the 10 years since they have been a part of Ruby, real life usages are astonishingly rare. If you are aware that they exist, you still may not be at-all familiar with how they work. There are many good articles available to explain what Ruby refinements are: for a clear and concise explanation of how refinements work, I suggest Starr Horne’s article Understanding Ruby Refinements and Lexical Scope. For a thorough explanation I recommend the transcript of James Adam’s RubyConf talk titled Why Is Nobody Using Refinements?. It’s quite long and in a challenging…

Julia Evans 

Day 3: an infinitely tall fridge

Hello! Here are some notes from Day 3 at the Recurse Center.

This post is an extremely short one from the toy refrigerator poetry forum website I’m working on. I needed to come up with a design for it, and finally today I came up with an idea: just put everything on an image of a fridge.

I found a stock image of a fridge, but I ran into a problem immediately, which was that the entire website could not fit on said fridge image.

So I figured how to make a fridge that was as tall as I wanted it to be. (not technically “infinite”, but “a fridge that is as big as required” didn’t have quite the same ring).

here’s the infinite fridge

Here’s a CodePen with the HTML/CSS required to make an…