RSSAmplifier

Blog

Mike Coutermarsh

My personal blog

mikecoutermarsh.comRSS feed ↗15 posts

Latest posts

Automating with Cursor commands

I've been very interested lately in how I can use AI to take care of tasks for me. Here is one use case we've found that has been successful so far. New post over on the PlanetScale blog. Read here: Automating our changelog with Cursor commands

AstroVim slow on large files

If you're finding AstroVim is lagging on very large files, it is possible the source of the problem is vim-illuminate . To determine if it is, run :TSDisable illuminate . Does it solve your problem? Large file cutoff If that solved your problem, you can disable illuminate for large

How to use GitHub Copilot with AstroVim 4

This took me a while to figure out. In this file: ~/.config/nvim/lua/community.lua You need to add the following line. { import = "astrocommunity.completion.copilot-lua-cmp" }, Then, when you start nvim again. Run :Copilot auth . This will trigger the setup and you'll be

How high scale Rails apps make schema changes

I recently wrote a post over on the PlanetScale blog sharing how we make schema changes for our own Rails app. In the post I share a couple concepts that might be new to you. "Online" schema change tools Separating rails db:migrate from deploys If your team

Using replicas to scale out your database

High traffic websites often use database replicas to scale out their reads. Most web traffic is a GET request anyway and never modifies data. But how do you know when you should READ from the primary? The answer is more complex than you might think. And it's important

How to stop GitHub Slack app from @ mentioning you

This took me too long to figure out. I hope this helps you if you are googling around. To force the GitHub Slack app to stop @ mentioning you. The only way I found is to do the following. In a separate slack workspace (that you don't care about/

Building a webhooks service

I recently had the chance to work on building webhooks for PlanetScale. As part of this, I learned quite a lot about the possible security vulnerabilities that running a webhooks service can expose you too. You might be surprised with all the risks there are! Everything I learned is over

Easy Rails controller rate limiting with Rails.cache

Here's an easy trick I reach for when wanting to add simple rate limiting to an endpoint. def special_endpoint model = Model.find(params[:id]) cache_key = "rate_limit:mymodel:#{model.id}" # If the key exists, we rate limit if Rails.cache.fetch(cache_key) return

How dare you test a private method

I feel inspired to talk more about “testing a private method” (gasp!). Since people seem to get upset about it . Where did this idea of it being bad even come from? I remember when learning to code it was all over the place. Blog posts, books, podcasts. I

How to use Flash messages from a Rails API only controller

If you are debugging this Flash message error. undefined local variable or method `flash' for And you are currently using an API only Rails controller, but still want to use flash messages in your app because you are redirecting to a normal controller. Then you can fix this by

How to stop Rails from setting a session cookie

Recently I was working on a Rails API and I wanted to stop Rails from setting it's _session cookie for API requests. Since these requests are authenticated via an API token, there's no reason for the cookie to be returned to the user. # application_controller.rb

How to make a Fly API call from Ruby

Fly has a graphql API available. You can find ways to use it by looking through their CLI's source code . I recently wanted to automate a Fly API call from a ruby script. And I was not in an environment where I wanted to install the fly CLI.

Setting an Actions secret with Octokit.rb - Ruby Example

Here's a Ruby example of how to set a GitHub Actions secret using Octokit in Ruby. The secret needs to be encrypted before it is sent to the API. You need the octokit and rbnacl gems installed. require "octokit" require "rbnacl" client = Octokit::Client.

Performant database tree traversal with Rails

New post over on the PlanetScale blog . This was the toughest N+1 performance problem I've faced. It shows a trick you can use to preload records, in a situation where includes doesn't cut it. Go check it out .

How to tech lead and survive

If you're in a tech lead role and struggling. Try this. Make a mindset shift. Ask yourself: "How can I not be the person who builds that?" This will feel hard because for years you have been good at building. You're used to taking