Skip to content

Instantly share code, notes, and snippets.

View dingo-d's full-sized avatar
🏠
Working from home

Denis Žoljom dingo-d

🏠
Working from home
View GitHub Profile
@MindyPostoff
MindyPostoff / disable-paypal-woocommerce
Last active January 16, 2017 12:07
Disable PayPal in WooCommerce Checkout for Certain Products
/*
* Disable PayPal payment method in the checkout if certain
* products are present in the cart.
*
* Add this to your theme's functions.php file
*/
add_filter( 'woocommerce_available_payment_gateways', 'filter_gateways', 1);
function filter_gateways( $gateways ){
global $woocommerce;
@runcom
runcom / update-vagrant
Last active June 1, 2017 10:11
Shell script to upgrade your vagrant to the latest version
#!/bin/sh
ONLINE_VERSION=$(curl -s https://www.vagrantup.com/downloads.html) | grep -i 'x86_64.deb' | sed 's/.*\/vagrant_\(.*\)_x86_64\.deb.*/\1/i'
SYSTEM_VERSION=$(vagrant --version) | sed 's/^vagrant \(.*\)$/\1/i'
VAGRANT_CHECK=$(command -v vagrant >/dev/null 2>&1)
#if [ "$VAGRANT_CHECK" = 1 ]; then
#novagrant
#else
@pippinsplugins
pippinsplugins / gist:9201867
Created February 25, 2014 03:06
Simple example of how to use SCRIPT_DEBUG to load non-minified assets
<?php
// Use minified libraries if SCRIPT_DEBUG is turned off
$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
wp_enqueue_script( 'my-script-handle', plugin_dir_url( __FILE__ ) . 'assets/my-file' . $suffix . '.js', array( 'jquery' ) );
@brasofilo
brasofilo / comments-2-excel.php
Last active April 1, 2018 06:54
Export WordPress Comments as Excel file. Uses PHPExcel, http://phpexcel.codeplex.com/. Place this file in the root of the WordPress installation. TODO: convert to plugin.
<?php
# Load slim WP
define( 'WP_USE_THEMES', false );
require( './wp-load.php' );
# http://phpexcel.codeplex.com/
require_once dirname(__FILE__) . '/Classes/PHPExcel.php';
global $wpdb;
$query = "SELECT * FROM $wpdb->comments
@bretdavidson
bretdavidson / JSLint Options Descriptions
Last active October 5, 2018 22:37 — forked from dannygarcia/SublimeLinter.sublime-settings
Sublime Linter User Settings
anon true, if the space may be omitted in anonymous function declarations
bitwise true, if bitwise operators should be allowed
browser true, if the standard browser globals should be predefined
cap true, if upper case HTML should be allowed
continue true, if the continuation statement should be tolerated
css true, if CSS workarounds should be tolerated
debug true, if debugger statements should be allowed
devel true, if logging should be allowed (console, alert, etc.)
eqeq true, if == should be allowed
es5 true, if ES5 syntax should be allowed
@lysender
lysender / using-aws-kms.php
Created November 10, 2015 09:13
Using AWS KMS API via PHP SDK
<?php
use Aws\Kms\KmsClient;
// Somewhere in the controller or model
$this->load->config('aws');
// Not needed for EC2 instance role based authorization - for my local instance only
$key = $this->config->item('aws_s3_access_key');
$secret = $this->config->item('aws_s3_secret_key');
@Serlych
Serlych / epub.css
Last active November 25, 2020 13:03 — forked from maticrivo/epub.css
You Don't Know JS Ebooks
body {
text-align: justify;
}
code, pre {
font-family: "Hack", monospace;
}
h1, h2, h3, h4, h5, h6 {
text-align: left;
@carlalexander
carlalexander / expect-header-fix.php
Last active August 13, 2021 00:40
WordPress "Expect" header fix
<?php
/**
* By default, cURL sends the "Expect" header all the time which severely impacts
* performance. Instead, we'll send it if the body is larger than 1 mb like
* Guzzle does.
*/
function add_expect_header(array $arguments)
{
$arguments['headers']['expect'] = '';
@fsuste
fsuste / Gems.md
Last active November 24, 2021 13:06
List of problematic gems and fixes

Eventmachine 1.0.8.

You can also update eventmachine to 1.0.9. and that should fix the problem

gem install eventmachine -v '1.0.8' -- --with-cppflags=-I/usr/local/opt/openssl/include

Nokogiri 1.6.*

@renatomefi
renatomefi / README.md
Last active December 13, 2021 12:15
Milhog start script for Ubuntu 14.04

This is a simple way to install mailhog, might not be the best solution for everyone, you can look for repositories, still have to register the binary in the PATH, among other things, this is a manual simple install.

Binary download

Download mailhog from the releases page on github: https://github.com/mailhog/MailHog/releases Save the binary at /opt/mailhog/mailhog Give it executable permission chmod +x /opt/mailhog/mailhog

Init script

Download the gist: https://gist.github.com/renatomefi/d133fea9cb5a7b00f91edb24b83d9a31#file-init-d-mailhog-sh Put it at /etc/init.d/mailhog