-
String#tr in ruby (like tr in Linux) complete with figuring out slashes.
It seems like I’ve seen quite a few programming puzzles in the last few weeks that involved translating mistyped input in which the hands were shifted (right) on the keyboard. My first thought was the tr utility in *nix operating systems, but didn’t immediately go looking for or notice that ruby has a tr method…
-
mkdir with intermediate directories and rails generate view spec
I’ve been running into a lot of cases where I need to build intermediate directories for a path. Apparently, the correct option is -p mkdir -p dir/tree/to/make From the mkdir man page: -p Create intermediate directories as required. If this option is not specified, the full path prefix of each operand must already exist. On…
-
Script to Change the Title of Your Terminal Window
I decided to create a small bash script to change the title of my current terminal window in bash on my Mac: change_title: #!/bin/bash echo -ne “33]0;” $* “07” The script then runs as: change_title Your title goes here.