Skip to content

Instantly share code, notes, and snippets.

SELECT device.id, device.name, device.created_at FROM devices as device
WHERE (
(
SELECT device_id FROM device_zones AS zones
WHERE (zones.id IS NOT NULL AND zones.device_id = device.id)
LIMIT 1
) IS NOT NULL
) LIMIT 4;
async loginHandler(evt) {
evt.preventDefault()
this.loading = true // Use This later to show a spinner
this.error = false // Reset error message if one exists
// Options for the ApiRequest
const options = {
method: 'POST',
url: '/auth/sign_in',
data: this.form
## Current
NotifictionConfig
properties: {
"ru" => {
"body" => "",
"subject" => ""
},
}
## Sample 1 // Dictionary version.
@IlyaDonskikh
IlyaDonskikh / application_service.rb
Last active December 3, 2019 13:42
Services Concept
# frozen_string_literal: true
class ApplicationService
attr_reader :errors
## Etc.
def self.call(params)
new(params).process
end
class KafkaProducer
include Singleton
class << self
def assign_kafka
kafka = Kafka.new(
ENV.fetch('KAFKA_BROKERS').split(','),
sasl_scram_username: ENV['KAFKA_USERNAME'],
sasl_scram_password: ENV['KAFKA_PASSWORD'],
sasl_scram_mechanism: ENV['KAFKA_MECHANISM'],
arr = [2, 4, 5, 5, 8, 9, 11, 13]
t = 14
min_index = 0
max_index = arr.length - 1
success = false
while (min_index != max_index) && !success do
sum = arr[min_index] + arr[max_index]
if sum > t
Need to do a series of string updates for the Property Page, Dashboard and Po Dashboard
1. Property / Index
1.1 `$string_old` -> `$string_new`
1.2 ..
2. Property / Show
2.1 `$string_old` -> `$string_new`
2.2 ..
294767818
8929244
16187546
4902154
151077392
1. 139111249
2. 16187546
# Иногда менеджерам требуется составлять шаблоны писем с динамическими данными.
# Поэтому требуется разработать сервис, который позволит создавать и хранить шаблоны,
# а также отправлять письма на их основе.
# Данные:
Account(balance:float currency:string name:string email:string)
Message(title:string, text:text)
# Пример сообщения: "Здравствуйте, {{name}}. Ваш баланс: {{balance}}{{currency}}".