Skip to content

Instantly share code, notes, and snippets.

View yuriitaran's full-sized avatar

Yurii Taran yuriitaran

View GitHub Profile
@arielweinberger
arielweinberger / strong-password-regex.md
Last active April 12, 2024 19:57
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]).*$/
@kostiantyn-petlia
kostiantyn-petlia / helpers-write-log.php
Last active March 23, 2023 12:12
Logging function write_log() for debugging process
// -----------------------------------------------------------------------------
/**
* Logging to debug.log in DEBUG_LOG_DIR dir (default is the root site dir)
*
* Note: In the wp-config.php:
*
* you need define:
* 0) define( 'DEBUG_LOG', true )
*
@yuriitaran
yuriitaran / WP Fancybox 2 + Youtube video
Last active February 14, 2018 23:10
WP Fancybox 2 + Youtube video
// functions.php
wp_enqueue_script( 'youtube', 'http://www.youtube.com/player_api', null, null, true ); /* This loads the YouTube IFrame Player API code */
// link, button
$url = $link['url'];
if ( ! ( $btn_class = $link['class'] ) ) {
$btn_class = 'button learn-more';
// in footer.php or header.php
<div><strong>Current template:</strong> <?php get_current_template( true ); ?></div>
// in functions.php
/**
* Define current template file
*
* Create a global variable with the name of the current
* theme template file being used.
*
@ba11b0y
ba11b0y / installing-postman.md
Last active August 31, 2023 19:21
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
@DWboutin
DWboutin / Merge wp_query
Created February 7, 2014 14:17
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
@jaicab
jaicab / responsive-video.css
Last active July 29, 2023 02:52
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,
@jexchan
jexchan / multiple_ssh_setting.md
Created April 10, 2012 15:00
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"