Skip to content

Instantly share code, notes, and snippets.

Augusts Bautra Epigene

Block or report user

Report or block Epigene

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Epigene
Epigene / Ordering.rb
Last active Jul 29, 2017
Latest posts first
View Ordering.rb
Post.where(...).order(created_at: :desc)
View crosssales_error.rb
2017-05-11T06:51:15.705Z 11136 TID-oug3atsxw ExportCrossalesUserSidekiqJob JID-7c624fff5139d27bf187fbba INFO: start
2017-05-11T06:51:15.893Z 11136 TID-oug3atsxw ExportCrossalesUserSidekiqJob JID-7c624fff5139d27bf187fbba INFO: fail: 0.188 sec
2017-05-11T06:51:15.893Z 11136 TID-oug3atsxw WARN: {"class":"ExportCrossalesUserSidekiqJob","args":["lv_test_1494485472@creative.gs"],"retry":true,"queue":"default","jid":"7c624fff5139d27bf187fbba","created_at":1494485475.6979861,"enqueued_at":1494485475.699245,"error_message":"No user could be found by email lv_test_1494485472@creative.gs and User#crossales_post_to_platforms failed.","error_class":"RuntimeError","failed_at":1494485475.8919208,"retry_count":0}
2017-05-11T06:51:15.894Z 11136 TID-oug3atsxw WARN: RuntimeError: No user could be found by email lv_test_1494485472@creative.gs and User#crossales_post_to_platforms failed.
2017-05-11T06:51:15.894Z 11136 TID-oug3atsxw WARN: /Users/developer/.rvm/gems/ruby-2.1.2@sha/bundler/gems/crossales-6711c8b6386b/app/jobs/export
View currency-amount combos.rb
["USD", 264]
["USD", 2651]
["USD", 664]
["USD", 1281]
["USD", 904]
["USD", 648]
["LVL", 2]
["USD", 930]
["USD", 1332]
["LVL", 999]
View config.fish
# Path to Oh My Fish install.
set -gx OMF_PATH "/Users/developer/.local/share/omf"
# Customize Oh My Fish configuration path.
#set -gx OMF_CONFIG "/Users/developer/.config/omf"
source $OMF_PATH/init.fish
# Path to your oh-my-fish.
set PATH /Applications/Postgres.app/Contents/Versions/9.5/bin $PATH
View lifetime_v2_panel_hash.rb
# for SH
{
:users=>7,
:users_subbed_at_least_once=>4,
:users_renewed_at_least_once=>1,
:subscriptions_belonging_to_users=>6,
:users_with_unsubscribed_last_subscription=>1,
:users_with_terminated_last_subscription=>1,
:users_with_at_least_one_upsell_purchase=>2,
:upsell_payments_belonging_to_users=>3,
@Epigene
Epigene / nested_gist.rb
Created Apr 4, 2017
Param structure when submitting OfferItem nested attributes for PurchaseOffer-s.
View nested_gist.rb
[1] pry(#<#<Class:0x007fa02286da98>>)> params
=> {"purchase_offer"=>
{"title"=>"New Title",
"offer_items_attributes"=>
[{"id"=>"364", "main"=>"0"},
{"id"=>"365", "_destroy"=>"1"},
{"purchase_item_id"=>"19", "main"=>"0"}]},
"id"=>"238",
"controller"=>"admin/purchase_offers",
"action"=>"update"}
@Epigene
Epigene / warmup questions.md
Created Mar 13, 2017
Warmup rails questions
View warmup questions.md

1. What is the difference between Ruby’s Hash and ActiveSupport’s HashWithIndifferentAccess?

2. What’s the issue with the controller code below? How would you fix it?

class CommentsController < ApplicationController
  def users_comments
    posts = Post.all
    comments = posts.map(&:comments).flatten
    @user_comments = comments.select do |comment|
@Epigene
Epigene / failures.sh
Created Feb 18, 2017
Ryan pull request failures
View failures.sh
Failures:
1) Ryan::Const#name when given a module when the module is namespaced when the module has a const after the module declaration returns the correct module name
Failure/Error: expect(Kernel.const_get(subject.name)).to eq Mixins::Helpers
NameError:
wrong constant name Mixins::Helpers
# ./spec/lib/ryan/const_spec.rb:29:in `const_get'
# ./spec/lib/ryan/const_spec.rb:29:in `block (6 levels) in <top (required)>'
@Epigene
Epigene / gem_root.rb
Created Feb 18, 2017
Shows how to define a .root method for a gem module
View gem_root.rb
# in example_gem/lib/example_gem.rb
module ExampleGem
# ExampleGem.root
def self.root
current_file_name = __FILE__
path_to_current_file = File.expand_path(current_file_name)
# get out of example_gem.rb file and then out of /lib to get to root
root_path = Pathname.new(path_to_current_file) + "../.."
@Epigene
Epigene / resales_flow.md
Last active May 24, 2018
Kā pārpušot Order datus uz app.
View resales_flow.md
  1. CPP pusē atrod ordera ID un epastu
  2. SHA pusē atrod SalesEvent ierakstu, kura Origin ir 1. solī atrastais ID
  3. Dzēš 2. solī atrasto SalesEvent
  4. Parūpējas, ka SHA pusē nav Useru, kuru :email vai :origin_email ir tāds, kā iecerētais jaunais epasts
  5. CPP pusē 1. solī atrastajam Order iestata statusu "new" un samaina epastu uz vajadzīgo
  6. Tam pašam Order samaina statusu uz "paid", izņem "api processed ķeksi" un saglabā
  7. Pārliecinās, ka SH pusē ir jauns SalesEvent ar Origin, kas sakrīt ar 1. solī iegūto ID un jaunu user asociāciju
You can’t perform that action at this time.