Amazon identifies every product for sale with a ten-digit alphanumeric code called an ASIN (Amazon Standard Identification Number). Whenever you visit a product page on Amazon, these number is somewhere in the URL; however, it's not always in the same place in the URL. This makes it a little bit hard to pull the ASIN out of an arbitrary URL.
Sometimes you need to add some special functions to your Ruby on Rails app, and you want these functions to be available everywhere in your application. In cases like these, you can put your code somewhere in Ruby on Rails's load path, and it will be loaded automatically without you having to "require" it in any of your other files.
Making OpenResty and Passenger work together isn't too hard, but it's not obvious how to do it. There's a lot of guides for getting Passenger to work with Nginx, but the process for OpenResty is a little different. For that reason, I'm documenting how I got them to work together here.
While checking out my Google Analytics data, I noticed a couple strange language codes. Language codes are strings like "en-us" that a browser sends to a server when requesting a web page to let the server know what language the browser's user prefers. The server then uses this information to return a web page in the appropriate language if it's available.