Blog logoMatthew Lang

Web Development

A 3 post collection


Scaling Back

 •  Filed under Posts, Tools, Web Development

For a long time I've wrestled with a number of different terminal apps and tools in the hope of improving my productivity at the command line. Initially I used iTerm2, a terminal emulator for macOS, as my preferred terminal app. Then I also started using tmux, a terminal multiplexer, on top of that. Then came along Vim, the open source text editor, and I started using that as well.

This was the first time in a long time that I had started using all three again. The benefit of using this combination of tools is that I could run both my command line and text editor within a single app and very rarely have to switch away from it.

One huge pain point I couldn't get round though was the simple act of copying and pasting text between Vim and other apps. Despite a number of attempts to get it working I've decided to call it a day on this trio of tools.

  • Vim is a great text editor, but to be honest I'm faster coding with Sublime Text or even Atom for that fact. Yes, I use the mouse and yes I want to have features and plugins that don't require me to mess about with command line.
  • tmux is great for managing different command line sessions within a single terminal emulator but I don't think it's a necessity. Lately I've been doing away with split panes and using multiple tabs.
  • Which brings me to iTerm2. As great an application as it is, there's nothing that it offers that I can't get from Apple's own terminal emulator, Terminal.

So I stopped using Vim, tmux and iTerm2 and fell back to using Terminal and Sublime Text.

I've went full circle from starting with the basics, adding more tools to the stack, before reducing the tools I need for the terminal right down to the absolute basics. One app for the terminal and one app for editing source code.

I can see the case for using tools like tmux and Vim. Maybe you spend most of your day in a terminal as a system administrator and you're faster with Vim. Maybe you need to manage multiple servers on a daily basis so splitting panes in tmux suits your line of work. I get it. I understand why these tools exist and why you would use them.

Sometimes though scaling back is just as much a benefit.

Has Web Development Gone To Shit?

 •  Filed under Web Development

There was me thinking I was absolutely bonkers for not falling head over heels in love with the current trend towards towards JS web frameworks.

The web (specifically the Javascript/Node community) has created some of the most complicated, convoluted, over engineered tools ever conceived.

The Sad State of Web Development by Drew Hamlett

I do like Drew's advice for web applications that have one or two pages with a complex user-interface.

So my advice is to use Rails Django, Play Framework, or Phoenix to develop most of the app, because they help you with most of the boilerplate stuff, and bring in the flavor of the month on a page that needs it. So when the next flavor of the month comes out you’re entire app is not knee deep in the last flavor of the month. You can just re write that one page.

The Sad State of Web Development by Drew Hamlett

How to Run Cheaters with Pow

 •  Filed under Daily Post, Web Development

Brett Terpstra released a new version of his Cheaters cheat sheet system. Brett recommends two options to get this running. The first is using the Automator application in OSX and the second is using the Fluid app.

The one change I wanted to make was to make Cheaters run as a local Rack web application with Pow rather than from the already installed Apache instance. It's easy to do.

1. Create a Gemfile

Create a Gemfile within the root of the Cheaters source and include the Rack gem:

gem 'rack'

Jump back to the command line and run the bundle command to install this gem.

2. Create the Rack App

Next create the Rack file that will serve all the pages and assets from the Cheaters source. I've used this same code for lots of Rack applications.

require 'rack'

$stdout.sync = true

use Rack::Static,
  :urls => ["/css", "/js", "/images", "/cheatsheets"],
  :root => "."

run lambda { |env|
[
  200,
  {
    'Content-Type'  => 'text/html',
    'Cache-Control' => 'public, max-age=86400'
  },
  File.open('index.html', File::RDONLY)
]}

Put this in the root of the Cheaters source.

3. Symlink Cheaters

Now I'm assuming that you have Pow installed already. With Pow installed, change to the pow directory and symlink your Cheaters directory:

cd ~/.pow && ln -s /path/to/cheaters

I also use an app called Anvil that gives me access to my running web applications in Pow from the menubar. This can also create the symlink for you if the terminal is too scary.

Done!

That's it. Now if you visit http://cheaters.dev, you'll find the Cheaters page. The reason I prefer this is that I already have a number of application running locally that I like to use, so running it from the browser is fine with me.