A lot of times we don’t have the luxury of being able to hire a full time server admin or ops person. That’s alright though! It isn’t hard. As a developer, if you’re comfortable on the command line you can competently manage a server of your own. The two places I always look first when setting up a new server are the Linode quickstart docs and this article. The rest you’ll learn on the job. This is just a link post but if I had to give someone one piece of advice about managing servers it would be this: focus 90% of your energy on security, triple check your iptables, and, if you’re managing servers for a company, hire someone who specializes in it ASAP.
Imagine you’re working with a new framework or library for your next project. You discovered the perfect tool. The README is perfect – not too much detail, not too little either. You’ve breezed through the installation and setup process, committed to using this new package, and suddenly you encounter a problem the README doesn’t cover. No problem, you’ll just head over to the official docs. What you find there makes you want to murder the original author. It’s auto-generated documentation. Friends don’t let friends generate docs.
Rails has a really helpful (but not well documented) token authentication mechanism you can use for authenticating your API users. But Rails is overkill for many APIs and so I usually turn to Sinatra. Sinatra doesn’t have much selection when it comes to API authentication. At least not the secure methods I’m interested in. So for my company’s new insurance quoting and licensing API I rolled my own. Here’s how to implement secure token authentication in a Sinatra app.
Ever used a Node.js module that was instantiated like so:
something = new Something(). We’re used to it with built in types like
Date() but how are the developers of Node modules doing this and why would you want to?
If you’ve used Node for any amount of time you’ve probably worked with the
http module. In most cases people use it to create their own server applications or for interacting with remote APIs. Using it to make API calls is pretty straightforward but if you’re using a newer version of Node (0.10+) then you may be tripped up when you get 400 Bad Request responses from the endpoint you’re communicating with. Here are the two trickiest issues I’ve come across. Hopefully this will help someone else who is scratching their head when they get these mysterious 400 responses back after making what would seem to be a perfectly valid HTTP request.
When used wisely, metaprogramming in Ruby can be one of the language’s most useful features. During the development of my latest project I had a need to take the results of a very complex MySQL query and turn a string into a hash. Here’s how.
Nokogiri will almost always throw some error on you when installing it. I’ve got a new MacBook Pro with a pretty clean slate here so here’s the easy way to fix that.
I’m currently working on a project that’s very service oriented. That is, we’re building an app through smaller components that fit together to run a larger app. This lets me write small, focused code and use different languages and tools very easily on the backend while end users see one unified app. This isn’t always the best way to do things and there are pros and cons in the monolithic vs. microservices debate but in this case it works well for us. One problem I’ve faced, however, is how to manage our front-end assets that are shared between multiple projects. There are a lot of good options for solving this problem but in the end I chose Git’s subtree feature. Today I’ll give an overview of what the other options are, why we chose subtree over them, and how to use Git subtrees to manage a shared dependency.