Skip to content
View .irbrc
require 'rubygems'
require 'logger'
require "net/http"
irb_conf = defined?(::IRB) && IRB.respond_to?(:conf)
load File.dirname(__FILE__) + "/.rubyrc/bogdan.rb"
if irb_conf
begin
View log
production >> User.connection.select_value("SELECT 1 AS one FROM `origins` use index (index_purchases_migrated_on_visitor_id) WHERE `origins`.`visitor_id` = 30388798 AND `origins`.`site_id` = 6854 LIMIT 1")
(79.8ms) SELECT 1 AS one FROM `origins` use index (index_purchases_migrated_on_visitor_id) WHERE `origins`.`visitor_id` = 30388798 AND `origins`.`site_id` = 6854 LIMIT 1
=> nil
production >> User.connection.select_value("SELECT 1 AS one FROM `origins` WHERE `origins`.`visitor_id` = 30388798 AND `origins`.`site_id` = 6854 LIMIT 1")
(270.3ms) SELECT 1 AS one FROM `origins` WHERE `origins`.`visitor_id` = 30388798 AND `origins`.`site_id` = 6854 LIMIT 1
=> nil
production >>
View bogdan_change_attributes.rb
require 'benchmark/ips'
require 'active_model'
# run this
# bundle exec ruby benchmark.rb && second_run=y bundle exec ruby benchmark.rb
class Person
include ActiveModel::Dirty
define_attribute_methods :name, :age
View ab_math.rb
module AbMath
module Distribution
SQ2PI = Math.sqrt(2 * Math::PI)
class << self
def mean(distribution)
# average value
return 0.0 if distribution.empty?
distribution.reduce(:+).to_f / distribution.size
end
View purchase.rb
# == Schema Information
#
# Table name: origins
#
# id :integer not null, primary key
# order_number :string(255) not null
# site_id :integer not null
# subtotal :decimal(25, 2) not null
# order_date :datetime not null
# ip_address :string(255)
View gist:bd962f3bb04e893ea172
+-----------+--------------+---------+----------+------------------+------------------+------------------+------------------+-------------------+------------+-----------+--------+----------+-------------------+------------------+
| id | order_number | site_id | subtotal | order_date | ip_address | internal_ip_a... | created_at | updated_at | visitor_id | person_id | is_new | type | traffic_source_id | event_categor... |
+-----------+--------------+---------+----------+------------------+------------------+------------------+------------------+-------------------+------------+-----------+--------+----------+-------------------+------------------+
| 95709621 | 489437 | 8269 | 153813.0 | 2015-09-13 00... | | | 2015-09-13 00... | 2015-09-17 05:... | | 38436040 | false | Purchase | 16893 | 16044 |
| 95711237 | 491641 | 8269 | 63945.0 | 2015-09-13 00... | |
View gist:44755349175b70345dff
+---------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 0 | 1 |
+---------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
| https://www.talkable.com/sites/diamond-candles/campaigns/40877/edit | [["Friend gets single use coupon for 20% off for click", "1414 available after 01/20/16", "/sites/diamond-candles/campaigns/40877/edit#incentives"]] |
| https://www.talkable.com/sites/diamond-candles/campaigns/40859/edit | [["Friend gets single use coupon
View gist:0683332284e91e7b2f69
+------------------+------------------------------------------------------------------------------------+
| 0 | 1 |
+------------------+------------------------------------------------------------------------------------+
| diamond-candles | https://www.talkable.com/sites/diamond-candles/campaigns/40660/view_setups/120713 |
| diamond-candles | https://www.talkable.com/sites/diamond-candles/campaigns/40656/view_setups/120667 |
| diamond-candles | https://www.talkable.com/sites/diamond-candles/campaigns/40656/view_setups/120673 |
| diamond-candles | https://www.talkable.com/sites/diamond-candles/campaigns/38063/view_setups/103219 |
| diamond-candles | https://www.talkable.com/sites/diamond-candles/campaigns/36680/view_setups/56388 |
| diamond-candles | https://www.talkable.com/sites/diamond-candles/campaigns/36680/view_setups/56389 |
| diamond-candles | https://www.talkable.com/sites/diamond-candles/ca
View nutripurchases
INFO /home/rails/talkable/current/log/nginx-access.log-20151220.gz:65.202.219.10 - - [20/Dec/2015:07:58:47 -0800] "www.talkable.com" "GET /public/nutrisystem/purchases/create.gif?v=1.0.42&o%5Border_number%5D=700415181&o%5Bfirst_name%5D=leah&o%5Blast_name%5D=evans-taylor&o%5Bsubtotal%5D=289.99&o%5Bperson_custom_properties%5D%5Border_category%5D=core HTTP/1.1" 200 79 "https://www.nutrisystem.com/jsps_hmr/shop/thank_you.jsp?_requestid=656259" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/6.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3)" 0.053 0.053 "-" "7094d744-355b-4265-97ef-58f21719cd7c/-" "rid:58b6b9ab-d699-4ff0-8b90-321cb6113235"
/home/rails/talkable/current/log/nginx-access.log-20151220.gz:65.202.219.10 - - [20/Dec/2015:09:15:12 -0800] "www.talkable.com" "GET /public/nutrisystem/purchases/create.gif?v=1.0.42&o%5Border_number%5D=697094862&o%5Bemail%5D=a2VubmVkeW02NEBhb2wuY29t&o%5Bfirst_name%5D=Marlene&o%5Blast_name%5D=Kennedy&o%5
View gist:584ec4e370246f3f1931
+--------------+---------------------------------------------+-------+
| Name | Url |Pending|Referrals Count
+--------------+---------------------------------------------+-------+
| bustedtees | https://www.talkable.com/sites/bustedtees | 101 |
| blivakker-no | https://www.talkable.com/sites/blivakker-no | 467 |
| rocksbox | https://www.talkable.com/sites/rocksbox | 5912 |
| toms | https://www.talkable.com/sites/toms | 1358 |
| hired | https://www.talkable.com/sites/hired | 63723 |
| hotels | https://www.talkable.com/sites/hotels | 10711 |
| plastc | https://www.talkable.com/sites/plastc | 9387 |
Something went wrong with that request. Please try again.