Developing Rails apps with SSL

Dough, mud and penguins

I’m working on some federated authentication (single sign-on) for 3rd-party applications and thought to use Ruby on Rails as a simple way to demo and develop the principles.

This is Rails, so it’s not entirely straightforward(*) but manageable on a Linux host.

In development mode, the default Webrick server does not support SSL, but a decent alternative is thin (https://github.com/macournoyer/thin) which also requires eventmachine.

To use thin with SSL we need to generate a self-signed certificate,

$ openssl req -newkey rsa:2048 -nodes -keyout neopir.key -x509 -days 365 -out neopir.crt Generating a 2048 bit RSA private key .....................+++ ..........................................+++ writing new private key to 'neopir.key' ----- You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank…

View original post 140 more words

Common git screwups and solutions

Ruby on Rails Blog

I was looking to learn a bit more about the parts of git I’ve not ventured into yet. What better way that looking the most common ways people screw them up and how to fix the resulting problems! Here’s a short list, compiled from my own experience and issues I’ve come across on the Internet.

I wrote the wrong thing in a commit message

If the commit hasn’t been push you can do the following, which will allow you to edit the message on the most recent commit:

git commit --amend

How can I undo the last commit?

You can use git reset e.g.:

git reset --hard HEAD~1

HEAD~1 means HEAD-1 commit. It should be noted that this is the nuclear option, and any changes you made will be discarded. If you want to keep your changes in the working tree use:

git reset --soft HEAD~1

If you’ve already published…

View original post 593 more words

What the Heck is Shadow DOM?

Dimitri Glazkov

If you build Web sites, you probably use Javascript libraries. If so, you are probably grateful to the nameless heroes whomaketheselibrariesnot suck.

One common problem these brave soldiers of the Web have to face is encapsulation. You know, one of them turtles on which the Object-Oriented Programming foundation sits, upon which stands most of the modern software engineering. How do you create that boundary between the code that you wrote and the code that will consume it?

With the exception of SVG (more on that later), today’s Web platform offers only one built-in mechanism to isolate one chunk of code from another — and it ain’t pretty. Yup, I am talking about iframes. For most encapsulation needs, frames are too heavy and restrictive.

What do you mean I must put each of my custom buttons in a separate iframe? What kind of insane…

View original post 1,301 more words