Skip to content

Instantly share code, notes, and snippets.

View jamesstout's full-sized avatar

James Stout jamesstout

View GitHub Profile
@jamesstout
jamesstout / lastfm-tabs-nofollow.diff
Created May 18, 2013 14:45
Patch to Last.fm-Tabs to add the option to add rel="nofollow"' to links [http://wordpress.org/extend/plugins/lastfm-tabs/]
Index: lastfm_options.php
===================================================================
--- lastfm_options.php (revision 714873)
+++ lastfm_options.php (working copy)
@@ -346,6 +346,15 @@
'type' => 'checkbox',
'section' => 'general'
);
+
+ $this->settings['nofollow'] = array(
@jamesstout
jamesstout / availableLocaleIdentifiers.mm
Last active December 17, 2015 18:59
List Lithuanian locales in OS X
NSArray *test = [NSLocale availableLocaleIdentifiers];
for (int i = 0; i < [test count]; i++) {
NSLocale *tmpLocale = [[[NSLocale alloc] initWithLocaleIdentifier:[test objectAtIndex:i]] autorelease];
NSString *localeIdentifier = [tmpLocale objectForKey: NSLocaleIdentifier];
NSString *localeIdentifierDisplayName = [tmpLocale displayNameForKey:NSLocaleIdentifier value:localeIdentifier];
@jamesstout
jamesstout / CocoaStandard.sdef.xml
Created May 28, 2013 07:28
CocoaStandard.sdef (not.xml - just for syntax highlighting) - Cocoa Standard Suite - Common classes and commands for all applications.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dictionary SYSTEM "file://localhost/System/Library/DTDs/sdef.dtd">
<dictionary title="Standard Terminology">
<suite name="Standard Suite" code="????" description="Common classes and commands for all applications.">
<command name="open" code="aevtodoc" description="Open a document.">
<direct-parameter description="The file(s) to be opened.">
<type type="file"/>
@jamesstout
jamesstout / HKOHistW.php
Last active February 20, 2016 13:50
Scripts to parse data from the HKO Warnings and Signals Database for all Rainstorm Warnings from 1998 - present
<?php
include dirname(__FILE__) . '/KLogger.php';
header('Content-type: text/html');
outputHeader();
$logDir = dirname(__FILE__) . '/logs';
$file = $logDir . '/HKOLog.txt';
@jamesstout
jamesstout / HKOHist.php
Last active December 19, 2015 02:19
Get historical HKO warning and signals data
<?php
include dirname(__FILE__) . '/KLogger.php';
$logDir = dirname(__FILE__) . '/logs';
$file = $logDir . '/HKOLog.txt';
$log = KLogger::instance($logDir, KLogger::DEBUG, false);
include dirname(__FILE__) . '/tz.php';
@jamesstout
jamesstout / uniqRename.sh
Last active April 9, 2021 18:48
rename files to a random filename with 5 digits that contain random numbers and letters
#!/usr/bin/env bash
# IRC Issue from helperW
# Network: freenode
# Channel: #macosx
# I have a directory with 001.png 023.png 003.png ( around 800 files)
# I have to rename them to a random filename with : 5 digits that contain random numbers and letters
# ensure all vars are initialised and exit on error
@jamesstout
jamesstout / BTPicks.php
Created July 9, 2013 20:22
Scans http://brettterpstra.com/otherstuff/systematic-linkage/ and attempts to output the "Top Picks" in markdown format producing HTML like this: http://cloud.zoooot.com/Q8Wr
<?php
$curl_error_str = "";
$curl_error_no = 0;
$httpCode = 0;
$curl_info = "";
$page="";
$html="";
@jamesstout
jamesstout / gist:5990309
Created July 13, 2013 10:47
AppleScript to close all Finder Get Info windows
tell application "Finder"
set theWindowList to windows (* get all Finder windows *)
repeat with i from 1 to number of items in theWindowList (* loop through them *)
set this_item to item i of theWindowList (* get a window from the *)
set windowName to name of this_item (* get the window's name*)
if windowName ends with " Info" then (* see if the window name ends in " Info" - NOTE the space *)
close this_item (* ENHANCEMENT: Would also close a Finder window that had a folder open that ended in " Info" *)
end if
@jamesstout
jamesstout / gist:5990388
Last active December 19, 2015 17:19
Improved AppleScript to close all Finder Get Info windows
tell application "Finder"
set theWindowList to windows (* get all Finder windows *)
repeat with i from 1 to number of items in theWindowList (* loop through them *)
set shouldClose to false (* reset to false *)
set this_item to item i of theWindowList (* get a window from the list *)
set windowName to name of this_item (* get the window'ss name *)
(* this list should contain class property that tells you the type of window - which is nice *)
(* Class would be either "Finder window" for normal windows or "information window" for the Info windows *)
@jamesstout
jamesstout / make_deps.sh
Created July 18, 2013 02:01
Get build dependencies for ImageAlpha
#!/usr/bin/env bash
#set -o nounset
source ./utils.sh
ZLIB_VERSION=1.2.8
ZLIB_URL=http://prdownloads.sourceforge.net/libpng/zlib-$ZLIB_VERSION.tar.gz?download
ZLIB_DIR=zlib