Skip to content

Instantly share code, notes, and snippets.

@VlaDeveloper
VlaDeveloper / functions.php
Last active December 8, 2021 12:36
Get posts with category
<?php
global $post;
$myposts = get_posts( [
'posts_per_page' => -1,
'category_name' => 'cat',
'post_type' => 'post',
'orderby' => 'date',
'order' => 'ASC',
] );
@VlaDeveloper
VlaDeveloper / twenty.txt
Created September 15, 2021 06:56
Difference between images
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="css/twentytwenty.css">
<link rel="stylesheet" href="css/main.css">
@VlaDeveloper
VlaDeveloper / script.ahk
Created September 7, 2021 08:50
AutoHotKey
; Открываем скрипт
Numpad1::Run C:\Windows\Notepad.exe "your_way\script.ahk"
; Сохраняем и перезагружаем скрипт
Numpad5::Y
Send {Ctrl down}s{Ctrl up}
Reload
Sleep 1000 ; If successful, the reload will close this instance during the Sleep, so the line below will never be reached.
@VlaDeveloper
VlaDeveloper / common.txt
Last active August 23, 2021 11:49
Validate and mask
html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Маска и валидация</title>
<link rel="stylesheet" href="main.css">
</head>
@VlaDeveloper
VlaDeveloper / wp-db
Last active July 2, 2022 15:29
Getting orders in WordPress with using Databases
example.php:
<?php
/**
* Plugin Name: Плагин с БД
* Description: Работа с БД
* Author: Влад
* Version: 1.0
*
*
* License: GPL2
@VlaDeveloper
VlaDeveloper / send
Last active November 12, 2021 14:08
Vk sending
HTML код:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="main.css">
</head>
@VlaDeveloper
VlaDeveloper / MIGX checkbox
Created December 4, 2019 10:12
MIGX checkbox in back-end
{"field":"is", "caption":"Условие?", "inputTVtype":"checkbox", "inputOptionValues":"Да==something"}
@VlaDeveloper
VlaDeveloper / common.js
Created October 13, 2019 13:20
Popups for repeating items
$('.some-item-button-popup').each(function(e){
var ths = $(this);
ths.attr('href', '#popup-' + e);
ths.parent().find('.some-item-popup').attr('id', 'popup-' + e);
});
@VlaDeveloper
VlaDeveloper / highDensityLiquidLazy.js
Created July 10, 2019 12:19
High Density Liquid Images With Lazy Load
function isHighDensity(){
return ((window.matchMedia && (window.matchMedia('only screen and (min-resolution: 124dpi), only screen and (min-resolution: 1.3dppx), only screen and (min-resolution: 48.8dpcm)').matches || window.matchMedia('only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 2.6/2), only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (min-device-pixel-ratio: 1.3)').matches)) || (window.devicePixelRatio && window.devicePixelRatio > 1.3));
}
if(isHighDensity()){
var oldSrc,
newSrc;
$('.lazy').each(function(){
oldSrc = $(this).data('src');
newSrc = oldSrc.replace('@1x', '@2x');
$('.button-link').click(function(){
yaCounterXXXXXXXX.reachGoal('click');
gtag('event', 'click');
});