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
# config valid only for Capistrano 3.1 | |
lock '3.1.0' | |
set :application, 'my-app' | |
set :repo_url, '[email protected]:my/repo.git' | |
set :user, 'deploy' | |
set :scm, :git | |
set :deploy_to, '/srv/www/my-app' | |
set :ssh_options, forward_agent: true |
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
# I need to query a doc like this | |
Info.where(:q_id => 1, :quality.gte =>2).map(:member_id) | |
# => [123, 124] | |
Info.where(:q_id => 2, :quality.gte => 1).map(:member_id) | |
# => [123, 125] | |
# I need the member ids that are in the result set of both queries | |
# =>[123] | |
db.infos = [ |
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
output/* |
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
# A sample Gemfile | |
source "https://rubygems.org" | |
gem 'hashie' | |
# gem "rails" |
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 | |
echo "REMEMBER: tmux -2 -S /tmp/tmux -attach; chmod aog+rwx /tmp/tmux" | |
ssh ci 'awk !/:1026/ ~/.ssh/known_hosts > ~/.ssh/known_hosts.new' | |
ssh ci 'mv ~/.ssh/known_hosts ~/.ssh/known_hosts.bak' | |
ssh ci 'mv ~/.ssh/known_hosts.new ~/.ssh/known_hosts' | |
ssh -v -N -R 1026:localhost:22 [email protected] >> /tmp/ssh_tunnel.out & | |
/usr/local/bin/tmux -2 -S /tmp/tmux |
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 'ruby-progressbar' | |
module PrizeMetaData | |
def self.run! | |
wins = PrizeWin.where(:drawing_id.in => Drawing.last_month.crowd.map(&:id)) | |
progress = ProgressBar.create(:title => "#{Date::MONTHNAMES[1.month.ago.month]} Wins", :total => wins.count.to_i, :format => '%t |%b[%P%%]%i| %c/%C [%E]') | |
File.open("/home/deploy/tmp/prizing_#{Date::MONTHNAMES[1.month.ago.month].downcase}_email_codes_challenges.csv", 'a+') do |file| | |
file.puts "email, url, challenge" | |
wins.each do |win| | |
file.puts "#{win.member.email}, #{win.cashstar_fulfillment.url}, #{win.cashstar_fulfillment.challenge}" |
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
@members = {} | |
Brand.all.each do |brand| | |
if drawing = brand.drawings.crowd.last_month.first | |
wins = PrizeWin.where(:drawing_id => drawing.id) | |
progress = ProgressBar.create(:title => brand.slug, :total => wins.count.to_i, :format => '%t |%b[%P%%]%i| %c/%C [%E]') | |
wins.each do |win| | |
email = win.member.email | |
@members[email] ||= 0 | |
@members[email] = @members[email].to_i + 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 PickCrowdWinners | |
attr_accessor :crowd_drawing, :ids | |
def initialize(crowd_drawing) | |
@crowd_drawing = crowd_drawing | |
end | |
def ids | |
@ids ||= begin | |
ids = Set.new |
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
CashstarFulfillment.all.each do |cf| | |
cf.set(:prize_win_id, cf.win_id) | |
end | |
Win.all.each do |win| | |
win.set(:_type, 'PrizeWin') | |
end | |
CashstarFulfillment.all.each do |cf| | |
cf.unset(:win_id) |
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
out.log |