Articles tagged 'instructions'

  • Set up ssh public/private key for no password prompts

    November 23, 2011


    This post was originally published in the Rambling Labs Blog on November 23, 2011.


    It’s been a while since my last post. I’ve had a busy couple of weeks. But here I am again :).

    Last week, I was setting myself up for a couple of features that I have to add to a project. I had ssh access (which is a good thing), but I was getting tired of typing in my password each and everytime I tried to connect to the server. The solution to this is fairly simple.

    • First, be sure to have your public ssh key in hand or generate your own with:
    ssh-keygen -t rsa -C youremail@yourdomain.com
    

    Be sure to generate it with no passphrase (remember that our goal is never get prompted when connecting through ssh).

    • Then, on the server, make sure that there…

    Continue Reading →

  • IE and the flash "wmode" madness

    November 23, 2011


    This post was originally published in the Rambling Labs Blog on November 23, 2011.


    One of the reasons that didn’t allow me to release version 0.1.3 of the jQuery Rambilng Slider earlier this week was a really ugly bug with IE, flash and transitions from and image to a flash element and viceversa.

    The problem: There are some transitions on the slider that require an image (or several) to be on top of the flash, so that it fades out and reveals the flash. This works fine on Firefox and Chrome, but when the time arrived, it just didn’t work with IE.

    I did a lot of googling and the only thing that I found over and over again was to include a param tag inside the object tag, with a name of wmode and value of transparent or opaque and to add…

    Continue Reading →

  • Stripping down Rails 3.1: Using only the database migrations

    November 23, 2011


    This post was originally published in the Rambling Labs Blog on November 23, 2011.


    The current project I’m working on is not using Ruby on Rails, but I still want to use ActiveRecord Migrations for the database changes.

    There are some options out there for this, and most people that I read about and had this issue just use the activerecord gem and set up their rake tasks.

    I don’t want to write my own rake tasks, since I feel that I would be reinventing the wheel. So what did I do? I created a new rails application, and stripped it down, removing everything that is not needed to run the migrations.

    First, I created a rails application called ‘deploy’ on the root folder of the application with:

    rails new deploy
    

    Then, I removed all the…

    Continue Reading →

  • Deploying on shared servers with git

    November 23, 2011


    This post was originally published in the Rambling Labs Blog on November 23, 2011.


    There’s a project I’m currently working on, which is right now hosted on shared servers. I worked for a little while before on this project, but just to add some tiny features and fix some bugs, so I didn’t have the need back then to have a deployment process all set up.

    But now, I’m probably going to be working for a couple of months on this, so I figured it would be better for my own sanity to just set everything up from the very beginning, to make the deployment process as easy as possible.

    I googled for a while and the people seem to be using git for this. Now, there are a couple of options out there. There’s resmo’s git-ftp which is a git powered…

    Continue Reading →

  • Adding custom method calls to the jQuery Rambling Slider

    November 12, 2011


    This post was originally published in the Rambling Labs Blog on November 12, 2011.


    The jQuery Rambling Slider v0.1.2 was released a couple of days ago. One of the features added was the ability to start and stop the slider like this:

    $('#slider').ramblingSlider('stop');
    $('#slider').ramblingSlider('start');
    

    Every serious jQuery plugin has some way to change it’s behaviour or query some data after initialized and the general approach for this is calling the custom methods as showed above.

    It is well known that in order to do this, you have to perform some dynamic method calling magic. This is what you find in the jQuery documentation:

    (function($){
      var methods = {
        init : function(options) { /*...*/ },
        show : function() { /*…

    Continue Reading →

  • Rails 3.1 - will_paginate and AJAX

    November 10, 2011


    This post was originally published in the Rambling Labs Blog on November 10, 2011.


    For a project that I’m currently working on, I have a couple of list views that needed pagination. So I went with the ol’ will_paginate gem (which I first saw years ago when I didn’t even consider myself a developer) to take care of this.

    It’s as simple as including a line with gem 'will_paginate' on your Gemfile, running bundle install, and include this in the controller:

    class OrdersController < ApplicationController
      def index
        @orders = Order.paginate(page: params[:page], per_page: 10)
      end
    end
    

    And this in the view orders/index.html.erb:

    <div id="orders">
      <ul>
        <% @orders.each do |order| %>
          <li>
              <!-- Show order stuff -->

    Continue Reading →

  • Unit testing the jQuery Rambling Slider - Part 2 - The DOM, jQuery and node.js

    November 9, 2011


    This post was originally published in the Rambling Labs Blog on November 9, 2011.


    In order to continue to add tests to the jQuery Rambling Slider, I needed to test something against the DOM. Problem is, you don’t count with the DOM when you’re running the Jasmine tests from console. So what should I do?

    As expected, I found that there is a DOM emulator in node.js :D. Also, to test using jQuery I needed to download the corresponding node package. So I didn’t waste any time and went ahead to install them:

    npm install -g jsdom
    npm install -g jquery
    

    So now, I can write something like this in my src/jquery.plugins.coffee:

    (($) ->
      $.fn.reverse = [].reverse
    )(jQuery)
    

    And test it on my spec/jquery.plugins.spec.coffee with something like this…

    Continue Reading →

  • Unit testing the jQuery Rambling Slider - CoffeeScript, Jasmine and node.js

    November 9, 2011


    This post was originally published in the Rambling Labs Blog on November 9, 2011.


    As you may know, I have been working lately on the jQuery Rambling Slider. One of my personal milestones with this project is to write as many unit tests as possible, so I began my research.

    Honestly, I didn’t know where to begin. I remember to have read once on twitter that someone was writing their tests with Jasmine and CoffeeScript, so that could be a good starting point (and it sounds really fun too!). I have worked with Jasmine before and it sure was a great experience. It’s yet another productivity tool made by the great Pivotal Labs guys.

    After googling for a while, I stumbled into a post from someone that was writing tests in Jasmine and node.js

    Continue Reading →

  • Installing the capybara-webkit gem

    October 31, 2011


    This post was originally published in the Rambling Labs Blog on October 31, 2011.


    To install the capybara-webkit gem, you need to have the libqt4-dev installed. So run:

    apt-get install libqt4-dev
    gem install capybara-webkit
    

    You should be good to go!

    Continue Reading →

  • Rails 3.1 - Translating routes

    October 26, 2011


    This post was originally published in the Rambling Labs Blog on October 26, 2011.


    Today, I was wondering if there would be a way to add translated routes automatically in Ruby on Rails. This is for a project I’m currently working on, whose users speak mostly spanish, so I want to make them happy with urls like “/contacto”, “/quienes-somos” and “/trabajos/1” instead of “/contact”, “/about-us”, and “jobs/1”.

    So, I googled and there it was: the i18n_routing gem.

    This reminded me one more time how awesome is the Ruby community, which is definitely one of the main reasons why I’m loving Ruby and Rails so much.

    So back on topic, the gem is easy to install, and only depends on the i18n gem. Run gem install i18n_routing and you should be good…

    Continue Reading →