Skip to content

Instantly share code, notes, and snippets.

import cv2
import time
import multiprocessing
import os
start_time = time.time()
# Used when trying to thread
def process_thread(ports):
for i in ports:
@dovy
dovy / gist:b98c2668a40822d1328b
Created August 11, 2015 17:40 — forked from ultimatemember/gist:48bf0a269af5d182ad9b
EDD Open Metrics: Show various sale stats
// Avg downloads per customer
function sc_edd_avg_downloads_per_customer( $atts ) {
$amount = 0;
$query = new WP_Query( array( 'post_type' => 'download' ) );
foreach( $query->posts as $post ) {
$amount = $amount + edd_get_download_sales_stats( $post->ID );
}
$amount = $amount / edd_count_total_customers();
return number_format( $amount, 2 );
}
@dovy
dovy / gist:c55cf5f76a429db25457
Created August 11, 2015 17:39 — forked from ultimatemember/gist:afb94c5b66c63a34d3c1
EDD Open Metrics: Show recent payments
// recent payments
function sc_edd_recent_payments( $atts ) {
$p_query = new EDD_Payments_Query( array(
'number' => 12,
'status' => 'publish'
) );
$payments = $p_query->get_payments();
@dovy
dovy / js-keycombo.js
Created August 11, 2015 05:22
This jQuery snipper allows you to make any key combo you want, via codes. Just grab the key codes here: http://keycodes.atjayjo.com/
var map = {87: false, 83: false}; // Update checked keys
$( document ).keydown( function( e ) {
if ( e.keyCode in map ) {
map[e.keyCode] = true;
if ( map[87] && map[83] ) { // update checking of keys
console.log('here'); // Action goes here
}
}
}).keyup(function(e) {
if ( e.keyCode in map ) {

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

/*!
SerializeJSON jQuery plugin.
https://github.com/marioizquierdo/jquery.serializeJSON
version 2.6.0 (Apr, 2015)
Copyright (c) 2012, 2015 Mario Izquierdo
Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
*/
(function( $ ) {
<?php
function compiler_action( $options, $css, $changed_values ) {
$keys = array(
'header_color',
'header_footer_color'
);
$compile = false;
foreach ( $changed_values as $key => $value ) {
if ( in_array( $key, $keys ) ) {
# Defaults for ps-watcher initscript
# sourced by /etc/init.d/ps-watcher
# installed at /etc/default/ps-watcher by the maintainer scripts
# prevent startup without configuration file
# set the below varible to 1 in order to allow ps-watcher to start
startup=1
# Specify your configfile here
CONFIG="/etc/ps-watcher.conf"
@dovy
dovy / compiler.php
Last active February 2, 2018 22:58
<?php
Redux::setSection( $opt_name, array(
'title' => __( 'Text Area', 'redux-framework-demo' ),
'desc' => __( 'For full documentation on this field, visit: ', 'redux-framework-demo' ) . '<a href="http://docs.reduxframework.com/core/fields/textarea/" target="_blank">http://docs.reduxframework.com/core/fields/textarea/</a>',
'id' => 'opt-textarea-subsection',
'subsection' => true,
'fields' => array(
array(
'id' => 'background-parallax',