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
SET @orig_lat = "50"; | |
SET @orig_lng = "5"; | |
SET @dest_lat = "45"; | |
SET @dest_lng = "30"; | |
SELECT 3956 * 2 * ASIN(SQRT( POWER(SIN((@orig_lat - @dest_lat) * pi()/180 / 2), 2) + COS(@orig_lat * pi()/180) * COS(@dest_lat * pi()/180) * POWER(SIN((@orig_lng - @dest_lng) * pi()/180 / 2), 2) )); |
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 PATH="$HOME/.rbenv/bin:$PATH" | |
eval "$(rbenv init -)" | |
function parse_git_branch_and_add_brackets { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\ \[\1\]/' | |
} | |
export PATH="/usr/local/bin:$PATH" | |
export PS1="\[\e[1;29;42m\]\w\$(parse_git_branch_and_add_brackets)\[\e[m\] " | |
export CLICOLOR=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
set rtp+=~/.vim/bundle/vundle/ | |
call vundle#rc() | |
Bundle 'gmarik/vundle' | |
Bundle 'wincent/Command-T.git' | |
Bundle 'bbommarito/vim-slim.git' | |
Bundle 'digitaltoad/vim-jade.git' | |
Bundle 'pangloss/vim-javascript.git' | |
Bundle 'vim-ruby/vim-ruby.git' | |
Bundle 'https://github.com/tpope/vim-fugitive.git' |
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
# by @diogob | |
def self.by_completeness user | |
user.games.order(" | |
CASE WHEN (SELECT count(*) FROM achievements a WHERE a.game_id = games.id) = 0 THEN 0 ELSE | |
(SELECT count(DISTINCT a.id) | |
FROM | |
achievements_users au | |
JOIN achievements a ON a.id = au.achievement_id | |
WHERE a.game_id = games.id AND au.user_id = #{user.id})::numeric / | |
(SELECT count(*) |
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
User.joins(:pokes). | |
select("users.*, ( | |
SELECT COUNT(p.*) FROM pokes p | |
WHERE p.user_id = users.id | |
AND p.campaign_id = #{self.id} | |
) as pokes_count"). | |
where(["pokes.campaign_id = ?", self.id]).uniq |
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
SELECT DISTINCT users.*, (SELECT COUNT(p.*) FROM pokes p WHERE p.user_id = users.id AND p.campaign_id = 3) as pokes_count FROM "users" INNER JOIN "pokes" ON "pokes"."user_id" = "users"."id" WHERE (pokes.campaign_id = 3) ORDER BY RANDOM() LIMIT 8 |
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
require "csv" | |
members = Group.find(1).users | |
CSV.open("/Users/nicolas/Desktop/members.csv", "wb") do |csv| | |
csv << ["Nome", "Email"] | |
members.each do |member| | |
csv << [member.name, member.email] | |
end | |
end |
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
set rtp+=~/.vim/bundle/vundle/ | |
call vundle#rc() | |
Bundle 'gmarik/vundle' | |
Bundle 'wincent/Command-T.git' | |
Bundle 'bbommarito/vim-slim.git' | |
Bundle 'digitaltoad/vim-jade.git' | |
Bundle 'pangloss/vim-javascript.git' | |
Bundle 'vim-ruby/vim-ruby.git' | |
Bundle 'https://github.com/tpope/vim-fugitive.git' |
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
ENV["DASH_TOKEN"] = "ebc309c2090073bbfdfd18494353f0771f33aa0da269f1f06e421d7e30b5aa19" | |
ENV["MAILEE_API_URL"] = "https://api.d3b39ea48efdc.meurio.mailee.me" |
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
Início: 13 de Outubro de 2011 | |
Deadline: 13 de Abril de 2013 | |
Dias restantes: 375 | |
Dias totais: 548 | |
Membros: 17461 | |
Restantes: 82539 | |
Ideal: 183 | |
Média real: 100 | |
Ontem: 40 |