Skip to content

Instantly share code, notes, and snippets.

View jan-kozinski's full-sized avatar
🏠
Working from home

Jan Koziński jan-kozinski

🏠
Working from home
View GitHub Profile
@signaes
signaes / Rails Console time travel
Created February 18, 2020 22:29
Using active support time helpers to change the current date in the rails console
require 'active_support/testing/time_helpers'
# the class below could have any name
class Tempo
include ActiveSupport::Testing::TimeHelpers
end
# any desidered date
desired_date = Date.today - 2.days
@norman
norman / earthdistance.rb
Last active October 7, 2024 14:15
Geographic Searches With Postgres's Earthdistance and Cube Extensions
#!/usr/bin/env ruby
=begin
= Geographic Searches With Postgres's Earthdistance and Cube Extensions
This program shows how to easily create a Postgres database that uses the Cube
and Earthdistance extensions to perform fast queries on geographic data.
Briefly, the problem this code solves is "show me all places within 50
kilometers of New York City."