Skip to content

Instantly share code, notes, and snippets.

View roryf's full-sized avatar

Rory Fitzpatrick roryf

  • Edinburgh, Scotland
View GitHub Profile
import org.json.*;
import java.net.*;
import java.util.Iterator;
PImage bg;
JSONObject data;
double west = -3.414001;
double east = -3.017120;
@roryf
roryf / wireframe.mrules
Created September 9, 2011 12:50
Maperitive rules for creating white-on-black maps of primary roads
// Wireframe rules
// Created by Igor Brejc
// Edited by Rory Fitzpatrick
// Released under the Creative Commons Attribution-ShareAlike 3.0 License (http://creativecommons.org/licenses/by-sa/3.0/)
features
lines
line : highway=primary OR highway=tertiary OR highway=motorway OR highway=trunk OR highway=secondary
coastline : natural=coastline
@roryf
roryf / movie.pde
Created September 9, 2011 12:39
Processing code I used to generate http://vimeo.com/28706322
import org.json.*;
import java.net.*;
import java.util.Iterator;
import processing.video.*;
PImage bg;
MovieMaker mm;
JSONObject data;
double west = -3.414001;
@roryf
roryf / Flash.cs
Created July 27, 2011 15:19
Flash message implementation for ASP.NET MVC
public class Flash : DynamicObject
{
private readonly TempDataDictionary _store;
private const string KeyPrefix = "Flash";
public Flash(TempDataDictionary store)
{
_store = store;
}
@roryf
roryf / rewrite
Created July 15, 2011 12:55
Zeus rewrite rule from .html to .php
match URL into $ with ^(.*)\.html$
if matched then
set URL = $1.php
endif
@roryf
roryf / ie8.txt
Created July 14, 2011 09:22
An IE8 user agent string, as seen in the wild
Mozilla/4.0+(compatible;+MSIE+8.0;+Windows+NT+5.1;+Trident/4.0;+FunWebProducts;+.NET+CLR+2.0.50727;+eSobiSubscriber+2.0.4.16;+.NET+CLR+3.0.4506.2152;+.NET+CLR+3.5.30729;+OfficeLiveConnector.1.3;+OfficeLivePatch.0.0)
@roryf
roryf / DeliminatorSeparatedPropertyNamesContractResolver.cs
Created June 23, 2011 13:09
Snake case (underscore separated) property name resolver for Newtonsoft.Json library
public class DeliminatorSeparatedPropertyNamesContractResolver : DefaultContractResolver
{
private readonly string _separator;
protected DeliminatorSeparatedPropertyNamesContractResolver(char separator) : base(true)
{
_separator = separator.ToString();
}
protected override string ResolvePropertyName(string propertyName)
# clones foo.notes into bar.notes
foo.notes.each do |note|
new_note = bar.notes.build(note.attributes)
new_note.save
end