Skip to content

Instantly share code, notes, and snippets.

@huemorgan
huemorgan / gist:754a639d9a59cb13a5e006cefd3c34e9
Created Jan 8, 2017
calculate excel cohort diagonals fields in ruby by dapulse
View gist:754a639d9a59cb13a5e006cefd3c34e9
x = ['c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
y = [11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34]
length = y.length
strings = []
for index in 0..length
substring = "="
for i in 0..(index)
substring = substring + "+" if substring != "="
substring << "#{x[i]}#{y[index-i]}"
View gist:8536656
namespace :email do
namespace :al do
desc "send emails to leads"
task :send => :environment do |t, args|
require 'mandrill'
leads = AlLead.where("email1_try_ok is null and
email2_try_ok is null and
email3_try_ok is null and
email4_try_ok is null
View gist:8516479
desc "Intercom general updates options"
task :sync, [:is_init] => :environment do |t, args|
require 'intercom'
require 'progressbar'
puts "Intercom sync started on #{Time.now} (#{Time.now.to_i})"
# Run over all the accounts
error_log = []
View gist:2795465
shahar.ron@gmail.com, dror@honeybook.co, naama@honeybook.co, oz@honeybook.co, danielle.yanai@gmail.com, danielt@gmail.com, omer@backpacknetwork.com, ohad@backpacknetwork.com, jonathan@backpacknetwork.com, asher@tokkster.com, dan@tokkster.com, almog@almogdesign.net, ori@brighttech.co.il, xorrox@gmail.com, elinor.dreamer@gmail.com, ben@thejunction.co.il, mika@thejunction.co.il
View gist:1657318
Jan 22 14:58:00 ip-10-161-110-134 dovecot: POP3(mailbox): Disconnected: Logged out top=0/0, retr=0/0, del=0/0, size=0
Jan 22 14:58:10 ip-10-161-110-134 dovecot: pop3-login: Login: user=<mailbox>, method=PLAIN, rip=50.18.125.66, lip=10.161.110.134
Jan 22 14:58:10 ip-10-161-110-134 dovecot: POP3(mailbox): mkdir(/home/mailbox/mail/.imap/INBOX) failed: Permission denied
Jan 22 14:58:10 ip-10-161-110-134 dovecot: POP3(mailbox): Disconnected: Logged out top=0/0, retr=0/0, del=0/0, size=0
Jan 22 14:58:20 ip-10-161-110-134 dovecot: pop3-login: Login: user=<mailbox>, method=PLAIN, rip=50.18.125.66, lip=10.161.110.134
Jan 22 14:58:20 ip-10-161-110-134 dovecot: POP3(mailbox): mkdir(/home/mailbox/mail/.imap/INBOX) failed: Permission denied
Jan 22 14:58:20 ip-10-161-110-134 dovecot: POP3(mailbox): Disconnected: Logged out top=0/0, retr=0/0, del=0/0, size=0
Jan 22 14:58:30 ip-10-161-110-134 dovecot: pop3-login: Login: user=<mailbox>, method=PLAIN, rip=50.18.125.66, lip=10.161.110.134
Jan 22 14:58:30 ip-10-161-110-134 dovec
@huemorgan
huemorgan / gist:1400357
Created Nov 28, 2011
remake thumbnails in paperclip
View gist:1400357
Project.find_in_batches do |group|
puts("********** GROUP")
group.each do |project|
if project
if project.photo
if project.photo.exists?
project.photo.reprocess!
puts(". #{project.name} - #{project.photo.url}")
else
puts("NO PHOTO - #{project.name}")
View gist:1344437
Started DELETE "/posts/38442.json" for 127.0.0.1 at 2011-11-07 10:14:30 +0200
[Barista] Compiling all scripts for barista
[Barista] Compiling all coffeescripts
[Barista] Copying all javascripts
Processing by PostsController#destroy as JSON
Parameters: {"id"=>"38442"}
## 0.0, 33.301212, 33.301212, 1970-01-01 02:00:00 +0200, 2011-11-07 10:14:33 +0200, 0, /posts/38442.json
User Load (0.9ms) SELECT `users`.* FROM `users` WHERE `users`.`account_id` = 1 AND `users`.`id` = 2 LIMIT 1
Post Load (0.6ms) SELECT `posts`.* FROM `posts` WHERE `posts`.`account_id` = 1 AND `posts`.`id` = 38442 LIMIT 1
Item Load (0.4ms) SELECT `items`.* FROM `items` WHERE `items`.`account_id` = 1 AND `items`.`id` = 1934 LIMIT 1