Skip to content

Instantly share code, notes, and snippets.

View MxAshUp's full-sized avatar

Ash Woods MxAshUp

  • Portland, OR
View GitHub Profile
@MxAshUp
MxAshUp / gist:0b70e0a970b9fdc4c881
Created October 14, 2014 21:38
Track Google Analytics Events in either Classic or Universal Analytics
//This function tracks a google analytics event regaurdless if using UA or classic trackin code
/**
* Tracks a GA event using either Classic or Universal Analytics.
* @param {[String or Object]} categoryorobject [Either Event Category, or an object containing all parameters]
* @param {[String]} action [The Event Action]
* @param {[String]} label [The Event Lable]
* @param {[String]} value [The Event Value]
*/
function trackEvent(categoryorobject, action, label, value) {
if(typeof(ga) == "function") {
<?php
if(is_archive()) {
function rel_next_prev(){
global $paged;
if ( get_previous_posts_link() ) { ?>
<link rel="prev" href="<?php echo get_pagenum_link( $paged - 1 ); ?>" /><?php
}
if ( get_next_posts_link() ) { ?>

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post

@MxAshUp
MxAshUp / pihut_pi_zero_in_stock.js
Last active February 24, 2016 17:35
Checks Pi Hut Pi Zero Inventory
//Requires node-notifier for desktop notification
path = "products/raspberry-pi-zero.js"
request = require('request-json');
var client = request.createClient("http://thepihut.com/");
function check_availability() {
client.get(path, function(err, res, body) {
@MxAshUp
MxAshUp / pihut_pi_zero_in_stock.js
Created February 27, 2016 05:58
Checks for Pi Zero availability on Adafruit, Pimoroni, and Pi Hut, sends alerts to Pushbullet
var requestjson = require('request-json');
var request = require('request');
var PushBullet = require('pushbullet');
var pusher = new PushBullet('PUSHBULLET_API_KEY');
var cheerio = require('cheerio');
var stores = [
{name:"The Pi Hut",url:'http://thepihut.com/products/raspberry-pi-zero',in_stock:check_pihut_inventory
},
{name:"Adafruit",url:'https://www.adafruit.com/products/2816',in_stock:check_adafruit_inventory
<?php
class WP_REST_Posts_Controller_StringTerms extends WP_REST_Posts_Controller {
/**
* Retrieves the post's schema, conforming to JSON Schema.
*
* @return array Item schema data.
*/
public function get_item_schema() {