Skip to content

Instantly share code, notes, and snippets.

View dougwollison's full-sized avatar

Doug Wollison dougwollison

View GitHub Profile
@dougwollison
dougwollison / googlemaps_url.txt
Created April 16, 2015 14:42
Google Maps Direction URL
https://google.com/maps/?saddr=ORIGIN&daddr=DESTINATION&dirflag=METHOD
# Method = (d)riving | t(r)ansit | (w)alking | (b)icycling
@dougwollison
dougwollison / jquery.removeStyle.js
Created April 8, 2015 21:41
jQuery plugin to remove inline css
jQuery.fn.removeStyle = function( property ) {
// Remove all styles if no property is specified
if ( property === null ) {
return this.removeAttr( 'style' );
}
// Split the property list
var proporties = property.split( /\s+/ );
// Loop through each property and remove them
@dougwollison
dougwollison / kick
Created March 19, 2015 18:14
Kick user from server (kills all SSH sessions for them)
#!/bin/bash
# Make sure at least the first parameter is set
if [ -z "$1" ]; then
echo "Usage: kick [-d] user"
exit
fi
# Check if the -d flag (delete) is set
if [[ "$1" == '-d' ]]; then
@dougwollison
dougwollison / getotp
Created March 19, 2015 18:11
OTP Generator Python Script
#!/usr/bin/env python
import sys
import base64
import time
import struct
import hashlib
import hmac
# Abort with error if not used properly
@dougwollison
dougwollison / jquery.removeClass.regexp.js
Last active May 12, 2017 18:03
Upgraded jQuery.removeClass, handles Regular Expression
( function( $ ) {
// Store the original method for all other uses
var oldRemoveClass = $.fn.removeClass;
// Replace existing method iwth new version
$.fn.removeClass = function( className ) {
if ( className instanceof RegExp ) {
// Run a regex replace on each element's class name list
return $( this ).each( function() {
var classes = $( this ).attr( 'class' ) || '';