Skip to content

Instantly share code, notes, and snippets.

@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 / .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 / .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 / 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 / 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 / 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 / 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>