Skip to content

Instantly share code, notes, and snippets.

@ak5
ak5 / woocommerce-order-stuff.php
Created October 7, 2016 06:24
WooCommerce Order Creation + Updating
<?php
// this is the current id of an order in test env
$id = 44;
$order = wc_get_order($id);
/** OR **/
// create a new order like so
$address = array(
@ak5
ak5 / host-manager
Created October 8, 2016 09:21 — forked from nddrylliog/host-manager
A command-line utility to manage the /etc/hosts file.
#!/bin/bash
# Idea and interface taken from https://github.com/macmade/host-manager
path="/etc/hosts"
addusage="Usage: `basename $0` -add host address"
remusage="Usage: `basename $0` -remove host"
case "$1" in
-add)
if [ $# -eq 3 ]; then
if [[ -n $(grep "^$3.*[^A-Za-z0-9\.]$2$" ${path}) ]]; then