View functions.php
<?php
add_action('wp_ajax_cart_count', 'custom_cart_count');
add_action('wp_ajax_nopriv_cart_count', 'custom_cart_count');
function custom_cart_count() {
echo WC()->cart->cart_contents_count;
wp_die();
}
add_action('wp_enqueue_scripts', 'custom_scripts');
View wp-multiple-database.php
<?php
$wpdb2 = new wpdb('USER', 'PASS', 'DB_NAME', 'HOST');
$sql = "SELECT *
FROM wp_posts
WHERE post_type = 'product'
AND post_status = 'publish'
";
$products = $wpdb2->get_results($sql, ARRAY_A);
View nohup-on-remote.sh
DISPLAY=:0 nohup chromium URL_TO_OPEN_ON_REMOTE_BROWSER > /dev/null &
View woocommerce-email-custom-locale.php
<?php
/**
* Plugin Name: Slovak WooCommerce emails
* Plugin URI: https://www.nevilleweb.sk/
* Description: Send only slovak WooCommerce emails
* Version: 1.0.0
* Author: Michal Zuber
* Author URI: https://nevilleweb.sk/
*/
if (!defined('ABSPATH')) {
View .htaccess
# ~~start~~ Do not remove this comment, prestashop will keep automatically the code outside this comment when .htaccess will be generated again
# .htaccess automaticaly generated by prestashop e-commerce open-source solution
# http://www.prestashop.com - http://www.prestashop.com/forums
<IfModule mod_rewrite.c>
<IfModule mod_env.c>
SetEnv HTTP_MOD_REWRITE On
</IfModule>
RewriteEngine on
View .gitconfig
[alias]
last-month = !git log --reverse --pretty=format:'%cd %h %s' --date=short --no-merges --since=$(date -d \"$(date +%Y-%m)-01 last month\" \"+%Y-%m-01\") --author=$(git config user.email)
View chrome-search-engine-remove.js
document.querySelectorAll('#other-search-engine-list [selected] .row-delete-button').forEach(function(el) {el.click();})
View phinx-sf2-migrate.php
<?php
use Phinx\Console\PhinxApplication;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\BufferedOutput;
use Symfony\Component\HttpFoundation\Response;
public function migrateDbAction()
{
$kernel = $this->get('kernel');
View vim-fugitive-shortcuts
# Basic commands
:Git [args] # does what you'd expect
all of your `~/.gitconfig` aliases are available.
:Git! [args] # same as before, dumping output to a tmp file
Moving inside a repo.
View php7-lint.sh
#!/bin/bash
find . -name '*.php' | xargs -i php -l {} | grep -v 'No syntax errors'