Skip to content

Instantly share code, notes, and snippets.

View ep-wac's full-sized avatar

Enrique Walther Jesus Phillips ep-wac

View GitHub Profile
@ep-wac
ep-wac / gist:5697390
Created June 3, 2013 10:44
trying to use pry-rescue with minitest
$ _st
12:39:04 - INFO - Guard uses TerminalNotifier to send notifications.
12:39:04 - INFO - Guard uses TerminalTitle to send notifications.
12:39:04 - INFO - Starting Spork for MiniTest
Using MiniTest
Preloading Rails environment
Loading Spork.prefork block...
Rack::File headers parameter replaces cache_control after Rack 1.5.
Spork is ready and listening on 8988!
12:39:13 - INFO - Spork server for MiniTest successfully started
@ep-wac
ep-wac / left to my own devise.markdown
Created June 19, 2012 08:54
having a terrible time with :failed_attempts in Devise 2.1.0

I'm trying to setup an authentication according to Devise and friends :)

I have added

class Users::SessionsController  < Devise::SessionsController

  include Tracing

  def new

stop_tracer

@ep-wac
ep-wac / exchange_rate_ramblings.markdown
Created May 31, 2012 13:50
Ramblings on exchange rates pertaining to the Money, Nordea and MoneyRails Gem

A money field supports/depends upon a currency and that introduces the question of what exchange_rate to use!

The simple answer is 1.00000 meaning that the currency gets 'traded' on par - which will satisfy the 'one currency' use case (commonly exchange_rates are listed with 5 decimals - but some currencies requires 7 or more decimals to allowing an accurate calculation, like the Afghani, currently traded against the USD at 0.0206954). One currency use cases could be set using a simple configuration option - like config.money_rails.one_currency_only = true

A somewhat more complex use case is the 'two currencies' application where all money fields are listed (and calculated) in a 'preferred' currency but has to be presented in a secondary currency as well. Some EU-countries have not implemented the Euro as their national currency, like Poland. Their national currency has an almost fixed exchange_rate towards the Euro - it sees fluctuations but only marginally. Money fields are rarely converted but even thoug