OOZOU
お問い合わせ
Insights

Today I Learned

Short, practical notes from the OOZOU team: quick lessons from daily engineering and design work.

all topicsshell 30ruby on rails 22ruby 12macos 10vim 7figma 4cli 3javascript 3heroku 1elixir 1
cli2026年2月16日

Run Claude Code Fully Autonomously with a YOLO Alias

The --dangerously-skip-permissions flag lets Claude Code run commands and edit files without confirmation prompts. Typing it every time gets old fast.

cli2024年3月20日

Run a command on your GNU/Linux dedicated Nvidia GPU (e.g. ollama)

To make sure a command (CLI) is using your NVIDIA GPU in GNU/Linux, you can use the environment variables \\NV\PRIME\RENDER\OFFLOAD=1 and \\GLX\VENDOR\LIBRARY\NAME=nvidiabefore your command.

ruby on rails2022年2月10日

Use Pundit Policies to manage permitted parameters, defaults and per action

To manage permitted params you can add permitted\attributes and permitted\attributes\for\#{action} in your policies e.g.

ruby on rails2022年1月31日

Use `requestSubmit` for form submits with Turbo

Turbo listens to submit events on form.  Hence, always use requestSubmit to submit  a form using JS.

ruby on rails2022年1月19日

Ignore bundled gems for Rubocop and ESLint in GitHub Actions

Rails projects will often install gems into the vendor directory in GitHub actions so we can cache them for the consecutive runs.

macos2021年8月20日

Add a macOS-style drop shadow to your "partial" screen captures or plain-bordered images

By default, and like it or hate it, the macOS keystrokes to capture full app screen (⇧- ⌘- 5) will add a subtle drop shadow around your saved image.  This can make it more visually appealing when…

figma2021年6月22日

Create monochrome screen using overlay layers covered with hue fill effect

Create monochrome screen using overlay layers covered with hue fill effect

figma2021年6月18日

Hold ⌥option while click & drag along an input field to adjust sizing

Hold ⌥option while click & drag along an input field to adjust sizing

cli2021年5月25日

git check-ignore

This command lets you debug if a certain file/path is ignored and, with the -v flag, it also shows you the matching exclude pattern (Docs).

ruby2021年4月30日

Allow pasting multiline ruby blocks in Pry when using leading dot notation

We use leading dot notation a lot now e.g.

ruby on rails2021年4月18日

Rails 6, Ruby 3, Bootstrap 5 and Hotwire

Extending the blogpost from Bootrails with Hotwire: All the fancy new things (as of when I'm writing this TIL):

figma2021年2月17日

Convert Text Object to Title Case in Figma

You can set Text box property to convert everything into Title Case automatically (along with other common text cases)

heroku2021年1月6日

Reduce Heroku Slug Size

First, install the Heroku Repo plugin:

shell2020年12月8日

Run incognito/private commands for Bash and Zsh

Simply put a space before the command and it won't be saved to ~/.bash\_history. E.g. qrencode -o out.png "Some secret text"

macos2020年11月7日

Convert SVG to PNG

On MacOS, install inkscape (with brew) and use it like this:

figma2020年10月31日

CMD+Click behaviour in Figma

Holding ⌘CMD+Left Clicking in Designer mode will select the deepest layer resides within that frame/group whilst doing so in inspector/developer mode will select the outermost object/frame/group…

ruby on rails2020年10月27日

Rails Cache-Control

For enabling setting cache-control headers of static assets and using a CDN on Heroku:

shell2020年10月22日

Upgrade postgres database with homebrew

To upgrade postgres you can run

ruby on rails2020年10月14日

Fix input on Heroku's rails console

If you end up pasting lots of lines into a rails console on Heroku (or else where), you might get issues with the lines "bleeding" into each other.

ruby2020年10月14日

Heredoc without interpolation

Sometimes you want to use Ruby's Heredoc without interpolation ('#{....}'). You can do this by adding single dashes around your keyword:

ruby on rails2020年10月14日

Unique ID for DOM in Rails

Rails has many great view helpers, one of which is dom\id:*

ruby on rails2020年10月13日

Add new types to Rails 5 attributes API

The Rails 5 attributes API allows us to build form objects very easily.

macos2020年10月13日

Add spacers to your macOS app dock to make groups

Open term (or equivalent) and paste the following one-liner:

shell2020年10月13日

Amazon AWS S3 CLI copy with set perms

Open term (or equivalent) and paste the following:

shell2020年10月13日

Angry Docker Purge

If you receive No Space left error on Docker this the brute force solution:

ruby on rails2020年10月13日

Attaching file to ActiveStorage without HTTP

If you want to attach a file you generated on disk or downloaded from a user-submitted URL, you can do it like this.

ruby2020年10月13日

Automagical Intermediate-level Hashtables in Ruby

All intermediate-level hashtables will be created automagically

shell2020年10月13日

Back up a file with same name + prefix

NOTE: Actually you can use !#:1 in every command 'cause that's last argument passed to a command.

shell2020年10月13日

Bash aliases and magic

I have a seperate file in my user folder named ~/.aliases. I use this to store all of my bash aliases. I use aliases a lot and add new ones regularly so I created a bash function to add new aliases…

elixir2020年10月13日

Calculate anagrams in Elixir

For example:

ruby2020年10月13日

Change Ruby version for single command with rbenv

You can switch Ruby version temporarily with rbenv local

macos2020年10月13日

Change system names on macOS

From term (or equivalent), copy and paste:

ruby2020年10月13日

Change VS Code Go to definition to Cmd+Click

Just open your user settings JSON file and use this option:

shell2020年10月13日

Check for IKEA item availability

If you're waiting for an IKEA item to restock, here's a practical solution to stay updated automatically. This guide explains how to use a shell script to check IKEA's stock availability and get…

shell2020年10月13日

Check if command exists with shell script

Check if command exists with shell script

macos2020年10月13日

Chrome tab manipulation

Sometimes I want to go back to the last page I viewed while still keeping the same one open. You can very easily achieve this with shortcuts

macos2020年10月13日

Cleanup stale formulas on brew

Use brew cleanup to get some spaces back!

ruby on rails2020年10月13日

Create a Hash from an Enumerable (Rails 6.0)

New method allowing you to create a Hash from an Enumerable:

ruby on rails2020年10月13日

Create idempotent migrations

When you want to write destructive migrations please use if\exists: true when you’re trying to remove a table and check for a table existence when you want to add or remove a column…

shell2020年10月13日

Create your own git commands (aliases)

Ever wanted to shorten a git command? You can go with shell alilas for sure but you have to always include context so that you don't forget what each ailas stands for but you can define your own…

shell2020年10月13日

Delete already-merged branchs in Git

You can safelist more branches in egrep -v 'master|develop|foo|bar'

shell2020年10月13日

Delete merged git branches

Handy git command for deleting all local git branches that already merged git branch --merged | egrep -v "(^\\|master|dev)" | xargs git branch -d*

javascript2020年10月13日

Destructuring assignment in JS

Simple ones javascript const [a, b, ...c] = [10, 20, 100,200] // a= 10, b=20, c=[100,200] const { first, second } = { first: 1, second: 2 } // first = 1, second = 2

shell2020年10月13日

Diff a local file with remote version in Git

Easily run the below command and get a diff version from the remote

shell2020年10月13日

Find a branch based on a commit

c198bb715 Make default expired description logic pretty `

shell2020年10月13日

Force push previous commit to repo

If you push some code and want to force push a previous commit you can do so with shell git push origin +commit\sha^:branch\name

shell2020年10月13日

Get current git branch name

Get current git branch name

macos2020年10月13日

Get the password of the wifi you're on

password: "!forHackers" `

shell2020年10月13日

Go through a file Git history (GUI)

Go through a file Git history (GUI)

javascript2020年10月13日

How to Create an HTML Element with Attributes in One Line in JavaScript

When working on a JavaScript project, it's common to create HTML elements dynamically. Traditionally, you might use several lines of code to create an element and set multiple attributes…

ruby on rails2020年10月13日

How to find god objects in your project (Rails)

Go to your project root and cd into app/models (using CLI obviously) then run wc -lw \ | sort -u*

vim2020年10月13日

How to quit Vim

1. Install latest version of Vim 2. Open a file in Vim 3. ⌘-Q and close the terminal 4. Reopen terminal

vim2020年10月13日

How to really!! quit vim

In terminal

vim2020年10月13日

How to save a file with sudo in VIM

How to save a file with sudo in VIM

ruby on rails2020年10月13日

HTML forms that submit to another action

I've known for a long time that you can submit values with submit buttons so you can track which button was used to submit the form e.g.

ruby on rails2020年10月13日

If you want to override previously set order

If you want to override previously set order (even through default\_scope), use reorder() instead.

ruby2020年10月13日

Improve Bundler performance

Level up your bundler performance by running bundler tasks concurrently in jobs:

shell2020年10月13日

Kill rails that got stuck

I'd like to kill rails running w/specific port. (My laptop running several rails servers. )

shell2020年10月13日

Kill unresponsive SSH session

Occasionally an SSH session may become unresponsive. If I put my laptop to sleep this happens fairly often. Rather than killing the tab you can use SSH Escape Characters to kill the session

ruby on rails2020年10月13日

Limited has_many associations

Limited has_many associations

shell2020年10月13日

List directory structure except one or more dirs

Ever wanted to display the structure of the current directory except or two directories?

ruby on rails2020年10月13日

List your model names

NOTE: RUBYOPT=-W0 avoids verbosity when running rails command which suppresses warnnings.

shell2020年10月13日

make a pr from command line using hub

install hub first with brew: brew install hub then use a simple command, like at the example below: hub pull-request -m "best pr ever" -b oozou:develop -h feature/awesome-improvements

macos2020年10月13日

My most used slack shortcuts

⌘-K(or T) to open the channel switcher (I navigate channels solely with this shortcut and have my slack set to hide all channels without new messages)

ruby2020年10月13日

optional relation + RSpec w/shoulda-matchers

User 1 - 0..1 Laptop

ruby on rails2020年10月13日

Postgres Functions & Non-sargable Queries

Using postgres functions inside a where clause can make a query non-sargable.

ruby on rails2020年10月13日

PostgreSQL UPDATE Join

This query shows how to use the PostgreSQL UPDATE join syntax to update data in a table based on values in another table. for example;

vim2020年10月13日

Quickly move lines up and down in any Vim mode

I often move lines around in vim so I have created mappings to make this easier. These map to ⌘-j for move down and ⌘-k for move up. Works in normal, insert, and visual modes. vim nnoremap <D-j> :m…

ruby2020年10月13日

Remove ruby 2.6 bundled bundler

Generating a rails 6 app with ruby 2.6+ when you have bundler v2 installed creates unusable binstubs. If you are seeing this error You must use Bundler 2 or greater with this lockfile. you can remove…

shell2020年10月13日

Remove unwanted commit from your branch

Remove unwanted commit from your branch

vim2020年10月13日

Rename files in VIM

Here's a handy function that I use to rename files in VIM (works in MacVIM and Neovim too)

macos2020年10月13日

Reset Postgres table sequence after DELETE

When deleting recent records from a table, you can reset it's sequence counter if auto-increment field continuity is important to you. Consider actions on the following table, users:

shell2020年10月13日

Restore a deleted file in Git

Restore a deleted file in Git

ruby2020年10月13日

Run rubocop against your current branch

Run rubocop against your current branch

ruby2020年10月13日

Run rubocop before commit

Git hooks are super powerful for automating tasks and enforcing coding standards in a Git repository. One common use case for Git hooks is to run automated tests and code analysis tools before…

shell2020年10月13日

Run same command on different input/inputs

If you have to run the same command repetitively over different input/inputs.

ruby on rails2020年10月13日

Scope or scope in Rails

scope :human, -> { user.or(author) } scope :terminator, -> { admin.or(robot) } `

shell2020年10月13日

See deleted files in previous commits [git]

See deleted files in previous commits [git]

shell2020年10月13日

Send messages to Slack using cURL

Slack allows you to send messages via the Webhooks service

shell2020年10月13日

Shallow clone a old repo

If you don't need the full git history for a repo you will be working on you can supply a clone depth to only clone x revisions of the repo.

ruby on rails2020年10月13日

Show TODO and other notes in your Rails app

Did you know you can show all TODOs/OPTIMIZE/FIXME in your rails app with rails notes?

javascript2020年10月13日

Simple Flux architecture with Vue.js

For a small app that only needs a simple state management pattern. I always use one component to hold the state of the app, a container. This act as a single source of truth for an app to refer to…

ruby2020年10月13日

Suppress rspec warnings

$ RUBYOPT=W0 bundle exec rspec spec/ ...

ruby on rails2020年10月13日

Tag rails logs with useful information

Just learned about tagged logging in rails. Did you know you can tag a log by using

vim2020年10月13日

Use capital letters in VIM mappings

NOTE: @joe this solves your problem :D

macos2020年10月13日

Use FFmpeg and Apple Script to compress videos

Build an application you can drag-and-drop videos onto to compress them significantely:

shell2020年10月13日

Use `host` to get more information about domains

You might be using dig to find out A/CNAME/MX etc records of a domain from DNS servers. But if you just want to get a quick overview, use host:

ruby on rails2020年10月13日

Use minItems/maxItems in collection JSON schemas

To make your collection JSON schemas more reilable use minItems and maxItems so that you can trust your API.

vim2020年10月13日

Use Neovim as a git difftool

Just paste this into your ~/.gitconfig

shell2020年10月13日

Using Git's aliases feature

Git allows you to create aliases internally through the config. Your global config should be located here ~/.gitconfig

shell2020年10月13日

Watch CI status on Github

When you have Github's hub installed, you can get the ci-status of your current branch like this:

ruby2020年10月13日

You can use FactoryBot for non ActiveRecord models

You can use FactoryBot's initialize\with* method to initialize an object any way you like which allows you to factorize any of your objects at will

shell2020年10月13日

Zsh function to list file tree

When navigating through directories on the command line, it’s often helpful to see the structure of directories and subdirectories in a "tree" format. While there are plenty of tools out there, such…

プロジェクトをお考えですか?

あなたが構築しているものについてお聞かせください。

会話を始めるhello@oozou.com
OOZOU Logo

バンコク · シンガポール · 香港

X
Facebook
Instagram
LinkedIn

サービス

  • ウェブ開発
  • AI・生成AIソリューション
  • モバイルアプリ開発
  • データ分析・エンジニアリング
  • UI/UXデザイン・プロダクトデザイン
  • デジタルトランスフォーメーション

会社情報

  • 会社概要
  • 採用情報
  • ブログ
  • ホワイトペーパー
  • 事例研究
  • Today I Learned
  • お問い合わせ

その他

  • 業界
  • 見積もりを取得
  • パートナーネットワーク
© 2026 OOZOU. All rights reserved.
プライバシーポリシー行動規範ABACポリシー