Skip to content

Instantly share code, notes, and snippets.

@nicolasiensen
nicolasiensen / gist:1987534
Created March 6, 2012 17:06
Mailing das LAN's
<html><head><script type="text/javascript">var NREUMQ=NREUMQ||[];NREUMQ.push(["mark","firstbyte",new Date().getTime()]);</script>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<!-- Facebook sharing information tags -->
<meta property="og:title" content="Meu Rio">
<title>Meu Rio</title>
<style type="text/css">
/* Client-specific Styles */
#outlook a{padding:0;} /* Force Outlook to provide a "view in browser" button. */
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
@nicolasiensen
nicolasiensen / 01_envvars.rb
Created June 22, 2012 18:46
Mr. Dash Env Vars
ENV["DASH_TOKEN"] = "ebc309c2090073bbfdfd18494353f0771f33aa0da269f1f06e421d7e30b5aa19"
ENV["MAILEE_API_URL"] = "https://api.d3b39ea48efdc.meurio.mailee.me"
@nicolasiensen
nicolasiensen / .vimrc
Created July 11, 2012 01:10
My vimrc
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'
@nicolasiensen
nicolasiensen / member_export.rb
Created August 6, 2012 14:09
Export Meu Rio members from Mr. Dash
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
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
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
@nicolasiensen
nicolasiensen / game.rb
Last active December 14, 2015 04:49
Ordering games by achievements completeness
# 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(*)
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'
@nicolasiensen
nicolasiensen / .bash_profile
Last active December 16, 2015 21:50
My .bash_profile
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