1) Create on the remote server a
# on the server, as a root user $ adduser deploy $ adduser deploy sudo
2) Make sure that you can login to the server as a
deploy user without password prompt:
It assumes that you have ssh keypair already (
~/.ssh/id_rsa.pub) on your desktop.
# on the desktop $ ssh-add $ ssh-copy-id deploy@deploy_server_ip # Now try to login to the server as deploy user: $ ssh deploy@deploy_server_ip
If it didn’t work, and you get message like
Permission denied (publickey), it seems like password authentication disabled by default on your server (which is a good thing actually). Login to the server as a
rootagain, then login to …
The second beta of Rails 6 is about to ship, and includes Zeitwerk integration.
While Rails 6 final is going to have proper documentation about it, this post will help understanding this feature meanwhile.
You can now robustly use constant paths in class and module definitions:
# Autoloading in this class' body matches Ruby semantics now. class Admin::UsersController < ApplicationController # ... end
All known use cases of
require_dependencyhave been eliminated.
Edge cases in which the autoloaded constant depended on execution order are gone.
Autoloading is thread-safe in general, not just for the currently supported use cases…
Also, applications get some performance benefits for the same price:
Autoloading a constant no longer involves walking autoload paths looking for a relative match in the file system. Zeitwerk does one…
In this article I will show you what is in my opinion the most productive way how to work with your desktop environment.
It is about using existing tool currently available in most of the operating systems called workspaces
Desktop Workspaces are designed to hold multiple applications in different contexts. Point I’ll try to make is about how you organize and access these applications in relation to their responsibilities in the most productive way.
In order to present you this flow I’ll show you how I use workspaces in daily professional life.
Here is a quick video Demonstration (youtube)
Every workspace is dedicated to single purpose
In my daily setup I use 6 workspaces which…
After working as a teacher and translator for several years, Emily embarked on a new phase in her career by learning a different kind of language: programming.
Emily has worked at Drivy for the past year and a half as a Full-Stack Engineer, after attending the intensive Le Wagon bootcamp in Paris. Here, she shares how she began coding and what life is like for a developer at Drivy.
If you’re considering a career change to become a software engineer, hopefully Emily’s story will inspire you to go for it.
What were you doing before you became a software engineer?
I studied modern languages and translation, and after university worked as a teacher and translator. My freelance translation…
On this week's episode, Chris is joined by German Velasco for a conversation that fully lives up to the name of the show with plenty of opinions and impressively deep dives on topics that folks outside the world of programming would never think could warrant this much discussion.
How much duplication should we have? Is there such a thing as too DRY? Is there ever a need for code comments, really? Lest you worry that Chris & German spend the whole episode just volleying opinions, have no fear: the episode is balanced out with plenty of pointed suggestions and useful anecdotes to make sure everyone will enjoy it.
John Arundel is a consultant and author of Cloud Native DevOps with Kubernetes. We spoke with John on how adopting DevOps destroys walls, builds bridges, and influences company cultures for the better.
You’ve just co-authored (with Justin Domingus) a book entitled “Cloud Native DevOps with Kubernetes: Building, Deploying, and Scaling Modern Applications in the Cloud.” From the description of the book, it looks like it can take you from zero to hero in building and scaling apps the Kubernetes way. What do you think makes this book stand out from other books on the topic available on the market?
It’s the book that Justin and I wish we’d had when we started trying to deploy real apps on…
#438 — February 21, 2019
Some 'Unnoticed' Features of Rails 6 — There’s a sizable number of changes coming to Rails 6 (which is already in beta) that aren’t getting the limelight, such as host whitelisting, new migration features, and tons of time and date syntactical sugar.
Work on a Register Transfer Language (RTL) for CRuby — A detailed and rather low level article on the performance improvements that researcher Vladimir Makarov has been working on to make Ruby faster. Here we see his work with RTL, an approach for the Ruby VM to interpret instructions……
This TIL note is related to article Visualized desktop workspaces flow
How to Setup Cinnamon DE workspaces and keyboard shortcuts (instructions how to install Cinnamon DE on Ubuntu 18.04 are at the bottom)
step 1 - increase the number of workspaces
default numper of workspaces in Cinnamon is 4 (I need 6)
gsettings set org.cinnamon.desktop.wm.preferences num-workspaces 6
step 2 - Shortucuts for switching workspaces
Menu > Keyboard > Shortcuts Tab > Workspaces > Direct Navigation
"Switch to workspace 1" to be "Super+1" "Switch to workspace 2" to be "Super+2" "Switch to workspace 3" to be "Super+3" "Switch to workspace 4" to be "Super+8" "Switch to workspace 5" to be…
in Nov 2016 I’ve published article Setup Ubuntu 16.04 for Ruby on Rails app (Cheatsheet) and it was quite a hit. As I’m reinstalling by Lenovo with fresh Ubuntu 18.04 I’ve decided to write up fresh revised article related to latest Feb 2019 technologies
sudo apt install -y curl git
Generate ssh key
ssh-keygen -t rsa -b 4096 -C "email@example.com"
Install RVM + Ruby
gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3…
Special Guest Host, Nick Schwaderer, stepped into Brittany's hosting shoes this week to interview Shopify's José Albornoz. Tune in for an insightful conversation about Shopify's infrastructure and how personal bot building makes the world a better place.
Links for this episode:
- Sentry use the code “devchat” for $100 credit
Panel: Charles Max Wood
Guest: Vlad Dem
I invite you to explore beyond ActiveRecord models and into the world of PORO (Plain Old Ruby Objects). These are the building block of any Object Oriented Language and especially Ruby. I’m going to focus on Value Objects, which holders of some collection of data or attributes. The collection could model a person, an account, an address, or more abstractly an error, and many more. You should keep in mind as a general principle that these objects should have a well-defined purpose or identity and contain no more information than what is needed.
A simple and common way to pass around a collection of attributes is with a Hash. It’s flexible for taking any number of key-value pairs created…
Today I want to talk about a pattern that can be very useful when we need to control the flow of a set of events of our objects: The State Pattern a.k.a Finite State Machine.
As a developer it is common to see objects changing their state. At the beginning managing the state of an object can be as simple as having some boolean attributes where you can check if the object is in state A or B. But when the complexity increases you can end up with a number of states that are difficult to manage without breaking the SOLID principles. That is where…
Bug, defects, delays, etc will always happen. With good practices, you can minimize them, but they will always exist.
- Accept fault
- Provide details and supporting information.
For the last two years, I have been trying to improve CRuby performance. I have been working simultaneously on two major fronts: introducing register transfer language (RTL) for the CRuby virtual machine (VM) and just-in-time (JIT) compilation. For background on the goal of having Ruby 3 be 3 times faster than version 2 (3X3), see my previous article, “Towards the Ruby 3×3 Performance Goal“.
The JIT project (MJIT) is advancing successfully. The JIT approach and engine I proposed and implemented has been adopted by the CRuby community. Takashi Kokubun hardened the code and adapted it to the current CRuby stack machine and recently MJIT became an experimental feature of the CRuby 2.6 release.…
In this 400th episode of Ruby Rogues, the panelists - Dave Kimura, Andrew Mason, Eric Berry, Charles Max Wood talk about themselves, their backgrounds, things they are working with, their journey and perspectives on life in general.
Eric has been a developer since 1998 and is working on Ruby on Rails since 2008. He talks about his current company – CodeFund, an ethical advertising platform that helps open-source developers generate a recurring passive income which encourages them to maintain existing software as well as contribute to additional projects. Dave is currently in a…
Rake is a popular task runner in Ruby. What is a task? Making a backup of your database Running your tests Gathering & reporting stats These are small tasks that without Rake would be scattered all over your project on different files. Rake centralizes access to your tasks. Rake also makes a few things easier, […]
Today I organized the front page of this blog (jvns.ca) into CATEGORIES! Now it is actually possible to make some sense of what is on here!! There are 28 categories (computer networking! learning! “how things work”! career stuff! many more!) I am so excited about this.
How it works: Every post is in only 1 category. Obviously the categories aren’t “perfect” (there is a “how things work” category and a “kubernetes” category and a “networking” category, and so for a “how container networking works in kubernetes” I need to just pick one) but I think it’s really nice and I’m hoping that it’ll make the blog easier for folks to navigate.
If you’re interested in more of the story of how I’m…
I've been thinking about a tension in how we think about relationships.
When I was growing up I was heavily influenced by the point of view that compatibility is basically irrelevant, and relationships are all about the work you put into them. This came primarily from a parent who felt that arranged marriages were the ideal kind of marriage, as well as this jackass who taught that dating was a bad idea (he has since repented).
As some of you might know, for the last 5 years I’ve been one of the organizers for a conferences called !!Con. This year it’s going to be held on May 11-12 in NYC.
The submission deadline is Sunday, March 3 and you can submit a talk here.
(we also expanded to the west coast this year: !!Con West is next week!! I’m not on the !!Con West team since I live on the east coast but they’re doing amazing work, I have a ticket, and I’m so excited for there to be more !!Con in the world)
!!Con is about the joy, excitement, and surprise of computing
Computers are AMAZING. You can make programs that seem like magic, computer science has all kind of fun and surprising tidbits, there are all kinds…
Rails 6.0.0.beta1 is out and you may have already tested it. We all have heard about the main features such as multi-database connectivity, Action Mailbox & Action Text merge, parallelized testing, Action Cable testing etc. But there’s also a ton of other cool features that I found interesting.
With each major release comes new requirements, starting with Ruby which is now required with a minimal version of 2.5.0 instead of 2.2.2 for Rails 5.2. Our databases also get an upgrade with 5.5.8 for MySQL, 9.3 for PostgreSQL and 3.8 for SQLite.
Webpacker as default
Webpacker has been merged in Rails 5.1 and provides a modern asset pipeline with the integration of Webpack for…
Sometimes you need to measure a few Rubies…
I’ve mentioned a few times recently that something is a “microbenchmark.” What does that mean? Is it good or bad?
Let’s talk about that. Along the way, we’ll talk about benchmarks that are not microbenchmarks and how to pick a scale/size for a specific benchmark.
I talk about this because I write benchmarks for Ruby. But you may prefer to read it because you use benchmarks for Ruby - if you read the results or run them. Knowing what can go wrong in benchmarks is like learning to spot bad statistics: it’s not easy, but some practice…
In this React hooks tutorial you will learn how to use React hooks, what they are, and why we’re doing it.
Here I am, writing a React hooks tutorial for you. I decided to wait until hooks got finally released before dropping this post. Together we’ll learn React hooks step by step, with a look at how the same logic would be implemented with ES6 classes.
Enjoy the reading!
React Hooks Tutorial for Beginners: what you will learn
In the following tutorial you’ll learn:
- how to use React hooks
- how the same logic would be implemented in React class components
React Hooks Tutorial for Beginners: requirements
To follow along with the tutorial you should have a basic…
What is a boolean? A boolean is a value used in a logic statement to say if something is considered true or false. This can be used to make decisions. In Ruby we don’t have a Boolean class, but we have boolean objects! We have true & false. Which are the singleton objects of TrueClass […]
Of course if we start thinking about reducing the amount of PRs, we also have to consider that doing individual updates might not be the best solution in all situations.
If there is one thing we’ve learned so far at Depfu, it’s that every team works differently. Every project – be it open source or in-house – is in a different situation. And the teams working on these projects all have their unique way of working and constraints.
While we love to be be opinionated and have sensible defaults, we also love listening to customers. And quite a few have told us that grouping updates into a single, recurring PR instead of individual updates is what they prefer.
So today we’re giving everyone…
When we focus on the model in CQRS architecture, we put most effort into write model. Not only this is the place where the business operations are implemented and breakthroughs in understanding domain are happening – we also consider it the part of the implementation where we should put a lot of our technical attention to.
Different implementations of aggregates? Persistence in the model or not? Messaging? Different kinds of transaction boundaries and transaction guarantees between multiple databases?
All of these are exciting topic, but read model part, often considered as an easy job for “junior” developers also pose challenges in implemention.
In ideal scenario, read models are…
On this week's episode, Chris is joined by Matt Sumner, development director in our Boston Studio. Chris & Matt start with a quick update on Matt's crypto adventures, and then transition to the core of the conversation as Matt describes the past few weeks of starting a new project and all the decisions that come with that.
The project kicked off with a product design sprint to help determine the initial direction for MVP. From there, Matt describes some of the thinking that went into the technology choices for the app, as well as describing his experience thus far working in a novel ecosystem for him with Scala & GraphQL.
Nate Berkopec is the proprietor of Speedshop, a Ruby on Rails performance consultancy. He will be holding a Rails Performance Workshop after Railsconf in Minneapolis. They chatted about performance and their loyalty for the Ruby community.
Links for this episode:
Article is still in progress, I’m planing to release it by end of the weak
In programming there is a powerful concept called “Duck Type”
Duck typing in computer programming is an application of the duck test—”If it walks like a duck and it quacks like a duck, then it must be a duck” Wikipedia
So here is an example Ruby code:
class A def aa 'aa' end end class B def call(a) a.aa end end class C def aa 'cc' end end class D end a = A.new a.aa # => 'aa' c = C.new c.aa # => 'cc' d = D.new d.aa # NoMethodError (undefined method `aa' for D:Class) B.new.call(a) # => 'aa' B.new.call(c) # => 'cc' B.new.call(d) # NoMethodError (undefined method `aa' for…
#437 — February 14, 2019
How to Create a CRUD App with Rails and React — A really thorough tutorial covering fronting a Ruby on Rails API with a React client along with linting, flash messages, and handling 404s in React.
Production-Quality Redis Hosting — Better tools, analytics and support for your high-performance Redis needs.
Rails 6.0 will be released soon and it’s packed with many features that both smaller and bigger applications will benefit from, as it feels like many improvements around speed and scalability were introduced in Rails 6.
I’ve read through the CHANGELOGs of all Rails parts (ActiveRecord, ActionPack, ActiveSupport, etc.) and picked some of the features that I found the most interesting.
Two new additions to the Rails family are Action Mailbox and Action Text that come straight out of Basecamp.
Add basic API for connection switching to support multiple databases
Connection switching support has been on my list for a long time, I’ve used the Octopus gem a few times before as well, but…
For an unknown reason, a significant number of users disable the mobile data for our iOS app. This is not a problem when they are booking a car from their couch at home with Wi-Fi, but can quickly become a major issue when they try to unlock their Drivy Open car in the street. At this specific moment, there is very little chance that they remember they disabled this setting, so it very often leads to a call to Customer Services that could have been avoided.Drivy's settings with mobile data switched off
If we do nothing about this, the users’s resquests would always fail when not on Wi-Fi, and they would see a default error. In our case, they would see the message “An error…
You can spend quite a bit of your programming career without working with trees, or just by simply avoiding them if you don’t understand them (which is what I had been doing for a while).
Now, don’t get me wrong - arrays, lists, stacks and queues are quite powerful data structures and can take you pretty far, but there is a limit to their capabilities, how you can use them and how efficient that usage can be. When you throw in hash tables to that mix, you can solve quite some problems, but for many of the problems out there trees are a powerful (and maybe the only) tool if you have them under your belt.
So, let’s look at trees and then we can try to use them in a small exercise.
Continuing our quest on reducing the amount of PRs: What if grouping or bundling updates together does make sense for certain types of dependencies?
We recently shipped a few options for you to try that on your projects:
We think of these as strategies you can use to reduce the amount of PRs you get from Depfu. By default we will continue to send individual PRs, but depending on how you structure and treat your dependencies, we think it makes sense to give you the option to update certain types of dependencies together.
Grouping development dependencies
While updating dev dependencies might be as much or more work as production dependencies in some cases (test frameworks come to…
At Ombu Labs, we are big fans of Ruby on Rails and design patterns, especially convention over configuration! The beauty of Rails is that you can inherit a legacy project and easily find the different layers of code in different directories.
When it comes to database migrations the policy of Rails is very clear. It's all about altering the database structure with gradual migration files: "Migrations are a convenient way to alter your database schema over time in a consistent and easy way." (source)
But, what about data migrations? What's the best way to write, maintain, and run migrations that alter the data in your production database?
In this article I will talk about three different…
- Sentry use the code "devchat" for $100 credit
Panel: Charles Max Wood
We’ve been on a quest lately: How can we reduce the amount of PRs Depfu creates, while still keeping your app up-to-date?
One of the more obvious avenues to explore is grouping updates together. While we are still convinced individual PRs are easier to assess and to merge, there are a few situations where grouping makes sense.
The first one I want to talk about is monorepo libraries.
When you use the built-in excerpt feature, Jekyll returns the first paragraph of text. It does this by looking for something called the excerpt_separator. The excerpt_separator defaults to
\n\n, which is ideal for most short posts.
Back in my LiveWriter days, it would use an HTML comment like
<!--more--> to designate where to break for an excerpt. Jekyll supports this as well. In your _config.yml file you can add:
Unfortunately, this now means that on every post, you need to enter
<!--more-->, even if you are OK with the default of the first paragraph. The alternative is to add
excerpt_separator: <!--more--> for each post you want to control the excerpt.
Last month we released dry-view 0.6.0, a very special release that made huge strides towards the system’s overall completeness. With 0.6.0, dry-view should now offer everything you need to write better organized views in Ruby.
From here, our goal is to take dry-view to version 1.0. So please give this release a try! Your feedback at this point will help ensure 1.0 is as polished as possible.
If you’re new to dry-view, or would like to see its new features presented in context, then you’re in luck! My talk from RubyConf AU (which took place just last week!) is a nice and tidy, 20-minute package explaining dry-view’s rationale and how everything fits together:
I’d also invite you to take…
The JRuby community is pleased to announce the release of JRuby 220.127.116.11
JRuby 9.2.x is our new major version of JRuby. It is expected to be compatible with Ruby 2.5.x and stay in sync with C Ruby. JRuby 18.104.22.168 is our first release for 2.5 support.
If you do find issues then report them on using our issue tracker at http://bugs.jruby.org. We also encourage users to join our IRC channel (#jruby on Freenode) and mailing lists. You may also follow @jruby on Twitter for updates.
- 52 issues fixed for 22.214.171.124
Github Issues resolved for 126.96.36.199
I/O stands for Input/Output. By input we mean all the data & information that comes into something (computer, Ruby method, your brain). Examples of input: Keys your press on the keyboard Mouse click Books you read By output we mean everything that comes out as a result of the input. Examples of output: The result […]
I spent last week on the tropical island of Anguilla with a bunch of software luminaries. My life is sometimes surreal.
At the moment though, I'm looking out on a chilly, thick fog up here at Fair Pavilion. I can't see the sun. This matches my internal climate pretty well. The world has sharp edges, and my journey seems to be one of exposing ever greater surface area to it.
This is fine.
“This is fine”. My friend Jessica says this a lot. It has been seeping into my personal vernacular lately. To me it represents a whole philosophy of life, strongly at odds with how I once lived.
“This is fine” is the choice to accept a situation exactly as it is, without…
Hello! I haven’t been blogging too much recently because I’m working on a new zine project: Linux networking tools!
I’m pretty excited about this one – I LOVE computer networking (it’s what I spent a big chunk of
the last few years at work doing), but getting started with all the tools was originally a little
tricky! For example – what if you have the IP address of a server and you want to make a https
connection to it and check that it has a valid certificate? But you haven’t changed DNS to resolve
to that server yet (because you don’t know if it works!) so you need to use the IP address? If you do
curl https://188.8.131.52/, curl will tell you that the certificate isn’t valid (because it’s…
Most of the time, when building relationships between models, you typically use
belongs_to. There are some circumstances where a
has_one relationship is more appropriate.
However, the behaviour of
has_one has some quirks that make it a little trickier to deal with.
When you assign a new instance of an associated model to its
has_one model the existing instance is removed from the association and causes a permanent change to be written to the database. This happens whether the new model is valid or not.
Read about this side effect of the generated
#association= method in the Rails documentation.
…directly assigning a new object to a
On startup pricing, Michelle Obama famously said,
…our motto is: when they go low, we go high1
A post on Indie Hackers reminded me of this quote:
So, I’m thinking if I should try offering an email service, similar to Google Apps, but more affordable..
Just raise prices has been the rallying cry in the bootstrap community for the last couple of years2, but this is a different topic.
When competing with large entrenched competitors competing on price is almost always the wrong strategy. Founders, especially those who were developers, grossly underestimate what it takes to build and support something.
Google could easily run Google Apps for nothing (they did for a long time). The…
Hello, and happy belated new year! Welcome to a year-end special edition of the monthly update: Ruby Together’s Yearly Update for 2018. Throughout the year, our work was supported by Handshake, Stripe, DigitalOcean, Airbnb, Travis CI, Coinbase, GitLab, reinteractive, Stitch Fix, Bleacher Report, Triplebyte, and many others.
ruby together news
There are more details in the following sections, but here’s the tl;dr: during 2018, we took in $300,183.32, we spent $266,900.32, and we paid for 1,394 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…
The challenge of keeping test code clean
The hardest part of a programmer’s job isn’t usually figuring out super hard technical problems. The biggest challenge for most developers, in my experience, is to write code that can stand up over time without collapsing under the weight of its own complexity.
Just as it’s challenging to keep a clean and understandable codebase, it’s also challenging to keep a clean and understandable test suite, and for the same exact reasons.
If I look at a test file for the first time and I’m immediately able to grasp what the test is doing and why it’s doing it, then I have a clear test. The test has a high signal-to-noise ratio. That’s good.
Smooth transitions help hold the audience's attention
Saron Yitbarek has a great post about how improving your transitions can really spruce up a tech talk. Specifically, about how the transition to a new slide should begin before you actually switch to that slide.
The goal is to make slides support your points, rather than having them introduce your points. It's an important skill to learn for giving talks. Go read her article.
But it's difficult to remember what the next slide will be
I try to practice this technique in my talks, but I've never found it easy. I often have trouble remembering exactly which slide comes next, and it's hard to transition when you can't remember…
Hiro Asari is a software developer at Travis CI and has spoken at many conferences across the globe. Hiro guested on to the show to discuss dpl, a continuous deployment tool he maintains at TravisCI.
Links for this episode:
Introducing Transaction Support in aws-record
Recently, support for transactions was added to DynamoDB. DynamoDB transactions simplify the developer experience of making coordinated, all-or-nothing changes to multiple items both within and across tables. Transactions provide atomicity, consistency, isolation, and durability (ACID) in DynamoDB, enabling you to maintain data correctness in your applications easily.
Today, we’re launching support for DynamoDB transactional find and write operations directly from
You’re going to spend a lot of your time as a developer inside the editor, so it important to use an editor that you’re comfortable & productive with. In this article: I want to help you choose which Ruby IDE / Editor is right for you! You don’t need to stress over this decision, just […]
#436 — February 7, 2019
dry-schema: A Data Coercion and Validation Library — A new library from Dry.rb focused on data validation. It was built to improve some of the issues in dry-validation.
A Complete Program — An interesting exploration of a thought where, in this case, “complete” means “done enough for me to feel good about abandoning” it. In other words, how do you feel good about stopping work on a program?
Make a Valuable Open Source Contribution with CircleCI Orbs — CircleCI Orbs (packages of configuration) are a…
#435 — January 31, 2019
Rails 6 to Keep Source Maps in Production, Decrees DHH — For performance reasons, source maps were originally not going to be included in production Rails apps, but this week DHH stepped in and reverted to ‘source-maps-by-default’ behavior in tribute to the Web’s tradition of ‘View Source’ actually being useful.
Ruby on Rails
In software, nothing is unlimited. You can market and sell your product without any limits, but when it comes to computing, there are always limits.
One such limit, bit me in the ass yesterday.
KickoffLabs uses recursive queries in a couple of places. These are great because they can often limit hops back and forth to the database. Generally, they recurse two or so levels deep.
Unfortunately, a customer (or customer’s customer) managed to go many levels deep….and you probably guessed it by now, without any limits. Furthermore, one of these queries generates more related recursive queries.
The green in the picture is database work. It was not the number of queries causing the problem,…
Recently I was working with a friend on their Rails app, which had been fully wrapped in a
docker-compose setup. They were quite rightly asking me questions about the best way to do things like run the server, run tests, migrate the database and other common Rails tasks. While I’ve seen a number of different ways of Dockerizing Rails in development, my preferred way is not to Dockerize my Rails app itself. In development I prefer to use Docker to manage any complex dependencies my application has, leaving my app running bare on my machine. When it comes to production time, that's the ideal place to Dockerize your application. Let's look at why!
It starts with the "Rails Way"
We have a client that uses multi-tenant database where each database holds data for each of their customers. Whenever a new customer is added, a service dynamically creates a new database. In order to seed this new database we were tasked to implement a feature to copy data from existing “demo” database.
The “demo” database is actually a live client where sales team does demo. This ensures that the data that is copied is fresh and not stale.
We implemented a solution where we simply listed all the tables in namespace and used activerecord-import
to copy the table data.
activerecord-import gem to keep code agnostic of underlying database as we used different databases in…
At Ombu Labs, we like to split our time between working on our own products, open source and client projects.
Our own products include everything from OmbuShop, an e-commerce platform, to FastRuby.io, a Ruby on Rails upgrade service. In terms of open source, we recently created Audit Tool and are constantly searching for more projects to contribute to. We also work on a variety of interesting client projects, and with our current team size, like to take on two to three of them at a time.
As an Account Manager, it can get hectic trying to manage all of this. Google Calendar can be a serious help.
Using Multiple Calendars
In order to manage the different types of projects we work on at …
Welcome to a new episode of Ruby Magic! This month's edition is all about metaclasses, a subject sparked by a discussion between two developers (Hi Maud!).
Through examining metaclasses, we'll learn how class and instance methods work in Ruby. Along the way, discover the difference between defining a method by passing an explicit "definee" and using
class << self or
instance_eval. Let's go!
Class Instances and Instance Methods
To understand why metaclasses are used in Ruby, we'll start by examining what the differences are between instance- and class methods.
In Ruby, a class is an object that defines a blueprint to create other objects. Classes define which methods are available on any…
- Eric Berry
- Charles Max Wood
- Nate Hopkins
Special Guest: Mani Vaya
There are few things lamer than blogging about blogging, but this is a subject I think is very important.
In my virtual circles, Twitter has killed blogging. I do not believe Twitter did it on purpose. Twitter is simple, and you can reach a lot of people quickly. And despite all the negative energy around Twitter, it still the place where I learn the most on a daily basis.
What concerns me about blogging’s demise is how much information vanishes after a couple of minutes. You can like it, but good luck finding in the future.
What I am trying to do instead is something I am calling shorts. A short is a post that is either small enough to live inside a tweet or has enough formatting…
RubyMine 2019.1 EAP (build 191.4738.18) has just been updated. The new build features an ability to view a Call Hierarchy of Ruby methods, and adds support for TruffleRuby.
Call Hierarchy [RUBY-16165]
This build features a very handy ability to view a call hierarchy of methods (Navigate | Call Hierarchy), which expands the potential of the Find Usages action.
Not only does the Call Hierachy show you all the methods (“callers”) that use the method you are investigating, but it also shows you callers of the callers. Take a look at the following steps to escape this verbal abracadabra and get a grasp of this feature:
- Put the caret at the method you want to…
Let’s consider two software development workflows. Their outcomes differ in many ways, but in this article I just want to focus on code quality.
Workflow #1: Straight to the implementation
- Look around the codebase for existing places that will need to be changed.
- Change and add code until the new functionality works, doing manual testing.
- Think about refactoring, but decide against it, because it’s working, and you’ll have to manually test everything again if you make changes.
- Write some tests to cover the new code.
- Refactor some of the code, without breaking the tests you just wrote.
This workflow does not involve design. Changes are made haphazardly until the implementation…
Initially, all of the API endpoints returned JSON. JSON is convenient, and the tools around it are great these days. However, I did notice that in my primary use cases it was adding some unnecessary steps, especially when using it with shell scripts.
Since it is a relatively new project, I thought it was best to fix this now.
I made a change that now checks the HTTP ACCEPT header. If it is
application/json, the API will return JSON. If it is anything else, it will return plain text.
def is_json_request? request.accept == "application/json" end
What is nice is that you can now simply…
Welcome to the December 2018 monthly update!
In December, Bundler reached two huge and exciting milestones. First, Ruby included Bundler for the first time ever, including Bundler 1.17.2 in Ruby 2.6. Special thanks are due to @hsbt for years worth of work integrating Bundler into the ruby-core test suite and keeping everything working and up to date.
Second, Bundler shipped version 2.0! It’s a big milestone, and the Bundler team is very excited to adopt a yearly major release cadence, to better match Ruby itself.
Bundler gained 55 new commits, contributed by 7 authors. There were 225 additions and 63 deletions across 21 files.
Interested in contributing to Bundler? We always welcome…
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 and RubyGems.org in October.
In RubyGems.org news, lead RubyGems.org maintainer @dwradcliffe completed porting the production RubyGems.org deployment to use Kubernetes! This didn’t cause any user-facing changes, but makes it easier for others to develop locally, and will help us with our efforts to avoid downtime.
Another major development was enabling two factor authentication, a Google Summer of Code project that can greatly improve the security of logging in and…
I enjoyed using both the Das Keyboard and WASD Code V3. The smaller size and backlighting would have been enough to push the WASD ahead, but the rollout and Windows requirement of the V3 was too much to overlook.
In the end, I kept the Das Keyboard and returned the other two.
The models I tested
- Das Keyboard 4 Professional (MX Blue)
- Matias Mini Tactile Pro (ALPS)
- WASD Code V3 87-Key (MX Blue)
Sadly, there are not many “real” Mac choices for mechanical keyboards. Apple.com lists none. Most of what comes up on Amazon are ‘retro’ which is not the same a mechanical. Apple makes lion share of profits in the hardware space, but the number of units is still quite small.…
As I continue on the path to a new benchmark for Ruby speed, one important technique is to build a little at a time, and add in small pieces. I’m much more likely to catch a problem if I keep adding, checking and writing about small things.
As a result, you get a nice set of blog posts talking about small, specific aspects of speed testing. I always think this kind of thing is fascinating, so perhaps you will too!
Two weeks ago, I wrote about a simple speed-test - have a Rails 4.2 route return a static string, as a kind of Rails “Hello, World” app. Rack’s well-known “Hello, World” app is even simpler. On the way to a more interesting Rails-based Ruby benchmark, let’s speed test those two, and…
(Scroll down for…
You can use a Ruby comment to add information to your code that may be helpful for you or other developers. The most common type of comment is the single-line comment. Here’s the syntax: # I like apples & oranges Notice three things about this: The comment starts with a pound (#) symbol We put […]
In the following tutorial you’ll learn how to test a Django application and the thought process behind testing and refactoring
When it comes to backend my tools of choice are Django and Python. Speed of development (particulary useful for rapid prototyping) and the excellent test coverage I can get almost out of the box are the major boons for me.
I use Django for training aspiring developers too and when I run a workshop I don’t go straight to the “right implementation”. What I like instead is guiding newcomers through the initial “working implementation” to refactoring into a more complex application.
In this tutorial you’ll build a small application with the exact same…
On this week's episode, Chris is joined by Daniel Colson, developer in our New York studio and current maintainer of all things FactoryBot. Chris & Daniel discuss Daniel's work as maintainer of one of thoughtbot's most popular open source projects and some of the parallels to thoughtbot's consulting work. They then discuss a bit more on the specifics of FactoryBot and what's in store for upcoming versions.
To round out the conversation Daniel and Chris also dig into some of the testing related best practices and patterns common to thoughtbot projects, linting and formatting tools, and even dip into the age old discussion around single quotes vs double quotes (just a tiny bit).
Jason Charnes is a web developer, podcaster (Remote Ruby), husband, and dad who is part of the team of run.rb, a Ruby emulator in the browser. After discussing their mutual love of Ruby, Brittany and Jason discuss the importance of mental health awareness in the developer community.
Links for this episode:
Two years ago (!!!) I published a post on discourse.dry-rb.org explaining my plans for dry-validation 1.0.0 and in this post I mentioned that there will be a new gem called dry-schema that dry-validation will use for its schemas. It’s crazy how time flies because I swear I thought it was last year. I know that over this time dry-validation has been accumulating a lot of issues (125 in the moment of writing this article), and I know it sucks, big time, that I didn’t have a chance to address any of these.
Good news is I’ve finally shipped the first version of dry-schema, a new project I’ve been working on-and-off over the course of the last 2 years. It didn’t actually take much time to…
Jeremy Evans (of Roda and Sequel fame) created an interesting benchmark comparing memory and runtime performance of large number of routes (up to 10000) in various Ruby web frameworks. I was immediately interested and ran it to get the numbers.
Jeremy’s benchmark is called r10k and supports several web frameworks. Since the results are not included in the original repository I ran this benchmark on my laptop (5th gen i7 ThinkPad Carbon) to find out.
I used latest stable versions of Roda (3.16.0) and Sinatra (2.0.5) together with Rails 6 (6.0.0.beta1) all running Ruby 2.6.0. I did only small tweaks to the original benchmark by upgrading Rails and removing
If you've been a web developer for any length of time at all these days, you've no doubt used at least a few web based APIs here and there. It's possible that you've even written one (or more!) yourself. API design is a rich topic with a lot of deep roots, but some cursory research will show a number of best practices that public facing APIs should implement. Understanding these practices will give you a firm basis for judging the quality of APIs as a user and consumer, and allow you to design more useful APIs when it's your turn.
Over the years, I've used a lot of APIs myself, and here are some best practices that I see getting short shrift:
Versioning an API is something…
Hello wonderful community! ❤️🌸
Today we're thrilled to announce
v2.0.0.alpha1 release 🙌.
Today's release is the beginning of Hanami 2 series. The final 2.0 version will be released later this year.
We decided to start fresh with the development of the framework. The internals needed a cleanup because the code was accumulating techical debt from the old days of Lotus. To evolve it would have required too much effort. Given 1.3 is 4k lines of code, it made a lot of sense for us to start from scratch.
That means this release is not meant to be comparable in terms of features with 1.3, but it's more a preview of Hanami 2.
Ruby 2.6.1 has been released.
- Net::Protocol::BufferedIO#write raises NoMethodError when sending large multi-byte string has been fixed.
This release includes additional bug fixes. See the commit logs for more details.
SIZE: 16742207 bytes SHA1: 416842bb5b4ca655610df1f0389b6e21d25154f8 SHA256: 17024fb7bb203d9cf7a5a42c78ff6ce77140f9d083676044a7db67f1e5191cb8 SHA512: 89e016e60f107fa40da251bc9659584ee3191caee726b5c6818ecbe109f825c553041a5dfda7e6d2889fcf587e63fb5d9fbe6cbdbdc4572e1123c302f0f1b881
SIZE: 20595342 bytes SHA1: …
At some point last month I said I might write more about business, so here are some very early marketing thoughts for my zine business (https://wizardzines.com!). The question I’m trying to make some progress on in this post is: “how to do marketing in a way that feels good?”
what’s the point of marketing?
Okay! What’s marketing? What’s the point? I think the ideal way marketing works is:
- you somehow tell a person about a thing
- you explain somehow why the thing will be useful to them / why it is good
- they buy it and they like the thing because it’s what they expected
(or, when you explain it they see that they don’t want it and don’t buy it which is good too!!)
So basically as far…
We have a bunch of files hosted in S3 which are served through CloudFront.
To reduce the CloudFront bandwith cost
to make use of a global CDN (we use
Price Class 100 in CloudFront), we decided to use Cloudflare for file…
One of the most common questions I see from beginners to Rails testing is what mocks and stubs are and when to use them. If you’re confused about mocks and stubs, you’re not alone. In my experience very few people understand them. In this post I’ll attempt to help clarify the matter, particularly in the context of Rails/RSpec.
I want to preface my explanation with a disclaimer. This post is partly derived from personal experience but it’s mostly derived from me just reading a bunch of posts online and reading a few books to try to understand mocks and stubs better. It’s entirely possible that what follows is not 100% accurate. But I’m risking the inaccuracy because I think the internet…
Travis CI is one of the most popular hosted Continuous Integration solutions. Most notably, it has made a huge contribution to the developer community by serving the biggest share of open source projects.
However in 2019 most new software projects are looking for a solution that can drive the entire Continuous Delivery lifecycle. There’s also little evidence in the developer tools space of companies making customer-centric innovations after being acquired by a private equity fund. So after the last week’s announcement of Travis CI’s acquisition by Idera Inc., many developers have started exploring alternatives.
Over the years the most common benefit that we’ve heard from customers who…
“!” and “?”: Understanding One of Ruby’s Coolest Naming Conventions
“Well, that’s quite some symbols you got there ♨_♨” - You, after reading this article’s title.
It was a calm Friday afternoon here at CodeMiner42, when one of my co-workers from another office came up with an interesting question in the company’s chat:
“Guys, are the ! and ? that we find at the end of method names a convention of Ruby, RoR, or whom else?”
Well, that’s a fair question, and I hope I can increase your knowledge by sharing my answer here.
It’s all about conventions, in the end
First of all, from an implementation standpoint, naming a method with ! or? at the end has no effect in the method’s functionality. With that,…
Learn how to use the combination of signed transactions and JWT tokens to authenticate users from a pair of cryptographic keys that identify the blockchain user. This article is based on Stellar Web Authentication proposal by Sergey Nebolsin and Tom Quisel that now becomes a part of Stellar ecosystem. The same approach might be used in theory with other blockchain solutions.
Strictly speaking, web-based authentication and blockchain do not even have to appear in the same sentence, as technologically these concepts are not more related than apples and oranges. In reality,…
Today I am announcing ValueSemantics — a gem for making value classes. This is something that I’ve been using in my personal projects for a while, and I think it’s now ready for public use as of v3.0.
In this article, I will give an overview of the gem, but I mainly want to talk about the thought process behind designing a library. We’ll look at:
- design goals
- comparisons to similar gems
- the module builder pattern
- case equality
- callable objects
- opinions about freezing
- Integration Continuity™
- designing DSLs
- stability in cross-cutting concerns
What’s the Point?
Before getting into the details of this gem, you might be wondering: what are value objects, and…
Hello everyone! This is Eugene, with a selection of interesting improvements to Rails merged in the past week.
Support for per-environment credentials is coming in Rails 6.0, but adding a new environment wasn’t always easy: if your application accessed credentials during boot, the
credentials:edit command would fail to run, which would in turn prevent you from adding the missing credentials. Oops!
When prepared statements are enabled, querying an integer column with an out-of-range value causes an error in the underlying database driver. To work around this…