Skip to content

Instantly share code, notes, and snippets.

View yuriitaran's full-sized avatar

Yurii Taran yuriitaran

View GitHub Profile
@yuriitaran
yuriitaran / strong-password-regex.md
Created December 13, 2020 22:40 — forked from arielweinberger/strong-password-regex.md
Strong password Regular Expression - NestJS Course
  • Passwords will contain at least 1 upper case letter
  • Passwords will contain at least 1 lower case letter
  • Passwords will contain at least 1 number or special character
  • There is no length validation (min, max) in this regex!

Regular expression for JavaScript:

/((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/
@yuriitaran
yuriitaran / installing-postman.md
Last active September 5, 2020 20:15 — forked from ba11b0y/installing-postman.md
Installing Postman on Ubuntu/Gnome

Since Chrome apps are now being deprecated. Download postman from https://dl.pstmn.io/download/latest/linux

Although I highly recommend using a snap

sudo snap install postman

Installing Postman

tar -xzf Postman-linux-x64-5.3.2.tar.gz
@yuriitaran
yuriitaran / responsive-video.css
Created November 27, 2018 13:21 — forked from jaicab/responsive-video.css
Pure CSS solution for embed videos with an aspect ratio of 16:9
.video-container {
position: relative;
padding-bottom: 56.25%; /*16:9*/
padding-top: 30px;
height: 0;
overflow: hidden;
}
.video-container iframe,
.video-container object,
@yuriitaran
yuriitaran / helpers-write-log.php
Created November 14, 2018 16:01 — forked from kostiantyn-petlia/helpers-write-log.php
Logging function write_log() for debugging process
// -----------------------------------------------------------------------------
/**
* Logging to debug.log in DEBUG_LOG_DIR dir (default is the root site dir)
*
* Note: You can define in the wp-config.php:
* 1) define( 'DEBUG_LOG_DIR', dirname( __FILE__ ) . '/' );
* 2) define( 'DEBUG_LOG_INVERTED', false);
*
* Author K
<?php
function my_customize_rest_cors() {
remove_filter( 'rest_pre_serve_request', 'rest_send_cors_headers' );
add_filter( 'rest_pre_serve_request', function( $value ) {
header( 'Access-Control-Allow-Origin: *' );
header( 'Access-Control-Allow-Methods: GET' );
header( 'Access-Control-Allow-Credentials: true' );
header( 'Access-Control-Expose-Headers: Link', false );
@yuriitaran
yuriitaran / Foo.test.js
Created September 15, 2018 06:58 — forked from mweibel/Foo.test.js
Mock react-beautiful-dnd
// mocks react-beautiful-dnd Droppable without the need of a DragDropContext etc.
jest.mock('react-beautiful-dnd', () => ({
Droppable: jest.fn(
// params to children are `provider`, `snapshot`
({children}) => children({}, {})
)
}));
@yuriitaran
yuriitaran / movies.json
Created August 29, 2018 12:03 — forked from yannski/movies.json
movies.json
[{"id":"4fede17c312f912796000034","cover_url":null,"description":null,"rating":6.3,"title":"L'affaire Gordji, histoire d'une cohabitation"},{"id":"4fede17f312f912796000035","cover_url":null,"description":"Documentary telling the true story of the sinking of the liner Laconia by a German U-boat in 1942 through the eyes of six survivors.","rating":6.8,"title":"Le naufrage du Laconia - partie 1"},{"id":"4fede181312f912796000036","cover_url":null,"description":"Documentary telling the true story of the sinking of the liner Laconia by a German U-boat in 1942 through the eyes of six survivors.","rating":6.8,"title":"Le naufrage du Laconia - partie 2"},{"id":"4fede184312f912796000037","cover_url":"http://ia.media-imdb.com/images/M/MV5BMjAyMTg0MjgwOV5BMl5BanBnXkFtZTcwNTEzODY4Mw@@._V1._SX94_SY140_.jpg","description":"The extraordinary story of three Rwandan kids who walk 3000 miles to the Soccer World Cup in South Africa...","rating":6.2,"title":"Africa United"},{"id":"4fede186312f912796000038","cover_url":"http://ia.
@yuriitaran
yuriitaran / Merge wp_query
Created March 7, 2018 16:02 — forked from DWboutin/Merge wp_query
Merge 2 WP_Query()
<?php
$query1 = new WP_Query($arg1);
$query2 = new WP_Query($arg2);
$query = new WP_Query();
$query->posts = array_merge( $query1->posts, $query2->posts );
// we also need to set post count correctly so as to enable the looping
@yuriitaran
yuriitaran / phpstorm.md
Created February 4, 2018 12:46 — forked from gekh/phpstorm.md
Настройка PhpStorm

В PhpStorm выбрать кодстиль PSR: Settings → Editor → Code Style → PHP → Set from... → Predefinded Style → PSR1/PSR2

Настроить в PhpStorm правильные переносы файлов: Settings → Editor → Code Style → Line Separator (for new files): Unix and OS X (\n)

В существующих файлах справа внизу в PhpStorm везде должен быть LF (там может быть еще CRLF или CR).

В настройках Directories у каждого проекта .idea, web/assets и runtime ставить Excluded

<?php
if ( have_posts() ) : // если имеются записи в блоге.
query_posts('cat=3'); // указываем ID рубрик, которые необходимо вывести.
while (have_posts()) : the_post(); // запускаем цикл обхода материалов блога
?>
<?php the_post_thumbnail(array(100, 100)); ?>
<? endwhile; // завершаем цикл.
endif;
/* Сбрасываем настройки цикла. Если ниже по коду будет идти еще один цикл, чтобы не было сбоя. */
wp_reset_query();