Bits and Blocks

Variable Naming Cases

1 minute read Published:

There are a number of ways to make variables readable, and also to distinguish what variable types you might be working with. These things change from language to language, but it’s nice to have a common set of vocabulary to refer to them. I find that I’m sometimes forgetful of how to actually refer to any given case, so here’s a quick reference. Case Example Snake Cases snake_case Camel Case camelCase Pascal Case Pascal Case Kebab Case kebab-case I’ve found that I often want to be able to switch from one to another, and that there’s always a solution already in existence, the most helpful thing is knowing what to call it for the sake of googling.

Github Pages With Apex Domain

2 minute read Published:

www and apex domains pointing to github pages
Saving time and money with GitHub Pages I know that GitHub Pages are nothing new, but I only recently realized how versatile they are. You can host any static content you want there for free, and I’ve recently started using it for my blogs. Major benefits of using GitHub Pages as I see it: Free hosting for simple pages Deployment is as easy as a git push SSL certs are a one time checkbox It handles redirecting to the www subdomain, or to the apex domain without no real configuration My default configuration You just have to set up the DNS.

Github Pages With Apex Domain

2 minute read Published:

www and apex domains pointing to github pages
Saving time and money with GitHub Pages I know that GitHub Pages are nothing new, but I only recently realized how versatile they are. You can host any static content you want there for free, and I’ve recently started using it for my blogs. Major benefits of using GitHub Pages as I see it: Free hosting for simple pages Deployment is as easy as a git push SSL certs are a one time checkbox It handles redirecting to the www subdomain, or to the apex domain without no real configuration My default configuration You just have to set up the DNS.

Serving Localhost to the Web with Reverse Ssh Tunnels

2 minute read Published:

So, you have a webpage on your computer you want to show to a remote person?
Note: If you don’t have a server already, check my last tip. This topic is always a little tricky, so, here’s the basic thing to know, as this is the most frequent use case. Suppose you have a development rails server running on your local computer. You can access this server via curl http://localhost:3000. Which is to say, it’s running on your localhost, on port 3000. You want your client to see it, to give you feedback, but they’re nowhere near you, and you just want a quick way to show it to them.

Saving Time With Tmux

3 minute read Published:

How I use tmux in my workflow to make my life better.
What is a terminal multiplexer, and why do I care? When you split up a terminal screen into sub-terminals, that’s called terminal multiplexing. This is nothing new, GNU Screen has been around since 1987. Tmux is just screen’s younger, nubile cousin. I’m about to explain how this simple technology can: Keep you organized. Lower the bar to get to work. Save you time. Enable teamwork. Here’s a quick demonstration:

Exporting A Zone File From Mediatemple

1 minute read Published:

How to get DNS info out of MediaTemple
I was in the process of moving my DNS from MediaTemple to Route53 and was having trouble making sure I’d moved all of the entries. I decided I’d just export a zone file to do a comparison in a text editor. Surprise! You can’t. Instead, here’s a quick bit of jQuery, which is already available in the MediaTemple control panel. Just navigate to the zone file editor, open your console, and use this:

Reducing The Size Of Alpine Docker Images

1 minute read Published:

Why the heck is my alpine docker image so huge? That’s a tough question to answer, especially when you have no idea what’s taking up all of the space. This is a dirty little one-liner that yields a sorted list of all of the packages on your alpine image by size. It does this by Getting the complete list from apk info Iterating over the results to ask apk for its size Removing the blank lines Combining the size lines and the name lines Sorting by size apk info | while read a; do apk info -s $a; done | awk NF | sed 'Ns/\n/ /' | sort -k4 -n It may be ugly, but now I can make an informed decision about wether or not there are binaries that can be axed.

What Process Is Hogging My Port On Mac Os

1 minute read Published:

Address already in use Damn. Did I leave a server running somewhere? Sometimes you’re not sure where you left a server running, or where something is running you never knew about. I’m finally writing this down, as I always have to look it up. I found this solution in a StackOverflow post. Here’s how to get all of the processes by what port they’re using. sudo lsof -iTCP -sTCP:LISTEN -n -P As A Shell Function Looking at it, I realized I would never remember it, given how infrequently I need it.

Why Choose Vim

3 minute read Published:

TLDR Choosing a text editor is a very personal decision. You grow with your editor, as your editor grows with you. As I use my text editor more and more over the years, I’m constantly constantly learning new techniques for working more efficiently. Some of them stick, others are forgotten. I find that sequences and shortcuts that I most use stay. But just as importantly VIM accommodates my changing needs through configuration, plugin, or otherwise.

A Single Singleton in Ruby

4 minute read Published:

What is a singleton anyway?
The singleton design pattern I’m relatively new the the concept of the singleton, even though I’ve been programming for a number of years. I’ve run into several instances in which I new that this was exactly what I needed, but did not have a name for it. Here, I’m going to try to explain it to myself a year ago. There are a few questions I’ll try to address.