Skip to content

Instantly share code, notes, and snippets.

@sorokadima
sorokadima / Українські імена список.txt
Last active January 21, 2025 21:22
Українські імена список
Ніка
Адріана
Адріан
Тіна
Аліна
Ангеліна
Алінка
Ліна
Аліса
Алла
@sorokadima
sorokadima / bash_cheat_sheet bash .sh
Last active March 8, 2024 10:38
Bash cheat sheet (Run command by time interval, Find file on disk, Script output to file)
# Run command by time interval
watch -n 60 index.sh
# Find file on disk
find / -name "myfile"
find / -name "%myfile%"
# Script output to file
ls > log.txt
ls >> log.txt # don't rewrite file
@sorokadima
sorokadima / .gitignore
Last active January 19, 2021 12:00
Add .idea to gitignore (git)
.idea/
@sorokadima
sorokadima / Kill rails server by PID.md
Created January 6, 2021 14:17
Kill rails server by PID

lsof -wni tcp:3000

kill -9 PID

@sorokadima
sorokadima / Ruby Rails Faraday Request Log.rb
Last active August 11, 2020 14:25
Ruby Rails Faraday Request Log
con = Faraday.new(url: url, params: {}, headers: headers) do |faraday|
faraday.response :logger, nil, { headers: true, bodies: true }
faraday.adapter Faraday.default_adapter
end
if method_type == 'post'
con.post do |req|
req.body = request_body
end
else
@sorokadima
sorokadima / Yii2 dropdown.php
Last active August 10, 2020 08:16
Yii2 dropdown
<?php
[
'attribute' => 'foo',
'value' => 'foo',
'label' => Yii::t('adminpanel', 'Foo'),
'filter' => Foo::getFooList(),
'filterType' => GridView::FILTER_SELECT2,
'filterOptions' => ['style' => 'min-width: 85px'],
'filterWidgetOptions' => [
@sorokadima
sorokadima / PHP current timestamp (php get current date).php
Created August 5, 2020 12:30
PHP current timestamp (php get current date)
<?php
(new DateTime())->getTimestamp();
@sorokadima
sorokadima / PHPdoc example.php
Created August 5, 2020 11:16
PHPdoc example (php doc, documentation comment)
<?php
/**
* Set foo field
*
* @param boolean $baz
*
* @return boolean
*/
@sorokadima
sorokadima / User.php
Created August 5, 2020 09:27
Yii2 model custom attribute getter. (custom property)
<?php
// model
public function getFoo() {
return true;
}
@sorokadima
sorokadima / web.php
Created August 3, 2020 09:15
Yii2 Mail Debug to file
<?php
// config/web.php:186
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'messageClass' => 'app\components\Message',
'htmlLayout' => '@app/modules/account/mail/layouts/html',
'useFileTransport' => true, // <--
],