Skip to content

Instantly share code, notes, and snippets.

@abhinavmsra
abhinavmsra / rspec_json_helper.md
Created July 11, 2016 09:13
DRY JSON Parsing in Rspec Tests
# spec/support/request_helpers.rb
module Requests
  module JsonHelpers
    def json
      JSON.parse(response.body)
    end
  end
end
@abhinavmsra
abhinavmsra / money_best_practices.md
Last active November 12, 2023 13:00
Tips for Money Related Arithmetic in Ruby

Tips for Money Related Arithmetic in Ruby

  1. Never use float for performing arithmetic calculations relating to money.

    Floating numbers can sometimes show funky behaviour. It is not Ruby’s fault but the very implementation of floating numbers raises precision issues.

Examples of odd behaviour:

@abhinavmsra
abhinavmsra / s3cmd.md
Last active March 14, 2024 10:58
Install s3cmd on CentOs

Installing s3cmd on CentOs

  1. As a superuser, go to /etc/yum.repos.d

    cd /etc/yum.repos.d

  2. Download the repo file

    wget http://s3tools.org/repo/RHEL_6/s3tools.repo