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
# frozen_string_literal: true | |
require 'rails_helper' | |
RSpec.describe Comments::List do | |
subject do | |
service.( | |
client, | |
recommendation_id: 'REC_ID', | |
last_id: 'LAST_ID', |
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
def hello(data) | |
author = role_checker(current_user) | |
create_comment.( | |
author, | |
author.recommendations.find(data['recommendation_id']), | |
data['message'] | |
) | |
ActionCable.server.broadcast "client_#{current_user.client.id}_channel", { |
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
ApplicationRecord.connection.execute('SELECT clients.*, | |
(CASE WHEN agents_clients.id is NULL then 0 else 1 END) | |
AS joined FROM clients | |
LEFT JOIN agents_clients | |
on clients.id = agents_clients.client_id | |
INNER JOIN users ON users.id = clients.user_id | |
WHERE agents_clients.id is NULL OR agents_clients.agent_id = 4 | |
ORDER BY joined, users.name' | |
) |
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
.chat-messages | |
.row.flex-nowrap.message-row.contact.p-4 | |
img.avatar.mr-4[src="../assets/images/avatars/Barrera.jpg"] | |
.bubble | |
.message | |
| Quickly come to the meeting room 1B, we have a big server issue | |
.time.text-muted.text-right.mt-2 | |
| 20 Mar 16 15:14 | |
.row.flex-nowrap.message-row.user.p-4 | |
img.avatar.mr-4[src="../assets/images/avatars/profile.jpg" alt="John Doe"] |
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
jQuery.datetimepicker.setLocale('ru'); | |
$.validate({ | |
lang : 'ru', | |
errorElementClass : 'is-invalid' | |
}); | |
// script src="//cdnjs.cloudflare.com/ajax/libs/jquery-form-validator/2.3.26/jquery.form-validator.min.js" |
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
before do | |
paypal_payout_object = double | |
payout_batch = double | |
allow(payout_batch).to receive_message_chain(:batch_header, :payout_batch_id).and_return(payout_batch_id) | |
allow(payout_batch).to receive_message_chain(:batch_header, :batch_status).and_return(payout_batch_status) | |
allow(PayPal::SDK::REST::DataTypes::Payout).to receive(:new).and_return(paypal_payout_object) | |
allow(paypal_payout_object).to receive(:create).and_return(payout_batch) | |
end | |
let(:payout_batch_id) { 1_337 } |
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
# frozen_string_literal: true | |
class Mails::ReceiveRecent | |
def call | |
client = Mails::SetClient.new.call | |
receive_messages(client) | |
end | |
private |
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
# frozen_string_literal: true | |
class LuckyTickets | |
def self.call(n) | |
n = n/2 | |
n2 = 10 ** n - 1 | |
a = Array.new(9 * n + 1) { 0 } | |
(0..n2).each do |l| | |
a[l.to_s.chars.map(&:to_i).sum] += 1 | |
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 dat map[string]interface{} | |
var parseString string | |
if cachedPosts != nil { | |
parseString = fmt.Sprintf("%s", someJsonString) | |
if err = json.Unmarshal([]byte(parseString), &dat); err != nil { | |
panic(err) | |
} | |
} |
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 WeightTask | |
def call | |
max = 32 | |
(1..max-6).each do |a| | |
(a.next..max-5).each do |b| | |
(b.next..max-4).each do |c| | |
(c.next..max-3).each do |d| | |
(d.next..max-2).each do |e| | |
(e.next..max-1).each do |f| |
OlderNewer