Skip to content

Instantly share code, notes, and snippets.

Updating gems with Bundler

Bundler recommends using bundle update to update Rails. It also accepts --conservative to try not to update shared dependencies.

bundle update [--conservative] rails

This method can often produce unexpected results. Even with the conservative flag, it may try to update gems that you may not need updated. In some cases, bundler might even give some errors.

Using multiple Ruby versions with Appraisal

[Appraisal] is often used for testing multiple versions of a Ruby gem's dependencies at once. When authoring a gem that requires compatibility with Rails 4 and 5, appraisal is often used to make this easier:

# Appraisals
appraisal 'rails-4' do
  gem 'rails', '~> 4'
end

Using rem units in CSS

One pattern I've noticed lately is using rem as a unit of distance in CSS. This seems like a pretty good idea.

.box {
  height: 1.5rem;
  padding: 1rem;
}
@rstacruz
rstacruz / README.md
Last active April 23, 2024 00:19
Setting up Jest with ESM

Setting up Jest with ESM

Here are some different ways on how to set up Jest to support ESM. This applies for Jest v25, Node v13, and Babel v7.

Method A: Native Node.js support

Node v14 and Jest v26 support ESM natively with the --experimental-vm-modules flag.

Install cross-env:

@rstacruz
rstacruz / readme.md
Last active March 16, 2023 05:25
Learn Kubernetes in X minutes
@rstacruz
rstacruz / 0_README.md
Last active November 3, 2021 09:45
Arch Linux installation helper

⚠️ NB: This has project moved. For a more updated version, see: https://github.com/rstacruz/arch-install-helper


Arch installer script

A small script to make it easier to install Arch Linux on VM's.

Boot the Arch Linux installer. Get online. (for VM's - you're probably already online.)

@rstacruz
rstacruz / Comelec SD card failure analysis.md
Last active May 23, 2019 04:49
Comelec SD card simulation

Analyzing SD card failures in the Philippine elections

News reports say that 2019 Philippine elections are severely affected by SD card glitches. If we go by the facts, there should only be ~8 machines affected by SD card failures. Only 0.01% of the vote-counting machines should be affected by these issues. Let's do the math and see why.

What we know

@rstacruz
rstacruz / README.md
Last active May 3, 2019 10:18
CSS Blitz - Single-div macOS window