Skip to content

Instantly share code, notes, and snippets.

package MooseX::Types::DuckType::Catalyst;
use MooseX::Types -declare => [qw/
Request
Response
/];
use Try::Tiny qw/ try /;
use Moose::Util::TypeConstraints;
use MooseX::Types::Moose ':all';
use namespace::clean -except => [qw/ import unimport /];
#include <Ethernet.h>
//#include <stomp.h>
// network configuration. gateway and subnet are optional.
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 172, 31, 24, 233 };
byte gateway[] = { 172, 31, 24, 1 };
byte subnet[] = { 255, 255, 255, 0 };
int ledPin = 7; // LED connected to digital pin 7
int state = 0;
[%
MACRO my_fmoney(amount,currency)
BLOCK;
IF currency == 'GBP';
fprefix = "&pound;";
ELSIF currency == 'USD';
fprefix = "\$";
ELSIF currency == 'EUR';
fprefix = "&#8364;";
ELSE;
DROP TABLE IF EXISTS dictionary;
CREATE TABLE dictionary (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(50) UNIQUE NOT NULL
) ENGINE=InnoDB;
DROP TABLE IF EXISTS dictionary_batch;
CREATE TABLE dictionary_batch (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
dictionary_id INT UNSIGNED NOT NULL REFERENCES dictionary(id),
- Test 1 or 2 more apps
- write tests for getting default_model / default_view from config?
- move block from sub controller to Catalyst::Utils
- kill components class data
- kill initialization in sub setup
- kill duplication: http://paste.scsys.co.uk/123648
- create a sub components that returns all components
- merge with around components => sub {}
- locked hash (Hash::Util)
- block inside sub setup:
#!/usr/bin/perl
use strict;
use warnings;
use Test::More;
my $foo = chr(0xff);
is(length($foo), 1, "character length of string is 1");
ok(!utf8::is_utf8($foo), "string not utf-8 upgraded");
package Shutterstock::Example::Nonblock;
use Web::Simple;
use Plack::App::File;
use File::ShareDir::ProjectDistDir;
use File::Spec::Functions;
use Imager::Simple;
sub share { our $share ||= dist_dir 'Shutterstock-Example-Nonblock' }
This file documents the revision history for Perl extension TestFlood.
0.01 2012-04-13 08:45:03
- initial revision, generated by Catalyst
@bobtfish
bobtfish / code.js
Created April 19, 2012 14:31
BSON packing javascript
function compress_simple(s) {
var i=0, l, out='';
if (s.length % 2 !== 0) s += ' ';
for (l = s.length; i < l; i+=2) {
out += String.fromCharCode((s.charCodeAt(i)*256) + s.charCodeAt(i+1));
}
return out;
}
function uncompress_simple(s) {
@bobtfish
bobtfish / FixFCGIPath.pm
Created April 20, 2012 15:08
Fix Plack::Handler::FCGI issues with nginx PATH_INFO
package Plack::Middleware::FixFCGIPath;
use strict;
use warnings;
use base qw/ Plack::Middleware /;
sub call {
my ($self, $env) = @_;
if (length($env->{PATH_INFO})) {
$env->{PATH_INFO} = '/' . $env->{PATH_INFO}