Skip to content

Instantly share code, notes, and snippets.

@pdcawley
pdcawley / Sugar.pm
Created March 11, 2009 10:58
Very rough beginnings of sugar for Test::Class. Currently so rough as to break
# Devel::Declare::Sugar
package Test::Class::Sugar;
use Modern::Perl;
use Devel::Declare ();
use Devel::Declare::Context::Simple;
use Carp qw/croak/;
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot.rb'
require File.dirname(__FILE__) + '/../config/environment.rb'
require 'mq'
AMQP.start(:host => 'localhost',
:insist => true,
:logging => true) do
#!/usr/bin/perl
use feature ':5.10';
use MooseX::Declare;
class Foo {
method _test { 1 }
method bar ( $f where { _test(')}') } ) {
$f
@pdcawley
pdcawley / gist:327549
Created March 10, 2010 05:19
An example of a more complicated Moose attribute declaration
use MP::MS5::Types qw[ClientType];
has _client_types => (
is => 'rw',
default => sub { [] },
coerce => 1,
isa => ClientTypes,
traits => [qw(Array)],
handles => {
register => 'push',
PassengerEnabled On
PassengerAppRoot /home/pdcawley/typo
RewriteEngine On
RewriteRule ^/$ /cache/index.html [QSA]
RewriteCond %{DOCUMENT_ROOT}/cache/%{REQUEST_FILENAME} -f
RewriteRule ^/(.*)$ /cache/$1 [PT]
RewriteCond %{DOCUMENT_ROOT}/cache/%{REQUEST_FILENAME}.html -f
RewriteRule ^/(.*)$ /cache/$1.html [PT]
#RewriteCond %{REQUEST_FILENAME} !-f
@pdcawley
pdcawley / gist:1338739
Created November 4, 2011 05:45
AMD in coffeescript
`})();define(['require','exports','module'], function (require, exports, module) {`
# AMD compliant code goes here
@pdcawley
pdcawley / README.md
Created February 22, 2012 19:59
A failing test using XML::Compile::Schema version >= 1.19 with the Vmware cloud API schema

Run the tests, watch things fail.

elsif (!$txn){
# No records found, maybe it the vehicle was exchanged, so check if there
# is an exchange record relating to a *CLOSED* RA on record. Again, we
# can't rely on the data for the currently OPEN records.
my $exchanges = $exchange_rs->search({
date => { '>=' => $transaction_date->ymd },
prev_date_out => { '<=' => $transaction_date->ymd },
vehicle_in => $vehicle->vehicle_no,
});
my $clean_transaction_time = $transaction_time;