Skip to content

Instantly share code, notes, and snippets.

@adnan360
adnan360 / functions.php_snip
Created January 5, 2017 01:42
Booked plugin - test timestamp
$start_timestamp = strtotime('-1 second',strtotime($year.'-'.$month.'-'.$day.' 00:00:00'));
$end_timestamp = strtotime('+1 second',strtotime($year.'-'.$month.'-'.$day.' 23:59:59'));
@adnan360
adnan360 / functions.php_snip
Created January 5, 2017 01:44
Booked plugin - test timestamp (fix)
$start_timestamp = strtotime('-1 second',strtotime($year.'-'.$month.'-'.$day.' 00:00:01'));
$end_timestamp = strtotime('+1 second',strtotime($year.'-'.$month.'-'.$day.' 23:59:58'));
@adnan360
adnan360 / fixme_booked.php
Created January 5, 2017 01:51
Booked plugin - a fix plugin for the problem
<?php
/*
Plugin Name: fixme test for booked plugin
Using: place it in the plugins dir and activate from wp-admin
*/
if( ! function_exists( 'mplus_fix_query' ) )
{
function mplus_fix_query( $args ) {
// echo '<pre>'.print_r($args, true).'</pre>';
@adnan360
adnan360 / xampp-control-panel.desktop
Last active January 19, 2017 03:00
XAMPP GUI Control Panel shortcut for linux
[Desktop Entry]
Comment=Start and Stop XAMPP
Name=XAMPP Control Panel
Exec=gksudo python2 /opt/lampp/share/xampp-control-panel/xampp-control-panel.py
#Exec=gksudo /opt/lampp/manager-linux.run
Icon=/usr/share/icons/Humanity/devices/24/network-wired.svg
Encoding=UTF-8
Terminal=false
Name=XAMPP Control Panel
Comment=Start and Stop XAMPP
@adnan360
adnan360 / huge-sql-import.php
Created February 22, 2017 05:29
No limit database import (huge sql files import with automatic break and resume)
<?php
// Source: http://stackoverflow.com/a/25749714
if (empty($_GET['pass'])) { die('error'); }
// your config
$filename = 'yourGigaByteDump.sql';
$dbHost = 'localhost';
$dbUser = 'user';
$dbPass = '__pass__';
$dbName = 'dbname';
@adnan360
adnan360 / fonts.conf
Created June 13, 2017 14:42
Set preferred font in Linux (set system's default fonts)
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<!-- for: ~/.config/fontconfig/fonts.conf -->
<alias>
<family>serif</family>
<prefer><family>Noto Sans</family></prefer>
</alias>
@adnan360
adnan360 / filter orders.php
Created July 6, 2017 06:15
Wordpress/Woocommerce: Filter orders by custom meta tag
<?php
add_action( 'restrict_manage_posts', 'posts_filter_dropdown' );
function posts_filter_dropdown($post_type) {
// error_log('$post_type ====='.$post_type);
if('shop_order' != $post_type){
return;
}
$selected_option = @$_GET['order_type_filter'];
echo '
@adnan360
adnan360 / compton.conf
Created July 19, 2017 18:16
Compton configuration for a typical installation (~/.config/compton.conf)
shadow = true;
no-dnd-shadow = true;
no-dock-shadow = true;
clear-shadow = true;
shadow-radius = 7;
shadow-offset-x = -7;
shadow-offset-y = -7;
shadow-exclude = [ "name = 'Notification'", "class_g = 'Conky'", "class_g ?= 'Notify-osd'", "class_g = 'Cairo-clock'", "class_g = 'Synapse'", "class_g = 'Firefox' && argb" ];
shadow-ignore-shaped = true;
menu-opacity = 0.9;
@adnan360
adnan360 / how to setup ngrok.md
Last active August 23, 2017 02:04
How to setup NGROK

NGROK - A nifty little program to share your localhost with everyone

We have live sites for running client sites, we have staging sites for testing. But what about localhost sites. We sometimes have some test code running in local that we want the world to see!

NGROK is a tiny program that let's you temporarily create an url for your localhost! And anybody with the URL can visit this and enjoy the goodness within!

Moreover it does not need install, runs on Windows, Linux, Mac, BSD or ARM, plus its open source. How cool can it get?!

Basics (for geeks)

@adnan360
adnan360 / noLimitDumpRestore.php
Created August 31, 2017 10:34
No limit mysql dump import tool (pauses and resumes automatically, great for big sql files)
<?php
// source: https://stackoverflow.com/a/25749714
// by Grain
// your config
$filename = 'yourGigaByteDump.sql';
$dbHost = 'localhost';
$dbUser = 'user';
$dbPass = '__pass__';
$dbName = 'dbname';
$maxRuntime = 8; // less then your max script execution limit