This file contains 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 nocompatible " be iMproved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" alternatively, pass a path where Vundle should install plugins | |
"call vundle#begin('~/some/path/here') | |
" let Vundle manage Vundle, required |
This file contains 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
# RBENV | |
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi | |
# ALLOW VIM TO USE CTRL+S | |
stty -ixon | |
# PROMPT | |
function color_my_prompt { | |
#local __git_branch="\`ruby -e \"print (%x{git branch 2> /dev/null}.grep(/^\*/).first || '').gsub(/^\* (.+)$/, '(\1) ')\"\`" | |
local __git_branch_color="\[\033[31m\]" |
This file contains 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
bill_ids = Persistence::MobileNotification.group(:bill_id).count.select{|k,v| v > 1}.map(&:first) | |
Persistence::Bill.where(id: bill_ids, congress: 114).each do |b| | |
notifications = b.mobile_notifications | |
puts b.bill_id.green | |
notifications.each_with_index {|n, i| puts "#{i}) #{n.message.strip}".yellow} | |
print 'Keep which one? '.light_blue | |
(notifications - [notifications[gets.strip.to_i]]).each {|n| puts "DESTROYING #{n.message}".red;n.destroy} | |
end;nil |
This file contains 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
CSV.open('/tmp/notifications.csv', 'w') do |csv| | |
UserNotification.select("distinct type").map(&:type).each do |type| | |
total = UserNotification.where(type: type, send_state: 'sent').group(:message).count | |
opened = UserNotification.where(type: type, send_state: 'sent').where(open_state: 'open').group(:message).count | |
csv << ["Type", "Sent", "Opened", "Message", "First Date Sent"] | |
c = h.keys.count | |
total.keys.each do |message| | |
print "\r#{c-=1} " | |
csv << [type.split('::').last, total[message], opened[message] || 0, message, n.created_at] | |
end |