Skip to content

Instantly share code, notes, and snippets.

View aiiddqd's full-sized avatar
💻
Code is poetry...

Antony I aiiddqd

💻
Code is poetry...
View GitHub Profile
@aiiddqd
aiiddqd / index.php
Created October 1, 2018 15:55
Adminer > 3.6.3 auto login for my Vagrant config
<?php
if(empty($_GET['username']) ){
$_GET['username'] = 'vagrant';
}
function adminer_object() {
class AdminerSoftware extends Adminer {
function credentials() {
@aiiddqd
aiiddqd / wp-rest-api-wrapper.js
Created October 4, 2018 10:52
AJAX wrapper for native JavaScript and WordPress REST API
/**
* AJAX обертка для WordPress REST API
*/
let sb_ajax = function ( ep, success, error, type = 'GET', data = '' ) {
url = wpApiSettings.root + ep;
// Feature detection
if ( !window.XMLHttpRequest ) return;
@aiiddqd
aiiddqd / sqlgz.sh
Created October 24, 2018 08:15
Extract Sql.Gz File On Command Line (macos, linux)
gzip -d backup-20100910164109.sql.gz
@aiiddqd
aiiddqd / WP-CLI-Commands
Created October 26, 2018 07:34 — forked from mizner/WP-CLI-Commands
WP-CLI - Handy Commands
Search and replace
https://wp-cli.org/commands/search-replace/
wp search-replace
wp search-replace 'http://example.dev' 'http://example.com'
Optmize database
https://wp-cli.org/commands/db/optimize/
wp db optimize
Repair database
@aiiddqd
aiiddqd / delete-commentmeta-without-comments.sql
Created October 29, 2018 10:39
WordPress & SQL - delete commentmeta without comments
DELETE cm
FROM wp_commentmeta as cm
LEFT JOIN wp_comments as c ON c.comment_ID = cm.comment_id
WHERE c.comment_ID is null
@aiiddqd
aiiddqd / wordpress-mysql-comments-1-year-ago.sql
Created October 29, 2018 10:46
WordPress - Комменты более года
-- WordPress - Comments 1 year ago
SELECT *
FROM wp_comments as c
WHERE c.comment_date_gmt < DATE_SUB(NOW(),INTERVAL 1 YEAR)
ORDER BY c.comment_date_gmt DESC
LIMIT 50
@aiiddqd
aiiddqd / wordpress-mysql-delete-comments-1-year-ago.sql
Created October 29, 2018 10:54
WordPress & MySQL. Удаляем комментарии добавленные более года назад
-- delete comments 1 year ago
DELETE c
FROM wp_comments as c
WHERE c.comment_date_gmt < DATE_SUB(NOW(),INTERVAL 1 YEAR)
@aiiddqd
aiiddqd / cookie.js
Last active August 12, 2019 08:36
cookie.js - functions for cookies working with vanilla JavaScript (from https://learn.javascript.ru/cookie, repo https://github.com/uptimizt/cookies.js)
@aiiddqd
aiiddqd / ulog.php
Created October 8, 2019 16:35
Fast logger for WordPress. Set up as file to wp-content/mu-plugins/
<?php
add_action('u/log', function($msg, $data = []){
error_log( PHP_EOL . $msg);
if(!empty($data)){
ob_start();
echo PHP_EOL;
var_dump($data);
error_log(ob_get_clean());
<?php
namespace SB\Models;
/**
* Class Event model for map data
*
* @package SB
*/
class Event {
/**