How To Force SSL With Apache

On the Internet, all traffic in the 21st century shall be encrypted. That’s easy to do with Apache. Follow these instructions to force all traffic to the SSL pipe. Rewrite Engine On RewriteCond %{HTTPS} Off RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R,L] Now any request that isn’t on https is redirected to https. This solution is port, host,

How to Tell Which Line You’re on with ‘vi’

I don’t use vi enough to be proficient with it. I use it nearly daily, but only in the most basic way possible. Whenever I have to do anything beyond ‘:q,’ ‘:wq,’ or ‘:q!’ I have to google it. I needed to know which line I was on in vi. :=. That tells me which

How to Use a PHP Closure to Implement a SoapClient Method Staggering Retry

The Problem I ran into an situation where I have to interact with an extremely unreliable SOAP web service using PHP’s SoapClient. I needed a way to consistently retry failures before eventually dying if it doesn’t ever succeed. I prototyped this using procedural code, but when I implemented it for real, it was in object-oriented

How-To: Git Merge

I create a lot of Git branches. Every change I do is a branch. That means I perform a lot of Git merges. Here’s how I do it. Read about my Git workflow here. Assume there’s a dev branch called ‘Fingerboard’ that I need to merge into ‘master.’ The Fingerboard branch has been committed to

The Perfect Git Workflow

I have concocted the world’s most perfect Git workflow. Here it is. Spoiler, it’s actually not perfect, but it works for me. In Git, there’s the concept of a master branch. Master is merely the first branch Git creates. Git might as well called it “Pippy Pee Pee Diarrheastein Poopypants Esquire.” But Git didn’t do

Pass node arguments to PM2

What I used to do with Perl or shell scripting, I do with Node.js. Here’s how to pass node arguments to a pm2 start command. I have Node.js application that uses garbage collection. For it to work, I have to pass the –expode-gc node command-line argument. Since I use pm2 to manage my Node.js applications,

How to Merge Files Without Using Merge

I use a Mac almost exclusively for development. Mac doesn’t come with the Linux merge command and sometimes I need to merge text files. It’s pretty easy to do using diff and grep. I’m going to show you how to merge the changes from two files into one. I’ll use file1, file2, file3 and file4

Edit Eclipse Generate Getter and Setters Format

For me, I like to always return $this when creating a setter class method when coding PHP. For example, to set an object to be freaky, I would create method like this. /** * Set to freaky or not freaky. * * @param boolean $freaky * @return $this */ public function setFreaky($freaky) { $freaky ===

How to Make Eclipse IDE Faster

While coding the other day, Eclipse was running like shit. It was slow as hell. I couldn’t get anything done. I did all of the updates to Eclipse and even rebooted. It didn’t it help, it was dog ass slow. Checking my laptop resources, it was all fine. Researching this issue, I found out about

Configure Composer to Allow for dev-master

By default composer doesn’t allow you to install packages that are dev-master, but it’s easy to change that behavior. When you install a package that only has a dev-master version and it fails, you need to update your composer.json. It’s easy to fix this composer error. In your project’s composer.json, set “minimum-stability” to “dev.” Your