Skip to content

Instantly share code, notes, and snippets.

Tudor Pavel tudorpavel

Block or report user

Report or block tudorpavel

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
tudorpavel /
Last active Sep 27, 2016
Local setup for using Ruby on Linux
tudorpavel / some_model.rb
Created Sep 13, 2015
Rails PostGIS within_range query.
View some_model.rb
def self.within_range(range_km, lat, lng)
if lat.present? && lng.present?
joins(location: :point)
"ST_DWithin(Geography(ST_MakePoint(longitude, latitude)),
Geography(ST_MakePoint(#{lng}, #{lat})),
#{(range_km * 1000).to_i})"
View functions.rb
def calc(arr)
arr[0] + (13.0 * arr[1] / arr[2]) + arr[3] + (12 * arr[4]) - arr[5] + (arr[6].to_f * arr[7] / arr[8])
def solutions
[1,2,3,4,5,6,7,8,9].permutation.to_a.keep_if { |p| calc(p) == 87.0 }
tudorpavel /
Last active Feb 11, 2016
Local setup for Ruby on Rails development on Linux

Ruby on Rails Setup

Install Ruby

Ruby on Rails depends on the Ruby programming language (doh), so we need to install that first. Follow the Ruby Setup guide to install a local version of Ruby.

Install Rails

Install the latest version of Rails

You can’t perform that action at this time.