PHP has a useful getallheaders() method that returns a request’s HTTP headers
as an array. I was using this for my organization’s CMS to check the origin of a
request so I could enable CORS for whitelisted origins. It worked fine on my local
machine, but when I deployed it to production it returned a 500 error. The only
difference between my local installation of the CMS and the production environment
is that I’m running Apache on my machine, but the server is running NGINX.
I ran into a frustrating bug in Internet Explorer the other week, and I wanted
to document it here, both for my own recollection and just in case someone
else stumbles upon this post and finds it helpful.
It’s possible to specify both the view and the layout when calling the render method in a Rails controller. Most examples of using the render method (at least that I’ve seen) only show how to specify the view, defaulting to the layout defined for the whole controller or application:
One of the most frustrating limitations of less-than-modern browsers is their
inability to easily vertically center align content. I’m not the first to write
about this, and there are many different strategies out there already. I’ve tried
several over the years, looking for an as-close-as-possible pure CSS solution that
is cross-browser compatible (I’m one of the unlucky ones who still needs to support
IE8). Flexbox has solved this issue for the latest modern browser versions,
but cross-browser support is still too lacking for me to implement it in my work.
I think I’ve arrived at a good solution that relies almost entirely on CSS and
only requires minimal JS to handle IE8 and cases when the content’s height
exceeds the height of its container.
I’ve been working on a proof-of-concept for a fixed navigation bar that is partially
hidden/revealed in response to the scroll direction. I don’t know what the correct term is
for this type of navigation interaction, so for now I’m calling it “semi-sticky”.