Skip to content

Instantly share code, notes, and snippets.

/* Hide WP version strings from scripts and styles
* @return {string} $src
* @filter script_loader_src
* @filter style_loader_src
*/
function remove_wp_version_strings( $src ) {
global $wp_version;
parse_str(parse_url($src, PHP_URL_QUERY), $query);
if ( !empty($query['ver']) && $query['ver'] === $wp_version ) {
$src = remove_query_arg('ver', $src);
@salipro4ever
salipro4ever / password_regex.md
Created September 30, 2021 07:53 — forked from frizbee/password_regex.md
Regex for password must contain

Minimum eight characters, at least one letter and one number:

/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$/

Minimum eight characters, at least one letter, one number and one special character:

/^(?=.*[A-Za-z])(?=.*\d)(?=.*[@$!%*#?&])[A-Za-z\d@$!%*#?&]{8,}$/

Minimum eight characters, at least one uppercase letter, one lowercase letter and one number:

const HOST_URL = process.env.BASE_URL || 'http://localhost:3000';
//const API_URL = process.env.BASE_API_URL || 'http://14.225.11.12:3030/api/client';
const API_URL = process.env.BASE_API_URL || 'http://localhost:3000';
const webpack = require("webpack");
module.exports = {
mode: 'spa',
@salipro4ever
salipro4ever / nuxt.config.js
Created September 26, 2021 16:50 — forked from mjgartendev/nuxt.config.js
An example nuxt.config.js file heavily commented from the nuxt and vue-meta documentation examples
module.exports = {
/*
Headers of the page
- Nuxt.js uses vue-meta to update the headers and html attributes of your application.
- Nuxt.js configures vue-meta with these options:
{
keyName: 'head', // the component option name that vue-meta looks for meta info on.
attribute: 'data-n-head', // the attribute name vue-meta adds to the tags it observes
ssrAttribute: 'data-n-head-ssr', // the attribute name that lets vue-meta know that meta info has already been server-rendered
tagIDKeyName: 'hid' // the property name that vue-meta uses to determine whether to overwrite or append a tag
@salipro4ever
salipro4ever / nuxtjs-add-script-runtime.md
Last active September 23, 2021 16:19
Nuxtjs add a script runtime mode (no-need build)

In .nuxt/dist/server/ see 2 files. Try to edit them for corresponding case ssr/spa

index.spa.html
index.ssr.html
@salipro4ever
salipro4ever / jquery-scroll-bottom.js
Created September 16, 2021 18:23 — forked from toshimaru/jquery-scroll-bottom.js
Detect the scrolling to bottom of the page using jQuery.
$(window).on("scroll", function() {
var scrollHeight = $(document).height();
var scrollPosition = $(window).height() + $(window).scrollTop();
if ((scrollHeight - scrollPosition) / scrollHeight === 0) {
// when scroll to bottom of the page
}
});
/*
Before Septemper 15 2018, Vietnam has phone number start with 09*, 01(2|6|8|9).
After that, the phone number can start with 03, 05, 07 or 08.
So this function provide a way to validate the input number is a Vietnamese phone number
*/
function isVietnamesePhoneNumber(number) {
return /(03|05|07|08|09|01[2|6|8|9])+([0-9]{8})\b/.test(number);
}
@salipro4ever
salipro4ever / gitlab-ci-error-reinitialized.md
Last active March 31, 2023 10:14
[ERROR] fatal: git fetch-pack: expected shallow list

CAUSE:

Start by checking installed version of git on your CentOS 7 server. This version dont support "git fetch-pack"

$ git --version
git version 1.8.3.1

FIXED:

sudo yum -y install https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm

Linux:

yes | php artisan key:generate

if ! grep -qc "^APP_KEY=.*$" .env; then php artisan key:generate; fi

[Composer\Downloader\TransportException]                                                                                                
  The "https://repo.packagist.org/packages.json" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:  
  error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed                                                       
  Failed to enable crypto                                                                                                                 
  failed to open stream: operation failed

=>