Skip to content

Instantly share code, notes, and snippets.

View RiodeJaneiroo's full-sized avatar
🎯
Focusing

Vadim Zmiievskyi RiodeJaneiroo

🎯
Focusing
  • Ukraine
View GitHub Profile
@RiodeJaneiroo
RiodeJaneiroo / method1.js
Last active March 15, 2023 17:30
[Разбить число на разряды JS] #js #javascript #number
// Method #1
var num = 1234567890;
var result = num.toLocaleString(); // or .toLocaleString('ru');
console.log(result);
// Method #2
function numberWithSpaces(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ");
}
console.log(numberWithSpaces(100));
@RiodeJaneiroo
RiodeJaneiroo / functions.php
Created January 30, 2019 09:56
[Fix url] #wordpress #seo
<?php
// fix when zero in end url
add_action( 'pre_handle_404', 'fix_fake_page' );
function fix_fake_page( $false ) {
global $wp_query;
if ( is_singular()
&& isset( $wp_query->query['page'] )
&& $wp_query->query['page'] === '0'
) {
@RiodeJaneiroo
RiodeJaneiroo / .gitignore
Last active March 7, 2019 08:34
gitignore
node_modules/
build/
# Created by https://www.gitignore.io/api/vue,node,sass,macos,vuejs,nuxtjs,phpstorm,visualstudiocode
# Edit at https://www.gitignore.io/?templates=vue,node,sass,macos,vuejs,nuxtjs,phpstorm,visualstudiocode
### macOS ###
# General
.DS_Store
.AppleDouble
@RiodeJaneiroo
RiodeJaneiroo / index.html
Last active October 15, 2019 16:33
[YouTube Iframe ] optimization
<div class="ytvideo">
<a class="ytvideo__link" href="https://youtu.be/tTHiLxPHwWo" data-id="tTHiLxPHwWo">
<picture>
<img class="ytvideo__media img lazyload" data-src="http://img.youtube.com/vi/tTHiLxPHwWo/0.jpg" alt="Отзыв">
</picture>
</a>
<button class="ytvideo__button" type="button" aria-label="Запустить видео">
<svg width="68" height="48" viewBox="0 0 68 48">
<path class="ytvideo__button-shape" d="M66.52,7.74c-0.78-2.93-2.49-5.41-5.42-6.19C55.79,.13,34,0,34,0S12.21,.13,6.9,1.55 C3.97,2.33,2.27,4.81,1.48,7.74C0.06,13.05,0,24,0,24s0.06,10.95,1.48,16.26c0.78,2.93,2.49,5.41,5.42,6.19 C12.21,47.87,34,48,34,48s21.79-0.13,27.1-1.55c2.93-0.78,4.64-3.26,5.42-6.19C67.94,34.95,68,24,68,24S67.94,13.05,66.52,7.74z"></path>
<path class="ytvideo__button-icon" d="M 45,24 27,14 27,34"></path>
@RiodeJaneiroo
RiodeJaneiroo / index.html
Last active December 17, 2018 14:30
[Hambureger menu] #css #mobileMenu
<div class="menu-wrapper">
<div class="hamburger-menu"></div>
</div>
@RiodeJaneiroo
RiodeJaneiroo / index.js
Last active December 1, 2018 12:44
[Склонение числительных javascript] #js #javascript
//Склонение числительных
function declOfNum(n, titles) {
return titles[(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)];
}
/*
use: declOfNum(count, ['найдена', 'найдено', 'найдены']);
*/
@RiodeJaneiroo
RiodeJaneiroo / functions.php
Last active March 27, 2019 13:34
[Wordpress ajax load post on click button] Ajax load posts click button #wordpress #ajax
/**
* Javascript for Load More
*
*/
function be_load_more_js() {
$query = array(
'posts_per_page' => 6,
'post_type' => 'reviews'
@RiodeJaneiroo
RiodeJaneiroo / style.css
Created November 15, 2018 19:33
[CSS border - dashed styling] #css #border
.expl {
background-image: url("data:image/svg+xml;utf8,<svg width='100%' height='100%' xmlns='http://www.w3.org/2000/svg'><rect width='100%' height='100%' style='fill: none; stroke: #d9d3cb; stroke-width: 4; stroke-dasharray: 8 8'/></svg>");
}
@RiodeJaneiroo
RiodeJaneiroo / functions.php
Last active November 15, 2018 19:10
[Wordpress CPT - reviews ] Register custom post type - Reviews #wordpress #cpt
add_action('init', 'mp_register_reviews');
function mp_register_reviews(){
register_post_type('reviews', array(
'labels' => array(
'name' => 'Отзывы', // Основное название типа записи
'singular_name' => 'Отзыв', // отдельное название записи типа Book
'add_new' => 'Добавить новый отзыв',
'add_new_item' => 'Добавить новый отзыв',
'edit_item' => 'Редактировать отзыв',
'new_item' => 'Новый отзыв',
@RiodeJaneiroo
RiodeJaneiroo / sql.sql
Created November 14, 2018 16:18
[Wordpress Opimize] optimize wp #wordpress #optimize
DELETE FROM wp_posts WHERE post_type = "revision";