Skip to content

Instantly share code, notes, and snippets.

View plusplus's full-sized avatar
🚲

Julian Russell plusplus

🚲
  • Hobart, Tasmania, Australia
View GitHub Profile
require 'date'
#
# My infinite monkeys just wrote the complete works of Shakespeare. Just can't find it
# amongst these infinite monkeys.
#
# That's right MONKEY PATCHING.....
#
class Date
@plusplus
plusplus / mongo-chef.rb
Created July 21, 2011 00:45 — forked from veryhappythings/mongo-chef.rb
A chef recipe for installing mongoDB from apt-get on ubuntu.
execute 'apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10' do
user 'root'
end
ubuntu_version = node[:platform_version]
ubuntu_version.gsub! '.0', '.'
execute "echo 'deb http://downloads.mongodb.org/distros/ubuntu #{ubuntu_version} 10gen' >> /etc/apt/sources.list" do
user 'root'
not_if 'grep mongodb /etc/apt/sources.list'
end
@plusplus
plusplus / mongo-chef.rb
Created July 21, 2011 00:45 — forked from veryhappythings/mongo-chef.rb
A chef recipe for installing mongoDB from apt-get on ubuntu.
execute 'apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10' do
user 'root'
end
ubuntu_version = node[:platform_version]
ubuntu_version.gsub! '.0', '.'
execute "echo 'deb http://downloads.mongodb.org/distros/ubuntu #{ubuntu_version} 10gen' >> /etc/apt/sources.list" do
user 'root'
not_if 'grep mongodb /etc/apt/sources.list'
end
@plusplus
plusplus / warnings.xml
Created September 30, 2011 05:10
Warning test file for RFS
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:georss="http://www.georss.org/georss" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>NSW Rural Fire Service Current Incidents</title>
<description>Fire Incidents as at Monday, 19 September 2011</description>
<link>http://www.rfs.nsw.gov.au/dsp_content.cfm?cat_id=683</link>
<language>en-AU</language>
<webMaster>webmaster@rfs.nsw.gov.au (RFS Webmaster)</webMaster>
<docs>http://www.rssboard.org/rss-specification</docs>
<atom:link href="http://www.rfs.nsw.gov.au/feeds/majorIncidents.xml" rel="self" type="application/rss+xml" />
<?xml version="1.0" encoding="UTF-8"?>
<FireDangerMap>
<District>
<Name>Far North Coast</Name>
<RegionNumber>1</RegionNumber>
<Councils>Ballina; Byron; Clarence Valley; Kyogle; Lismore; Richmond Valley; Tweed</Councils>
<DangerLevelToday>Low-Moderate</DangerLevelToday>
<DangerLevelTomorrow>None</DangerLevelTomorrow>
<FireBanToday>No</FireBanToday>
<FireBanTomorrow>No</FireBanTomorrow>
@plusplus
plusplus / install.sh
Created May 31, 2012 10:10
Install Nginx Ubuntu 10.4
set -u -e
echo
echo
echo
echo "--------------------------------------------------------------------------"
echo
echo "NOW: Installing nginx"
echo
echo "--------------------------------------------------------------------------"
@plusplus
plusplus / Gemfile
Created July 1, 2012 05:41
Very Slow MM time handling
source :rubygems
MONGO_VERSION = '~>1.6'
gem 'bson', MONGO_VERSION
gem 'bson_ext', MONGO_VERSION
gem 'mongo', MONGO_VERSION
gem 'mongo_mapper', "0.11.1"
@plusplus
plusplus / date_mongo_type.rb
Created May 23, 2013 01:01
Convert date to string in MM
class Date
def self.from_mongo( v )
return nil if v.nil?
Date.iso8601( v.to_s )
end
def to_mongo
to_s
end
end
@plusplus
plusplus / gist:5790169
Last active December 18, 2015 13:29
JaquardCoefficient
class JaquardCoefficient
def similarity( x, y )
raise ArgumentError, "Both sets are empty" if x.empty? && y.empty?
return 0.0 if x.empty? || y.empty?
(x & y).size.to_f / (x | y).size.to_f
end
end
@plusplus
plusplus / README.md
Last active December 19, 2015 20:59
ActiveMerchant NAB Transact scratching

Some notes:

  • This is very much a skeleton that goes JUST as far as we needed it to.
  • It's using the redirect method for the return url, rather than the proxying style. I need to think a little more about whether the POST and proxy our redirect to the client is better/worse.
  • This may not be a super correct AM integration, like I said, JUST as far as we needed to go :)