Skip to content

Instantly share code, notes, and snippets.

View DmitryBash's full-sized avatar

Batracov Dmitrii DmitryBash

  • Netherlands
View GitHub Profile
@DmitryBash
DmitryBash / js-functions-syntax.js
Created April 5, 2020 16:57
redux-examples-002-dispatch-mapdispatchtoprops
class Profile extends React.Component {
render(props) {
return <div>{props}</div>
}
}
// Dumb component
function Profile(props) {
return <div>{props}</div>
@DmitryBash
DmitryBash / readme.md
Created April 30, 2020 07:18 — forked from maxivak/readme.md
Send email to multiple recipients in Rails with ActionMailer

Send email to multiple recipients

Send multiple emails to different recipients.

Mailer class

# app/mailers/notify_mailer.rb

class NotifyMailer < ApplicationMailer
@DmitryBash
DmitryBash / test.rb
Last active September 14, 2021 13:54
test
def query(params)
# this magic method prepares sql and gets correct data from DB
# NO CHANGES HERE
puts "Params = #{params}"
[
{name: "John", surname: "Doe", age: 33},
{name: "John", surname: "Doe", age: 34},
{name: "John", surname: "Doe", age: 35}
]
end
@DmitryBash
DmitryBash / custom_reverse.rb
Last active December 18, 2023 14:05
reverse array
def reverse_array(arr)
return arr if arr.empty?
arr = arr.dup
start_index = 0
end_index = arr.length - 1
while start_index < end_index
arr[start_index], arr[end_index] = arr[end_index], arr[start_index]