Subscribe

  • Html5-boilerplate gem and no more posting/deleting etc.

    For no apparent reason all the post/delete/put requests I was doing in my brand new Rails project where failing… Forms would not create anything. The problem only appeared occurred on my live server running Phussion Passenger. No issues on WEBrick.

    After a little searching I found the issue in the .htaccess files. Created by the html5-boilerplate gem in /public/.htaccess.

    Comment the following lines on line 348 and the problem goes away:

    <IfModule mod_rewrite.c>
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/|#(.*))$
      RewriteRule ^(.*)$ /$1/ [R=301,L]
    </IfModule>
    

    I’m guessing the other rewrite rules are problematic as well. A better fix would be to only rewrite when using GET.

  • TTResponds update

    I’ve updated TTResponds to include some requests people have made.

    • You can now specify if you want to send HTML emails.
    • You can set the sheet being used for the form (defaults to the first one).
    • You can limit the amount of emails being sent. Just the first 10 entries for example (-1 is unlimited).

    The script has been submitted to the Apps Script Gallery, but may take a while to appear. You can grab it right now from Github.

    Notice: if you’re already using a previous version of the script. Remove the config sheet. Open the scripts editor, copy-paste the new script over the old one. Run the createMenu method. And then select Create config from the TTResponds menu item. This will make sure the new configuration options appear on your configuration screen.

  • Omniauth strategy for Google OpenID+OAuth Hybrid Protocol login

    Quite the title and quite cool to use. The Hybrid Protocol combines OpenID and OAuth in such a way that with one flow you can ask for authentication (and get someones account information, like name and email) and authorization (a token) for a set of services specified in a scope.

    Apart from providing a much cleaner user experience, it’ll save you a bunch of code. Especially via Omniauth.

    I’ve created a fork (read update) that contains the google_hybrid strategy and an example project that implements it.

    UPDATE: My strategy just got merged into Omniauth’s master branch. So just use Omniauth instead of my fork.

    To see how it works, try this demo.

  • Dropbox Chat

    Have you ever wondered how well Dropbox would work as a chat application? I did and I finally created a client for it. The concept of having Dropbox handle all the complicated server side stuff is very appealing and actually works quite wel.

    The use case I can imagine happening is that you want to share and store quick conversations you have with co-workers/friends while working on a project. Instead of navigating to Basecamp, emailing (which is less direct) or copy-pasting chat logs, you can just open the Dropbox chat client and have a short conversation. The chat log is right there in the same folder and the only thing you have to do to get it to work, is drop the application in the Dropbox project folder you’re working on.

    The experiment is really easy to setup. Just clone/download the repository on GitHub. Put the folder in your Dropbox folder and share the folder with your friends.

    To run the application open a terminal window and navigate to the folder you just shared. Like this for instance (don’t type the $ sign):

    $ cd ~/Dropbox/Projects/DropboxChat
    

    Now run the application.

    $ ruby chat.rb
    

    If it throws an error, this means it might need to install some additional libraries called gems.

    $ gem install [gem name]
    

    After it starts it’ll prompt you for a nickname, pick something original and that’s it. Just start typing .

    Dropbox chat

    Dropbox chat

  • Maintenance page while deploying with Capistrano

    I got tired pretty fast of staring at Passenger’s 500 errors while Capistrano and Rails are busy setting up a new release of a project.

    Of course other people got tired as well and came up with numerous fixes. The one I like best is where you first put up a maintenance page, deploy and after all went well, remove the maintenance page. Kind of like how Apple disables the store when they’re adding new stuff, but less flashy I suppose..

    It’s pretty easy to do this and I’m just going to provide two links that explain it very well. One for Apache and one for Nginx. They’re both very similar and you can easily pick either of the deploy.rb parts.

    That’s about it. It’s very easy to do and probably something a lot of people know already, but definitely something that’ll make you feel more comfortable while deploying.