Rails: OpenSSL Certificate Verify Failed

I kept getting this error when trying to login to a rails app I inherited:

SSL_connect OpenSSL::SSL::SSLError returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

I believe my specific situation involves trying to login into external services with Omniauth, and the SSL settings related to that are not right.

I tried updating my local certs, installing a new version of OpenSSL, changing a bunch of settings in my environment files, nothing worked. I am not sure why it doesn’t work, but this at least gave me a work-around:

#add this to an initializer in app/config/initializers/yourfile.rb

I added this to my existing app/config/initializers/omniauth.rb file, and restarted the server. If you have a different initializer file (it doesn’t have to be omniauth be any means), you could add this line to it, or create a new one to use just for this like “fix_openssl_verify.rb” or something, and conceivably just gitignore this file so it never ends up on the production server. I don’t recommend leaving the above line of code in your production setup, as it will skip the SSL verification which precisely nullifies the point of having it in the first place.

This fixed my issue so I could at least login and debug my app. I suspect the root cause is not having the right certs used on the server on my local machine and not being able to replicate the production setup in very specific ways or it could be that it is not possible to connect to internet services with my local app. There is a lot of stuff going on in this app that I don’t fully understand yet, but at least I can work on it locally, which is a huge blessing.

Another great resource I found in my travels is Daniel Kehoe’s (railsapps) excellent tutorial on fixing this specific issue. Although in my case it didn’t help me, it seems to be a good solution to many similar issues you may run into.

jQuery: What background images should I pre-cache?

If you’re trying to pre-cache images with javascript, you’ll need to know which images are actually being loaded to add them to your preload array. Here’s how to list image your page is using with a nifty bit of jQuery code.

I am using this code from Stack Overflow to pre-cache images (to make them load faster) in my page:

    function preload(arrayOfImages) {
            $('<img/>')[0].src = this;
    var imgroot = '/assets/img/';

And here’s how to find all the images your elements are using as background images:


Please note that if you are using “background-image” in css, instead of “background”, use that inside .css() instead, like this .css(‘background-image’);

It is good practice to use all background images on elements in your page (or so my front-end guru friend tells me). This code comes in handy when you follow that convention.

The * (the star selector) in CSS means “all elements” so this may make your page lag badly, depending on how many elements it has to go through to find and output the background of. You can use div instead to only get the background images for divs, if that is what you are using. Also, don’t forget to remove this code in production b/c it will make your page lag for visitors.

Galaga Code, Baby!

Screen Shot 2013-03-20 at 5.35.21 PM


This is something that only happens to the geek elite. People recognize your code as a throwback to oldskool nerdy video games. This was just how the code ended up, this isn’t a plant. It was just pure awesomeness at it’s best. The cool kids call this “elegant” code. That’s right. This is how you know you’ve made it into the upper echelons of geekdom.

Back story: David is the best front end engineer I know and a total web dev badass. We nerd out about Doctor Who, sci-fi, code and other geeky stuff daily.

Hello null

Screen Shot 2013-07-26 at 1.40.59 PMVerizon knows me so well. It even calls me null. Awww, Verizon, you remembered!

Being a programmer I love empty values like null and nil. Yes, that was a weird thing to say, whatever. They are your friend. Null and I go way back. Nil and I are new friends.

Keep clear or you should be mad now?

At one of my favorite Starbucks right off the highway on my way to work, there is always a morning traffic jam, to get into the drive thru, for all the sweet sweet javas for your morning. I have stopped there many times, and lately, also at the business directly behind Starbucks, Zanitas, to get really good breakfast burritos on occasion. I’ve been there a few hundred times over the last several years and tried very carefully not to anger the “keep clear” sign painted in giant letters on the road, just as you turn into the Starbucks driveway. Usually, I am in the offending stream of traffic, trying to time it just right and not block the lane of traffic heading out of the block and into the street and onto the highway.

For some reason I have never noticed before stuck me funny this morning. The “keep clear” sign is not painted to be in those are blocking traffic’s view, but in the lane of the people who are being blocked by the traffic constantly sitting in the lane. The “keep clear” sign is literally a “you should be mad now” sign, because it isn’t very apparent who shouldn’t be blocking the lane, because as you’re blocking it, your car is directly over the sign. The people who are blocked from getting to the street are the ones explicitly told not to block the driveway, which seems completely backwards to me.

I can’t wait until someone develops holographic low-energy technology so we can have floating signs precisely where they will be seen at the time when people need to see to stop their horrible behavior, like anyone will pay attention then either, but at least the sign will be perfectly placed and visible. That will be the day my friends.

Lou Xiaoying saved more than 30 babies from the trash

Lou Xiaoying – now dying in her eighties — has rescued more than 30 babies from dying alone in the trash, ever since 1972. She dedicated her life to “recycling human lives” without any resources and little help. I want to spend my life doing things like Lou did. I think about it every day.

‘Even though I was already getting old I could not simply ignore the baby and leave him to die in the trash. He looked so sweet and so needy. I had to take him home with me,’ she said.

‘I realised if we had strength enough to collect garbage how could we not recycle something as important as human lives,’ she explained.

One fan explained: ‘She is shaming to governments, schools and people who stand by and do nothing. She has no money or power but she saved children from death or worse.’

Read the whole story (with excellent photos) at Daily Mail.

I love how every other item on the page is about the most superficial crap, who’s bikini is tinier, and who is showing off their bum on vacation and how hot all the actresses look this summer. Sad commentary on us as human beings.


Reboot the iteration

Welcome to the new rncrtr.in!

I always have a hard time showcasing anything because it changes so quickly for me. I am not your regular “still here trucking along” kind of person. Everything I do is fluid and flexible. Enjoy it while it lasts.

This post is only here so my website won’t be blank until I can generate real content, which I will, but inspiration has to strike me when it does, until then, you get this.

Despite the glaring lack of stuff here now, it smells so SHIIIIIIINY!

facebook: How to show the new social graph search bar if it isn’t there

If you have seen the new Facebook search bar on someone’s page, but it isn’t on yours, there is a good reason for that. The new search is a new technology from Facebook called Graph Search and it is in beta, meaning not everyone gets it right away. You can request access to try it from Facebook by visiting here: https://www.facebook.com/about/graphsearch

Once approved, you will get the new search bar, but it can take several days to a few weeks or longer to hear back on it. Patience is required it seems.

windows XP doesn’t support more than one ssl cert per server

If you have more than one SSL certificate on your apache web server, you should know that Windows XP does not support SNI (Server Name Indication) which is a required apache extension to allow users of IE8 and Safari to find the correct certificate in a multiple cert environment. It seems to grab the first cert listed alphabetically by domain, regardless of the cert you’ve explicitly defined in the virtualhost file. Apparently this isn’t an issue in modern versions of Firefox and Chrome that run on XP, just IE8 and Safari (which I suspect uses some part of IE to work on Windows).

I know what you’re thinking. No one should be using XP or IE8, it is not secure and, just plain…stammer…old. Yes, of course you’re right, but many people still use both, regardless of the high ideals of developers. I might be looney, but I still fancy me a quick jaunt over to XP on occasion, you know, on the weekends or when the wife is out of town. I still like it for all its outdated charm. That blue toolbar just gets me all hot and bothered. Not really. Well, actually a little. I get tired of gray and taupe and other “soothing” colors. Bright in your face blue is sexy. What? (Glances over shoulder). XP does have some uses for a technophile and dinosaur-era oldskool gamer like me. Certain things only work on old and busted you know.