Freelancing with Fiverr

I've recently been using Fiverr to explore making money as a Freelancer using my web development skills. Here's a little guide I wrote as I went along, explaining the process.

Get aquainted with Fiverr

Create your account on Fiverr and explore what other people are offering in your space. For me, a search for "Ruby", "Rails" and "Web Development" yielded lots of active gigs offering the kind of services I would offer. Note things you like about their gigs, check their reviews, and use their pictures as inspiration for your gig.

Barcelona Jobs Roundup: May 2015


Here's a post taking a look at the Barcelona tech job market, for the month of May 2015. Mainly focused on Ruby jobs, with a sprinkling of JS ones.
Know of any other offer I've missed? Say so on the comments and I'll add it to the list. 
Interested in being featured here? Contact me on Twitter, let's talk.

    Setting up Atom for Rails Development


    In the vein of these Sublime Text 3 recommendations for Rails development, here's my Atom setup for developing web apps.

    After using Sublime and Vim for several years, I switched to Atom a year ago, and have not missed one feature from the other two so far. Since Atom is in continuous development by the core team and the community, it only gets better as time passes. Also, it's free.

    First, an FAQ/C:


    Packages

    No need to install any package manager for Atom. The editor is composed of over 50 open-source packages, and so the package manager is built in. There's a phenomenal package repository online, or you can search for them directly on Atom's Settings -> InstallAnd, since Atom is open source and built using web technologies, creating new packages or extending exiting ones is easy. Here are the ones I use:

    Develop your app on the cloud with the Nitrous.io web IDE

    Seeing how running Rails on Windows is not everybody's cup of tea, here's a quick guide on how to run your app on Nitrous.io, a cloud development box that you can access from wherever you have a browser. Yes, even Chrome OS.

    This guide uses a Ruby on Rails app as an example, but Nitrous.io supports NodeJS, Python/Django, Go, PHP and Meteor apps out of the box.
    • Signup on Nitrous.io with GitHub to make this easier later on.
    • Create a box for your Rails app, pick a nice name for it:

    • I suposse you're doing some top-secret cool stuff. so click on your newly created box, then on "Reveal public key", and add the key to your GitHub account so you can clone your private repo:

    API authentication with devise_token_auth

    This post is part of an ongoing feature about creating a social network in Rails.

    Any modern Rails web app will need an API to power mobile and/or desktop clients, and maybe even a SPA later on. The devise_token_auth gem adds API user authentication to our app with minimum effort and total configurability. Here's a quick guide on how to set it up, together with solutions to the gotchas that come with it.
    We start on our Gemfile, as usual:
    gem 'devise'
    gem 'devise_token_auth' # Token based authentication for Rails JSON APIs
    gem 'omniauth' # required for devise_token_auth
    

    Install Ruby on Rails in Windows —and Postgres, and Mongo, and Redis...

    Googling "setting up rails on Windows", this is the second result, by @erikjansson
    After spilling half a glass of water on my work Macbook Air, I set out to setup Rails on my PC once and for all. Having tried solutions like Nitrous.io to varying levels of success, I decided that noting would cut it like the real deal.

    A Social Network In Rails: a gem by gem guide

    I'm writing an in-depth guide on building a social network with Rails, one gem at a time. Here's what I've got so far, would love to have some feedback!

    1. 5-minute Setup with RVM and Railsbricks
    2. Photo upload with Refile (coming soon)
    3. Testing: Fixtures
    4. Elegant permalinks
    5. Activity Feed
    6. Comments
    7. Notifications (coming soon)
    8. Follow/mention people (coming soon)
    9. ...
    I'm compiling and expanding these blog posts into a book via Leanpub, A Social Network in Rails, subscribe to be updated of its progress here.

    Fixtures in real life, part 1

    If you came here looking for these kind of fixtures, good luck on the way out ;)

    This post is part of an ongoing feature about creating a social network in Rails.

    There's lots of posts around about Rails fixtures, with critiques ranging from "[they're] great!", "they hurt a little early, but shine with complexity", all the way to "do not use fixtures". Few topics split the Rails community more, the eternal Rspec vs Minitest debate comes to mind.

    However, something that I've found lacking in most of these fixtures posts are insights of:
    • how fixtures fare in a real life app,
    • how do they coexist with factories and plain objects, and
    • what growth strategies to follow that will help you out in the long run. 
    That's what we're about to tackle on this post.

    Get insights of your PostgreSQL database with PgHero


    PgHero is a ruby gem that gives you insights of your PostgreSQL database.
    Out of the box it provides info about stuff like cache hit rate, which queries are too slow, which tables need indexes, and more. You can see above how it looks on a production app (Yeah, I have to add an index there I know :P).

    To add it to your app: add this line to your  Gemfile:
    gem 'pghero'
    And add this to config/routes.rb to mount the dashboard:
    mount PgHero::Engine, at: "pghero"

    You'll also want to secure the access to the dashboard if you mount it as part of your public-facing app; we didn't have to as it is in our admin section.

    There's also the option to check the insights programmatically, run it via SQL without the web interface, run it as a standalone app, get system stats like CPU usage… check their readme for the good stuff.

    Happy optimizing!

    A Social Network in Rails: Comments

    This post is part of an ongoing feature about creating a social network in Rails.

    This time, we're adding comments to our Photo model, as presented in the elegant permalinks post. First of all, I looked for a gem to do this job for us, and found acts_as_commentable. Its setup goes something like this:

    Add the gem to our Gemfile, and run `bundle install`:
    gem 'acts_as_commentable'
    
    Generate the tables and migrate the DB:
    $ rails g comment
    $ rake db:migrate
    
    Add the comments to our Photo model:
    class Photo < ActiveRecord::Base
      acts_as_commentable
    end
    
    By doing this, we get the following interface to the comments in our photos:

    A Social Network in Rails: 5-minute setup with RVM and Railsbricks

    +


    This post is part of an ongoing feature about creating a social network in Rails.

    Here we'll set up the Rails app for our photo social network, codenamed Piccy.
    No fumbling around with different ruby version managers and complex Rails setups: RVM + Railsbricks, done in 5 minutes:

    A Social Network in Rails: Elegant permalinks

    This summary is not available. Please click here to view the post.

    A Social Network in Rails: Activity Feed

    This post is part of an ongoing feature about creating a social network in Rails. You can see part 1 here, about creating elegant permalinks for your content.

    Today I'm presenting a wonderful gem called public_activity , which lets you create activity feeds with a few lines of code:
    To begin with, add the gem to your Gemfile, as usual:
    gem "public_activity"

    Debugging I18n lookup in Rails

    Here's a nice trick to debug I18n translation strings on Rails.

    1. Add this to config/initializers/i18n.rb:
    module I18n
      module Backend
        class Simple
          # Monkey-patch-in localization debugging
          # Enable with ENV['I18N_DEBUG']=1 on the command line in server startup, or ./config/environments/*.rb file.
          #
          def lookup(locale, key, scope = [], options = {})
            init_translations unless initialized?
            keys = I18n.normalize_keys(locale, key, scope, options[:separator])
    
            puts "I18N keys: #{keys}"
    
            keys.inject(translations) do |result, _key|
              _key = _key.to_sym
              return nil unless result.is_a?(Hash) && result.has_key?(_key)
              result = result[_key]
              result = resolve(locale, _key, result, options.merge(:scope => nil)) if result.is_a?(Symbol)
    
              puts "\t\t => " + result.to_s + "\n" if (result.class == String)
    
              result
            end
          end
        end
      end
    end if ENV['I18N_DEBUG']
    

    Add Twitter cards to your Rails site with metamagic

    Lately I've been working on adding support for Twitter Cards to the Ztory website. Basically it's just a bunch of metatags that need to be added to your page, so that the next time you tweet with a link to your site you get something like this:



    Crash Course on Modern Web Development



    Step 0: HTML/CSS/JS and basic tools  1~2 weeks

    The prerequisite to become a modern web developer is having a good grasp of the tools of the trade. 

    HTML/CSS/JS

    The foundation of the web.

    Git

    Organize your work, get globally available versioned backups, and collaborate efficiently with your colleagues.

    Text editor

    All these text editors have broad support for the tools mentioned in this article. Therefore, which one to use is mainly a personal choice. Pick your poison! I'm using Atom with vim-mode nowadays.

    Social

    Social profiles are the modern CV. Join meetups to find people with similar interests, open source and share your work, and get paid while doing it.


    Step 1: Learn Ruby and Ruby on Rails  1~2 months

    Ruby, together with Ruby on Rails, has become the staple of web application development in the startup world. Be it as the API server for your single-page Javascript application, or a full-fledged solution serving your server-rendered web app, Rails covers all the needs of a starting to mid-level  (~1 million monthly impressions) web app.

    Ruby



    Ruby on Rails

    Get acquainted with the community

    Task: Build an open source web app


    Step 2: Refine your skills  2~3 months

    General programming

    Frontend

    CSS + HTML5, JS.

    Concepts: 
    • Responsive design
    • Caching
    • Performance
    • Browser independence
    Frontend frameworks:

    Backend

    PostreSQL, NoSQL (MongoDB and friends) Redis, Sidekiq, RabbitMQ…
    Concepts: 
    • Emailing
    • Algorithms
    • Databases
    • Caching
    • Security
    • Performance
    • Consistency
    • Concurrency

    DevOps

    • Deploying tools Capistrano, Chef, Vagrant, Docker…
    • Sysadmin tools: bash, sed, awk, grep, man, curl…

    Task: Refactor and optimize your app


    Step 3: Branch out to an alternate technology  1~2 months

    Task: Apply it to your app

    Rewrite the front/backend of your app, or extend it with new functionality, using what you've learned so far.


    Step 4: Dip your toes into the unknown  1~3 months

    • Android
    • iOS/Mac OS X
    • C/C++, Java, Python…
    • Windows development (Mono!)
    Task: Expand your market

    Extend to a mobile device or native platform.

    Step 5: Present yourself

    Step 6: Make some money!

    Monetize your creation

    • Google Play Store / Apple App Store
    • (Micro)payments: Bitwall, Square, Stripe...
    • Ads

    Join a company

    Freelance

    Start your own thing!
    Mostly, have fun!

    The Ruby and Javascript Scene in Barcelona


    I was asked on Reddit for some info about the Rails scene in Barcelona, so I went ahead and compiled some links here so that everyone can take advantage of it :) If you think there's something more worth adding, comment away!

    Meetup and events

    Disable dangerous rake tasks in production


    Yesterday, we had to restore the production DB from a backup, since we ran "rake db:schema:load" in production by mistake. To avoid that problem in the future, I decided to disable that task, and others than can screw with the DB, in production. 

    It was a matter of adding a prerequisite to those dangerous tasks, that checks if they are being run in production, and exit accordingly. I also added a flag to override this safeguard, together with some code to backup the DB. To do this, I added the following code to lib/tasks/disable_db_tasks_on_production.rake:

    Tuning your Ruby GC for fun and profit

    By simply adding the following to my .zshrc:

    export RUBY_HEAP_MIN_SLOTS=2000000
    export RUBY_HEAP_SLOTS_INCREMENT=500000
    export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
    export RUBY_GC_MALLOC_LIMIT=70000000
    export RUBY_FREE_MIN=100000

    I'm getting a 10% increase running the test suite on a Rails app:

    # Before:
    rake  24.57s user 3.77s system 95% cpu 29.690 total
    # After:
    rake  21.41s user 4.22s system 95% cpu 26.897 total

    Try it out and see it for yourself :)