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
| Such symfony serializer instantiation allows automatic camel to snake case field conversion | |
| and direct deserialization to private fields. | |
| composer require | |
| symfony/serializer | |
| symfony/property-access | |
| phpdocumentor/reflection-docblock | |
| public function __construct() | |
| { |
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
| docker pull mysql | |
| docker run --name testMysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=password -d mysql:latest | |
| docker exec -it testMysql mysql -uroot -p | |
| // docker exec -it testMysql bash | |
| // mysql -u root -p | |
| CREATE DATABASE db_test; |
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
| xdebug.mode=debug | |
| xdebug.start_with_request=true | |
| xdebug.discover_client_host=true | |
| xdebug.remote_idekey = PHPSTORM |
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
| zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20170718/xdebug.so | |
| xdebug.remote_enable=on | |
| xdebug.remote_autostart=on | |
| xdebug.remote_host=172.26.0.1 | |
| xdebug.idekey=PHPSTORMPP | |
| xdebug.extended_info=on |
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
| RESTAURANT EXERCISE (please use JAVA 7 syntax) | |
| Your restaurant has a set of tables of different sizes: each table can accommodate 2, 3, 4, 5 or 6 persons. Clients arrive alone or in groups, up to 6 persons. Clients within a given group must be seated together at one table, hence you can direct a group only to a table, which can accommodate them all. If there is no table with the required number of empty chairs, the group has to wait in the queue. | |
| Once seated, the group cannot change the table, i.e. you cannot move a group from one table to another to make room for new clients. | |
| Client groups must be served in the order of arrival with one exception: if there is enough room at a table for a smaller group arriving later, you can seat them before the larger group(s) in the queue. For example, if there is a six-person group waiting for a six-seat table and there is a two-person group queuing or arriving you can send them directly to a table with two empty chairs. | |
| Groups may share tables, however if at the same |
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
| /* | |
| <dependency> | |
| <groupId>pl.pragmatists</groupId> | |
| <artifactId>JUnitParams</artifactId> | |
| <version>1.1.1</version> | |
| <scope>test</scope> | |
| </dependency> | |
| */ | |
| import junitparams.JUnitParamsRunner; |
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
| ищем строку где-то в файлах | |
| grep -rni ~/ -e 'string to find' | |
| если ktorrent не видит раздач на рутрекере | |
| iptables -t nat -A OUTPUT -p tcp -m tcp --dport 80 -d 195.82.146.120/30 -j DNAT --to-destination 163.172.167.207:3128 |
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
| SELECT * FROM generate_series('2014-01-01'::timestamp, now(), '1 day'); | |
| select id, a.key as account, (a.value::json->0)::text::date as "from", (a.value::json->1)::text::date till from tbl_customer | |
| cross join lateral jsonb_each_text(settings->'frozen_repayment_accounts') a | |
| where settings->'frozen_repayment_accounts' is not null | |
| and (now() between (a.value::json->0)::text::date and (a.value::json->1)::text::date) |
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
| select c.tin, sum(case when lt.type = any(array['interest', 'loan']) then lt.amount else -lt.amount end) portfolio, | |
| round( | |
| 100.0 | |
| * sum(case when lt.type = any(array['interest', 'loan']) then lt.amount else -lt.amount end) | |
| / (select sum(case when type = any(array['interest', 'loan']) then amount else -amount end) from tbl_loan_transaction) | |
| , 2) "%" | |
| from tbl_loan_transaction lt | |
| join tbl_customer c on c.id = lt.customer_id | |
| group by c.tin | |
| having sum(case when lt.type = any(array['interest', 'loan']) then lt.amount else -lt.amount end) > 0 |
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
| create or replace function my_sign(text, numeric) returns numeric as $$ | |
| select case when $1 = any(array['interest', 'loan']) then $2 else -$2 end; | |
| -- select case when position('_repayment' in $1) = 0 then $2 else -$2 end; | |
| $$ language sql; | |
| select * from ( | |
| select distinct on (lt.customer_id) c.tin, | |
| sum(my_sign(lt.type, lt.amount)) over wnd portfolio, | |
| round( | |
| 100.0 |
NewerOlder