Skip to content

Instantly share code, notes, and snippets.

View raeno's full-sized avatar
🚗
Travelling across Central Asia

Vlad Mikhailov raeno

🚗
Travelling across Central Asia
View GitHub Profile
= content_for :sender
= @store.name
= content_for :branding
= render 'layouts/front/store_branding', store: @store
= content_for :excuse
= t 'review_request_html',
scope: 'front.mailer.excuses',
helpfulcrowd: link_to('HelpfulCrowd', 'https://www.helpfulcrowd.com'),
@raeno
raeno / inbound_shipment_api.rb
Created November 12, 2018 15:52
Amazon MWS examples
# frozen_string_literal: true
module Amazon
class InboundShipmentApi
include Logging
include WithThrottling
ACTIVE_SHIPMENT_STATUSES = %w( WORKING SHIPPED IN_TRANSIT DELIVERED CHECKED_IN RECEIVING CLOSED CANCELLED DELETED ERROR).freeze
DEFAULT_SHIPMENTS_RANGE = 24.months.ago
def self.build(amazon_config, options = {})
@raeno
raeno / gist:8beaa77e0b5a86c2a9ec
Created October 21, 2014 06:58
Two outer joins on same table with Arel
messages = Message.arel_table
messages2 = Message.arel_table.alias('messages2')
messages3 = Message.arel_table.alias('messages3')
users = User.arel_table
manager = Arel::SelectManager.new(Message.arel_engine)
manager.project users[:first_name], users[:last_name], messages[:created_at]
manager.from messages
manager.join(messages2, Arel::Nodes::OuterJoin).on(messages[:created_at].eq(messages2[:created_at]))
manager.join(messages3, Arel::Nodes::OuterJoin).on(messages[:recipient_id].eq(messages3[:recipient_id]))
manager.join(users).on(users[:id].eq(messages[:sender_id]))
@raeno
raeno / gist:49af31226cdb2e76829c
Created August 10, 2014 21:03
Different surfer tokens in one request body
I, [2014-08-10T20:48:32.963261 #2071] INFO -- : Started POST "/api/v1-0/logs/ship/W8uXwe/yaOTip/0/0" for 77.127.33.192 at 2014-08-10 20:48:32 +0000
I, [2014-08-10T20:48:33.052019 #2071] INFO -- : Processing by Api::V1::LogsController#ship as JSON
I, [2014-08-10T20:48:33.119547 #2071] INFO -- : Parameters: {"Surfages"=>[{"SurferToken"=>"MWTWAu", "SurfedAt"=>"8/8/2014 6:28:16 PM", "Url"=>"http://www.theyeshivaworld.com/news/headlines-breaking-stories/253566/rockets-fired-to-the-ashkelon-district.html with header: HTTP/1.1 200 OK\r\nServer: Apache/2.2", "ContentType:"=>"application/xhtml", "StatusCode"=>"200", "Title"=>"The Yeshiva World LIVE BLOG: Gaza Warfare Resumes – Israel Under Attack [UPDATED 5:17 PM IL] « » Frum Jewish News", "Description"=>"", "RemoteIp"=>"", "Pid"=>"i0", "SysUserName"=>"mnadel@vcf.co.il"}, {"SurferToken"=>"MWTWAu", "SurfedAt"=>"8/8/2014 6:28:18 PM", "Url"=>"https://accounts.google.com/o/oauth2/postmessageRelay?parent=http%3A%2F%2Fwww.theyeshivaworld.com with hea
@raeno
raeno / phone_mask.js
Created August 5, 2014 08:38
Форматирование телефонного номера ( Россия )
// We use jquery.inputmask plugin to apply mask for the phone number.
// Plugin page: https://github.com/RobinHerbots/jquery.inputmask
var maskPhone, setPhoneFormValidation, phoneForm, phoneInput;
phoneForm = function() {
return $('.js-phone-block > form');
}
phoneInput = function() {
select fund_sums.total, fund_products.name
from (
select sum(allocation_amount) total, fund_product_id
from transactions
where transactions.investor_id = 490
group by fund_product_id
) fund_sums
left join fund_products on fund_sums.fund_product_id = fund_products.id
@raeno
raeno / ahn
Created September 9, 2013 13:41 — forked from ik5/ahn
#!/bin/sh
### BEGIN INIT INFO
# Provides: ahn
# Required-Start: ahn daemon
# Required-Stop: ahn daemon
# chkconfig: 2345 91 60
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Adhearsion daemon
@raeno
raeno / test.coffee
Created February 20, 2013 09:48
Showing and hiding overlay
product_quantity = $('.product-quantity');
product_quantity.click ->
current = $(this)
event.stopPropagation();
current.parent().find('.items-count-spinner').show();
current.find('.item-count').focus();
position = current.position();
$('.items-count-spinner').css({