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 / 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 / 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-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 / 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 / ajax-request-native.js
Created September 14, 2018 19:17
Making AJAX requests with native JavaScript
/**
* Get data from a URL
* @param {String} url The URL to get
* @param {Function} success Callback to run on success
* @param {Function} error Callback to run on error
*/
var getURL = function ( url, success, error ) {
// Feature detection
if ( !window.XMLHttpRequest ) return;
@aiiddqd
aiiddqd / add-crontab-command.sh
Last active August 14, 2018 17:40
Добавляем команду запуска крона
#!/bin/bash
crontab -l | { cat; echo "*/1 * * * * curl http://site.lcl/wp-cron.php?doing_wp_cron > /dev/null 2>&1"; } | crontab -
@aiiddqd
aiiddqd / example-nginx.conf
Last active August 8, 2018 16:45 — forked from gregrickaby/example-nginx.conf
Defer the loading of images to the production/live server if file not exist - NGINX
server {
# base nginx conf
location ~ ^/wp-content/uploads/(.*) {
try_files $uri @live_uploads;
}
location @live_uploads {
@aiiddqd
aiiddqd / correct-cookie-domain.php
Created July 8, 2018 13:34 — forked from danielbachhuber/correct-cookie-domain.php
Correct the cookie domain when a custom domain is mapped to the site.
@aiiddqd
aiiddqd / install-ioncube.sh
Created May 11, 2018 10:44 — forked from litzinger/install-ioncube.sh
Install IonCube in PuPHPet
echo "Loading ioncube"
wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
echo "Unzipping ioncube"
tar xvfz ioncube_loaders_lin_x86-64.tar.gz
echo "Move ioncube to usr/local"
mv ioncube /usr/local
echo "Add ioncube to php.ini"
sudo sed -i 1i"zend_extension=/usr/local/ioncube/ioncube_loader_lin_5.4.so" /etc/php5/fpm/conf.d/zzzz_custom.ini
sudo sed -i 1i"zend_extension=/usr/local/ioncube/ioncube_loader_lin_5.4.so" /etc/php5/cli/conf.d/zzzz_custom.ini
echo "Restarting Apache and FPM"
<?php
/**
* AmoCRM API Wrapper
*/
class WooAC_API_Wrapper
{
protected $curl;
protected $url_domain;