Skip to content

Instantly share code, notes, and snippets.

@theinventor
theinventor / woocommercer.rb
Created May 17, 2015 19:21
This is a quick class to handle talking to woocommerce in ruby. I borrowed the whole thing from here: https://github.com/gurgus/RuWoCo, then updated to v2 and added PUT
class Woocommercer
require "digest/sha1"
require "cgi"
require "json"
require "base64"
require "openssl"
require "net/http"
require "net/https"
attr_accessor :consumer_key, :consumer_secret, :api_url, :is_ssl
@thenbrent
thenbrent / woocommerce-api-developer-test.md
Last active December 22, 2015 18:39
WooCommerce Developer Test

WooCommerce API Test

Create a WordPress plugin to add an API endpoint for recent orders placed with a WooCommerce store.

The API endpoint should accept one parameter - an integer for the number of recent orders. For example, passing "5" to the endpoint will return the 5 most recent orders (ordered from newest to oldest).

If no integer is passed to the endpoint, WordPress's default posts per page setting should be used to determine the number of orders.

The endpoint's response should be a JSON object containing the relevant number of WC_Order objects.

@wpsmith
wpsmith / wp_user_query.php
Created August 14, 2012 21:37
WP_User_Query
<?php
/**
* WordPress WP_User_Query Comprehensive Reference
* Compiled by wpsmith - wpsmith.net
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_User_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.4.1/wp-includes/user.php
*/
$args = array(
@maxrice
maxrice / us-state-names-abbrevs.php
Created May 23, 2012 18:32
US State Names & Abbreviations as PHP Arrays
<?php
/* From https://www.usps.com/send/official-abbreviations.htm */
$us_state_abbrevs_names = array(
'AL'=>'ALABAMA',
'AK'=>'ALASKA',
'AS'=>'AMERICAN SAMOA',
'AZ'=>'ARIZONA',
'AR'=>'ARKANSAS',
@1stvamp
1stvamp / mac-curl-ca-bundle.sh
Created March 22, 2012 12:50
Script to install cURL CA certificates on OS X without macports
#!/bin/bash
mkdir /tmp/curl-ca-bundle
cd /tmp/curl-ca-bundle
wget http://curl.haxx.se/download/curl-7.22.0.tar.bz2
tar xzf curl-7.22.0.tar.bz2
cd curl-7.22.0/lib/
./mk-ca-bundle.pl
if [ ! -d /usr/share/curl/ ]; then
sudo mkdir -p /usr/share/curl/
else