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
[-23.569945378311086, -46.705076102601495, -23.540999021688915, -46.6734984973985] | |
def distance(lat1, lon1, lat2, lon2) | |
radio = 6378137 | |
dlat = (lat2-lat1) * Math::PI / 180 | |
dlon = (lon2-lon1) * Math::PI / 180 | |
a = Math::sin(dlat/2) * Math::sin(dlat/2) + Math::cos(lat1 * Math::PI / 180 ) * Math::cos(lat2 * Math::PI / 180 ) * Math::sin(dlon/2) * Math::sin(dlon/2) | |
c = 2 * Math::atan2(Math.sqrt(a), Math::sqrt(1-a)) | |
d = radio * c; | |
# [dlat, dlon, a, c, d] | |
return "#{d.round(3)} km" if d > 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
class API::BaseController < ActionController::Metal | |
include AbstractController::Callbacks | |
include AbstractController::Rendering | |
include ActionView::Layouts | |
include ActionController::ImplicitRender | |
include ActionController::Helpers | |
include ActionController::UrlFor | |
include ActionController::Head | |
include ActionController::Renderers::All | |
include ActionController::MimeResponds |
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
export EDITOR=vim | |
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* | |
export DYLD_LIBRARY_PATH="/usr/local/mysql/lib/" | |
alias be="bundle exec" | |
alias ma="bundle exec rake db:migrate && bundle exec rake db:migrate RAILS_ENV=test" | |
alias mar="bundle exec rake db:rollback && bundle exec rake db:rollback RAILS_ENV=test" | |
alias assets="bundle exec rake assets:precompile" | |
alias assetss="bundle exec rake assets:precompile RAILS_ENV=staging" | |
alias ls="ls -G" |
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
#!/bin/bash | |
## START PRECOMMIT HOOK | |
files_modified=`git status --porcelain | egrep "^(A |M |R ).*" | awk ' { if ($3 == "->") print $4; else print $2 } '` | |
[ -s "$HOME/.rvm/scripts/rvm" ] && . "$HOME/.rvm/scripts/rvm" | |
## use ruby defined in project | |
source .rvmrc | |
for f in $files_modified; do |
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
brew search | |
brew search <nome ou parte do nome da biblioteca> | |
brew home <nome da biblioteca> - mostra a home da biblioteca | |
brew edit <nome da biblioteca> - mostra como irá ser instalado |