Recent Posts

Language Specific Indents In Sublime Text 2

Ask any developer spaces or tabs and you’ll get different responses. I was hardcore in the tabs camp until recently. Now I’m trying to use spaces. The biggest issue with using spaces 100% was my text editor. I use Sublime, and tried to set it to use spaces by default, but couldn’t seem to get it to work (later I would find out it was a mis-typed option). So every time I would create a new document I would set the tab size (2 for Ruby, 4 for PHP and Python) and covert it to spaces. Half the time I would forget to do this, so I would end up with projects half in spaces and half in tabs. Today I finally got sick of doing this every time, so I set out determined to figure this out once and for all, and I did.

Continue reading

Securing Your Passwords

Today TutsPlus Premium got hacked. They used a third party plugin that stored passwords in plaintext. This is ironic, because NetTuts+, a sibling company posts about security once in a while. It’s also very frustrating for users (both present and past) because they have to change their password not only on Tuts+, but other sites as well.

Continue reading

Parallel Processes In Bash

I wrote a script to speed up MySQL imports. I’ll write more on this later, but for now I want to focus on background and parallel processes in Bash. Part of the script loads tables at the same time, trying to speed up the import. You can have multiple processes in Bash by sending them to the background using the & character.

Continue reading

Why You Should Write Tests

Last week I started writing tests for my framework. I’ve got to be honest, I rarely write tests for my code. This was the first time I really wrote tests, but I recommend it.

Continue reading

Getting Around CORS in CloudFront

We ran into an issue at work the other day with CloudFront and S3. We were trying to load assets via Ajax from our CloudFront distribution, but kept getting an “Origin http://example.com is not allowed by Access-Control-Allow-Origin” error. There is a W3 spec called CORS (Cross-Origin Resource Sharing) that prevents retrieving data from another site. To get around this, you would normally set an “Access-Control-Allow-Origin” header, but S3 limits the headers you can set, and that’s not one of them. I’m not the only one who finds this problem annoying. Amazon has said there are plans to implement this feature, but they also said that two years ago..

Continue reading