Skip to content

Instantly share code, notes, and snippets.

View BHEADRICK's full-sized avatar

Bryan Headrick BHEADRICK

View GitHub Profile
@BHEADRICK
BHEADRICK / splitcsv.py
Created September 3, 2021 12:57
Split csv file and retain the header
import pandas as pd
#csv file name to be read in
in_csv = 'filename.csv'
#get the number of lines of the csv file to be read
number_lines = sum(1 for row in (open(in_csv)))
#size of rows of data to write to the csv,
#you can change the row size according to your need
@BHEADRICK
BHEADRICK / .htaccess
Created October 10, 2019 15:21
force SSL for wp - avoid too many redirects
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
@BHEADRICK
BHEADRICK / dropshipping.diff
Last active June 17, 2019 14:10
WC Dropshipping issues
--- //wp-content/plugins/woocommerce-dropshipping/inc/class-wc-dropshipping-admin.php 2019-06-11 23:30:10.000000000 -0400
+++ //wp-content/plugins/woocommerce-dropshipping.new/inc/class-wc-dropshipping-admin.php 2019-06-17 09:57:01.000000000 -0400
@@ -221,7 +221,7 @@
foreach ($meta as $key => $val) {
if (isset($_POST[$key])) $meta[$key] = $_POST[$key];
}
/* update_woocommerce_term_meta is deprecated, use update_term_meta */
- $cterm = update_woocommerce_term_meta( $term_id, 'meta', $meta );
+ $cterm = update_term_meta( $term_id, 'meta', $meta );
@BHEADRICK
BHEADRICK / class-wc-dropshipping-order.php
Created February 21, 2019 20:28
WC_Dropshipping_Orders wc3
<?php
class WC_Dropshipping_Orders {
public function __construct() {
$this->init();
}
public function init() {
// order processing
add_filter('wc_dropship_manager_send_order_email_html',array($this,'send_order_email_html'));
add_filter('wc_dropship_manager_send_order_attachments',array($this,'send_order_attach_packingslip'),10,3);
@BHEADRICK
BHEADRICK / wp-config.php
Created December 1, 2018 14:19
Boilerplate wp-config options
//hardcode domain
define('WP_HOME','https://yourdomain.com');
define('WP_SITEURL','https://yourdomain.com');
// force ssl admin
define( 'FORCE_SSL_ADMIN', true );
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
<template>
<div v-bind:class="'form-group ' + wrapperClass">
<span class="required-lbl" v-if="required">* </span>
<label>{{ label }}</label>
<select class="form-control" v-bind:required="required" @change="updateInput($event.target.value)">
<option v-if="placeholder" value="">{{placeholder}}</option>
<option v-for="(option,key) in this.options" value="option" v-bind:value="key">{{option}}</option>
</select>
</div>
</template>
<template>
<div v-bind:class="'form-group control-group ' + wrapperClass">
<span class="required-lbl pull-left" v-if="required">* </span>
<label class="control-label">{{ label }}</label>
<div class="controls">
<div v-bind:class="rightAddon || leftAddon?'input-group':''">
<span v-if="rightAddon" class="input-group-addon">{{rightAddon}}</span>
<input v-bind:type="type" @input="updateInput($event.target.value)" class="form-control"
v-bind:required="required" :value="value" v-bind:placeholder="placeholder">
@BHEADRICK
BHEADRICK / install_nodejs.sh
Last active January 12, 2017 02:56
Raspberry Pi3 install latest nodejs
sudo apt-get install git && git clone https://github.com/BHEADRICK/NodeJs-Raspberry-Pi && cd NodeJs-Raspberry-Pi && chmod +x Install-Node.sh && sudo ./Install-Node.sh;
.video { position: relative; padding-bottom: 56.25%; /* 16:9 */ height: 0; }
.video img { position: absolute; display: block; top: 0; left: 0; width: 100%; height: 100%; z-index: 20; cursor: pointer; }
.video:after { content: ""; position: absolute; display: block;
background: url(play-button.png) no-repeat 0 0;
top: 45%; left: 45%; width: 46px; height: 36px; z-index: 30; cursor: pointer; }
.video iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
/* image poster clicked, player class added using js */
.video.player img { display: none; }
.video.player:after { display: none; }
@BHEADRICK
BHEADRICK / gist:7949967
Created December 13, 2013 19:37
WordPress Plugin Settings Link
// Add settings link on plugin page
function your_plugin_settings_link($links) {
$settings_link = '<a href="options-general.php?page=your_plugin.php">Settings</a>';
array_unshift($links, $settings_link);
return $links;
}
$plugin = plugin_basename(__FILE__);
add_filter("plugin_action_links_$plugin", 'your_plugin_settings_link' );