Skip to content

Instantly share code, notes, and snippets.

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
# 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\]"
@BananaNeil
BananaNeil / gist:dee8b84519372894f50a
Created June 18, 2015 21:36
Destroy duplicate mobile notifications
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
@BananaNeil
BananaNeil / notification_performance_script.rb
Created October 21, 2015 18:48
Notificaiton performance script
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