Skip to content

Instantly share code, notes, and snippets.

View grantcodes's full-sized avatar

Grant Richmond grantcodes

View GitHub Profile
@grantcodes
grantcodes / wakeupalarm.xml
Created September 16, 2015 17:02
A tasker profile to find a playlist and rise the volume on a random song
<TaskerData sr="" dvi="1" tv="4.7u3m">
<Task sr="task7">
<cdate>1442417787447</cdate>
<edate>1442422772371</edate>
<id>7</id>
<nme>Wakeup Alarm</nme>
<pri>100</pri>
<Action sr="act0" ve="7">
<code>547</code>
<Str sr="arg0" ve="3">%playlist_length</Str>
@grantcodes
grantcodes / updated-get-vendor-admins-function.php
Created September 21, 2015 16:17
An updated function for the WooCommerce product vendors plugin
/**
* Get admins for vendor
* @param int $vendor_id ID of vendor
* @return arr Array of user objects
*/
function get_vendor_admins( $vendor_id = 0 ) {
global $wc_product_vendors;
$admins = array();
if( $vendor_id > 0 ) {
$vendor_info = get_option( $wc_product_vendors->token . '_' . $vendor_id );
@grantcodes
grantcodes / Brewfile
Created November 3, 2015 14:23
My Brew Setup
tap 'caskroom/cask'
tap 'homebrew/bundle'
tap 'homebrew/versions'
tap 'mopidy/mopidy'
tap 'neovim/neovim'
brew 'calc'
brew 'fish'
brew 'node'
brew 'keybase'
brew 'midnight-commander'
@grantcodes
grantcodes / dundeemakerspace-linux-setup.sh
Last active November 10, 2015 00:04
The setup script for Dundee MakerSpace standard Lubuntu install
#! /bin/bash
# Add PPAs {
#
# chrome
#
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
@grantcodes
grantcodes / .cVimrc
Last active November 25, 2015 15:37
My .cVimrc file
let defaultengine = "duckduckgo"
let blacklists = ["http://agar.io/*", "http://feedly.com/*", "https://feedly.com/*", "https://inbox.google.com/*", "https://gmail.com/*"]

Keybase proof

I hereby claim:

  • I am terminalpixel on github.
  • I am terminalpixel (https://keybase.io/terminalpixel) on keybase.
  • I have a public key ASBtunpo3akFcxP9-UMdCX8fs5pkoJpbToQQMpSh5xFQ3Ao

To claim this, I am signing this object:

@grantcodes
grantcodes / rel-scraper.js
Last active October 30, 2017 23:02
Simple function to get all rel links from a html string
export default function (htmlString, url) {
let rels = {};
let baseUrl = url;
const doc = new DOMParser().parseFromString(htmlString, 'text/html');
const baseEl = doc.querySelector('base[href]');
const relEls = doc.querySelectorAll('[rel][href]');
if (baseEl) {
const value = baseEl.getAttribute('href');
@grantcodes
grantcodes / token-endpoint.js
Created August 21, 2018 17:36
A kind of basic token endpoint as an express router (won't actually work for you without some tweaks)
const express = require('express');
const cors = require('cors');
const bodyParser = require('body-parser');
const request = require('request');
const jwt = require('jsonwebtoken');
const qs = require('querystring');
const config = require('../config');
const router = express.Router({
caseSensitive: true,

Contract Killer 3

Revised date: 07/11/2012

Between us [company name] and you [customer name]

Summary:

I'll always do my best to fulfil your needs and meet your expectations, but it’s important to have things written down so that we both know what’s what, who should do what and when, and what will happen if something goes wrong. In this contract you won’t find any complicated legal terms or long passages of unreadable text. I’ve no desire to trick you into signing something that you might later regret. What I do want is what’s best for both parties, now and in the future.

@grantcodes
grantcodes / indieweb-blocks.js
Created October 16, 2019 23:22
A very quick demo of potential IndieWeb support for gutenberg blocks
// Basic in-reply-to block mvp
/**
* BLOCK: indieweb-blocks
*
* Registering a basic block with Gutenberg.
* Simple block, renders and saves the same content without any interactivity.
*/
// Import CSS.