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 RedZoneCrossedWorker < Worker | |
| def perform(event_id) | |
| Chewy.strategy(:atomic) do | |
| puts "#{self.class.name} Performing: #{event_id} #{jid}" | |
| event = RedZoneCrossedShipmentEvent.find_by(id: event_id) | |
| shipment = event.try(:shipment) | |
| if shipment | |
| # generate driver/oo payments | |
| shipment.generate_red_zone_payments | |
| # send mails and notifications if red zone crossed successfully |
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
| return users in random order (but use this order in next request) | |
| randomizer = Random.new | |
| session[:seed] ||= randomizer.rand(1.0) | |
| User.connection.execute "select setseed(#{session[:seed].to_f})" | |
| @users = User.order('random()').page(params[:page]).per(24) |
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
| module FixLocalesSpecs | |
| module ::ActionController::TestCase::Behavior | |
| alias_method :process_without_logging, :process | |
| def process(action, http_method = 'GET', *args) | |
| e = Array.wrap(args).compact | |
| e[0] ||= {} | |
| e[0].merge!({locale: I18n.locale}) | |
| process_without_logging(action, http_method, *e) | |
| end |
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
| var retailers_urlGet = "http://booking.com"; | |
| // Lets get retailers from backend API | |
| appAPI.request.get(retailers_urlGet, | |
| function(response, responseHeaders) | |
| { | |
| // Need to get these params from the response | |
| var src = $(response).find("input[name=src]").val(), | |
| error_url = $(response).find("input[name=error_url]").val(), | |
| dcid = $(response).find("input[name=dcid]").val(), |
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 'benchmark' | |
| F = Struct.new(:name, :size) do | |
| def grouping | |
| "#{name}/#{size}" | |
| end | |
| end | |
| f0 = F.new("a.txt", 110) | |
| f1 = F.new("a.txt", 10) |
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
| Hаташа Ростова танцует на балу с Пьером Безуховым. | |
| -Граф, у Вас пятнышко на манжете,- делает замечание Hаташа. | |
| Пьер уходит в другую комнату и, не выдержав позора, вешается. | |
| А Hаташа уже танцует с Андреем Болконским. | |
| -Князь, у Вас пятнышко на сюртуке,- делает замечание Hаташа. | |
| Андрей уходит в другую комнату и, не выдержав позора, застреливается. | |
| И вот очередь Поручика Ржевского. | |
| -Поручик, да у Вас сапоги грязные... | |
| -Hе беспокойтесь, мадам, это не грязь, а говно-с. Сейчас подсохнет | |
| и само отвалится... |
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 'rubygems' | |
| require 'json' | |
| module Base | |
| def fields | |
| @fields ||= params.is_a?(String) ? JSON.parse(params) : params | |
| end | |
| def [](field) | |
| fields[field] |
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
| puts "hello world" |
NewerOlder