Skip to content

Instantly share code, notes, and snippets.

View leighmcculloch's full-sized avatar
🌴
Unavailable

Leigh leighmcculloch

🌴
Unavailable
View GitHub Profile
@leighmcculloch
leighmcculloch / NSData+HexString.h
Last active December 29, 2015 05:39
A category for NSData that returns a hex string of the data within. Output is like: af459a2f
//
// NSData+HexString.h
//
// Copyright (c) 2013, Leigh McCulloch. All rights reserved.
// BSD-2-Clause License: http://opensource.org/licenses/BSD-2-Clause
//
#import <Foundation/Foundation.h>
@interface NSData (HexString)
@leighmcculloch
leighmcculloch / Google Analytics.js Outbound Link Tracking.js
Last active September 15, 2020 12:52
This JavaScript will catch any outbound links and register them with Google Analytics before the browser loads the linked URL. This script works with Google's new analytics.js and not the older ga.js. This script ensures the attempt to register the page with Google Analytics is complete before continuing to load the next page. This capability is…
# Author: Leigh McCulloch
# License: BSL-1.0 (http://www.opensource.org/licenses/BSL-1.0)
#
# This script takes arguments from the command line and autotypes
# them with tab separators into the last selected application.
# This can be used from one application to auto-type into another
# application.
#
# Command line usage:
# osascript autotype.spct [username] [password]
@leighmcculloch
leighmcculloch / NSString_stripHtml.h
Last active February 21, 2018 22:45
NSString + Strip HTML
// NSString_stripHtml.h
// Copyright 2011 Leigh McCulloch. Released under the MIT license.
#import <Foundation/Foundation.h>
@interface NSString (stripHtml)
- (NSString*)stripHtml;
@end
@leighmcculloch
leighmcculloch / file_recursive.php
Last active September 27, 2015 03:08
PHP Recursive File/Directory Functions
function recursive_delete($dir) {
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::CHILD_FIRST);
foreach ($iterator as $file) {
$path = $file->__toString();
if($file->isDir()) {
rmdir($path);
} else {
unlink($path);
}
}