Skip to content

Instantly share code, notes, and snippets.

@alexreisner
alexreisner / distance_approximation_test.rb
Created July 25, 2011 16:17
Compare two trig-less distance approximation formulas.
#
# This script is a rough test of two trig-less distance approximation formulas.
#
# Each formula takes two sets of lat/lon coordinates and returns the approximate
# number of miles between them, without using trigonometry.
#
require 'geocoder' # geocoder ruby gem
def dx(c1, c2)
d = Geocoder::Calculations.longitude_degree_distance(30)
pt:
errors:
messages:
not_found: "não encontrado"
already_confirmed: "já foi confirmado"
not_locked: "não foi bloequeado"
devise:
failure:
unauthenticated: 'Para continuar, deve fazer login ou registrar-se.'
en:
errors:
messages:
not_found: "nicht gefunden"
already_confirmed: "schon bestätigt"
not_locked: "nicht verriegelt"
devise:
failure:
unauthenticated: 'Sie brauchen sich anzumelden oder einzutragen, bevor Sie fortsetzen.'
@alexreisner
alexreisner / articles_controller.rb
Created September 9, 2009 04:29
Rails: use friendly (non-numeric) URLs.
# GET /articles/1
def show
@article = Article.find_by_handle!(params[:id])
...
end
# GET /articles/1/edit
def edit
@article = Article.find_by_handle!(params[:id])
end