This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#To install ruby-debug on Ubuntu ruby-1.9.3 you need to download from http://rubyforge.org/frs/?group_id=8883 | |
linecache19-0.5.13.gem | |
ruby_core_source-0.1.5.gem | |
ruby-debug19-0.11.6.gem | |
ruby-debug-base19-0.11.26.gem | |
#Then in your console | |
export RVM_SRC=/your/path/to/ruby-1.9.3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GeoName.find_by_sql("SELECT ordered.* FROM (SELECT gn.*, round(distance.d * 6371.0, 2) AS distance_km, round(distance.d * 6371.0 * 0.621371192, 2) as distance_miles FROM | |
(SELECT (2*atan2(sqrt(calcs.a), sqrt(1-calcs.a)))::numeric d, calcs.id FROM | |
(SELECT (sin(consts.dlat/2) * sin(consts.dlat/2) + sin(consts.dlon/2) * sin(consts.dlon/2) * cos(consts.lat1) * cos(consts.lat2)) as a, consts.id FROM | |
(SELECT f.id, abs((#{self.exif_data.latitude} - f.latitude)*(#{Math::PI}/180)) AS dlat, | |
abs((#{self.exif_data.longitude} - f.longitude)*(#{Math::PI}/180)) AS dlon, | |
#{self.exif_data.latitude} * (#{Math::PI}/180) as lat1, | |
f.latitude * (#{Math::PI}/180) as lat2 FROM geo_names f) consts) calcs) distance, | |
geo_names gn WHERE gn.id = distance.id ORDER BY distance.d ASC LIMIT 10) ordered ORDER BY random() LIMIT 1") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# rvm homepage :http://beginrescueend.com/ | |
# rubyonrails homepage :http://rubyonrails.org/ | |
# using gemset : http://beginrescueend.com/gemsets/using/ | |
# js env : https://github.com/sstephenson/execjs | |
# heroku hosting : http://www.heroku.com/ | |
# github repo : https://git.521000.bestlow | |
# gmate for gedit : https://github.com/gmate/gmate | |
# ruby dependencies | |
sudo apt-get install build-essential openssl libssl-dev libreadline6 libreadline6-dev curl |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!upstart | |
description "Workers [resque]" | |
start on (local-filesystems and net-device-up IFACE=eth0) | |
stop on shutdown | |
respawn | |
respawn limit 99 5 | |
console none |
NewerOlder