Skip to content

Instantly share code, notes, and snippets.

@iamamused
iamamused / MailToOPML.php
Created February 21, 2012 03:02
Export Mail.app RSS feeds to an OPML file suitable for Google Reader
<?php
$username = 'jsambells';
$opml = '<?xml version="1.0" encoding="ISO-8859-1"?>
<opml version="1.0">
<head>
<dateCreated>'.date('d-M-Y').'</dateCreated>
</head>
<body>
@iamamused
iamamused / Readme.md
Created February 21, 2012 03:10
Set Ant build properties from JSON

Example:

Jeffreys-MacBook-Air$ ant example
Buildfile: /Users/jsambells/Documents/example/build.xml
    [echo] Parsing properties
    [echo] greeting=Hello
    [echo] audience=world
example:

[echo] Hello world

@iamamused
iamamused / LoadImage.h
Created March 2, 2012 03:23
Create iOS image resources from a PDF on the fly.
//
// LoadImage.h
// AssetsFromPDF
//
// Created by Jeffrey Sambells on 2012-03-02.
//
#import <Foundation/Foundation.h>
@interface LoadImage : NSObject
@iamamused
iamamused / plist2json.php
Created July 24, 2012 15:47
PList to JSON Converter
<?php
function plist2json($child) {
switch($child->nodeName) {
case 'dict':
$d = new StdClass();
$nodes = $child->childNodes;
for($i = 0; $i < $nodes->length; $i++){
if ($nodes->item($i)->nodeName == 'key'){
$key = $nodes->item($i)->textContent;
@iamamused
iamamused / .bashrc
Last active December 11, 2015 07:48
Home Files
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
#; This will check the Operating System type so we can case on it later
UNAME="`uname -s`"
export UNAME
@iamamused
iamamused / .vimrc
Created January 18, 2013 21:19
VIM config
set expandtab
set shiftwidth=4
set softtabstop=4
set tabstop=4
set autoindent
set backspace=2
set nocompatible
set noerrorbells
set esckeys
@iamamused
iamamused / publisher.rb
Last active January 6, 2017 13:32
Post publishing plugin for Jekyll
module Jekyll
class PostPublisher < Generator
safe false
def replace(filepath, regexp, *args, &block)
content = File.read(filepath).gsub(regexp, *args, &block)
File.open(filepath, 'wb') { |file| file.write(content) }
end
def generate(site)
@iamamused
iamamused / zoho.js
Created February 21, 2013 15:42
[Quickscript](http://canisbos.com/quickscript) scripts
// urls:https://projects.zoho.com/*
// Inject so we're running in the document context
function inject(newScript) {
var oScript = document.createElement("script");
oScript.language = "javascript";
oScript.type = "text/javascript";
oScript.text = newScript;
document.getElementsByTagName('BODY').item(0).appendChild(oScript);
}
@iamamused
iamamused / AppDelegate.m
Created April 13, 2016 13:55
CocoaLumberjack with colours and line numbers, common config
#import "AppDelegate.h"
// install XcodeColors plugin https://github.com/robbiehanson/XcodeColors
// install KZLinkedConsole plugin https://github.com/krzysztofzablocki/KZLinkedConsole
// Include cocoalumberjack in your pods
// pod 'CocoaLumberjack', '~> 1'
// NOTE this will work for version 2 as well, just need to tweak it.
#import <CocoaLumberjack/DDASLLogger.h>
#import <CocoaLumberjack/DDTTYLogger.h>
@iamamused
iamamused / build.gradle
Created May 10, 2016 16:29 — forked from tprochazka/build.gradle
Smart versionName and versionCode for android Gradle build evaluation
/**
* Will return version from properties file and replace -SNAPSHOT by GIT commit hash
* to recognize origin commit for the every build.
*/
project.ext.evalVersionName = {
def ideBuild = project.properties['android.injected.invoked.from.ide']
if (ideBuild) {
logger.info("IDE build");
return "dev"
} else if (project.VERSION.toUpperCase().contains("SNAPSHOT")) {