Skip to content

Instantly share code, notes, and snippets.

View benvanstaveren's full-sized avatar

Ben van Staveren benvanstaveren

View GitHub Profile
@ID]
shotgun99
i gotta a maus woooooohq
tomas907
docela ferq
[>8$%
?\%2
[>8$%
?[%2
?T%2
?V%2
?S%2
?R%2
[
{
"honorTitles" : [
201326594,
201326597,
201326601,
234881026,
234881029,
234881024,
218103808,
{
"vehicles" : {
"18170200" : {
"isAlive" : true,
"vehicleType" : "germany:PzVI_Tiger_P",
"events" : {},
"name" : "WolfhundA1",
"isTeamKiller" : false,
"clanAbbrev" : "",
"team" : 1
@benvanstaveren
benvanstaveren / LL.pm
Created April 16, 2012 22:11
World of Tanks low-level replay file parser
package WR::Parser::LL;
use strict;
use Moose;
use namespace::autoclean;
use IO::String;
=pod
=head1 ABSTRACT
@benvanstaveren
benvanstaveren / gist:1557363
Created January 3, 2012 22:43
JSPL::PerlClass usage example
#!/usr/bin/perl
use strict;
use warnings;
package Foobar;
use Moose;
use JSPL;
use Try::Tiny qw/catch try/;
has 'foo' => (is => 'rw', isa => 'Num', required => 1, reader => 'get_foo', writer => 'set_foo');
function dumpAttributes(aMooseClass) {
aMooseClass.meta().get_all_attributes().forEach(function(attr) {
say("aMooseClass has attribute: ", attr.name());
});
}
var myClass = new MooseClassFactory()
.name('MyMooseClass')
.with(['SomeRandomRole', 'SomeOtherRole' ])
.extends('MyOtherMooseClass')
.has('foo', { is: 'ro', isa: 'Str', required: true })
.has('bar', { is: 'rw', isa: 'Str', required: true, defaultValue: function() { return "foo " + " bar" } })
.method('fweep', function() {
say("fweeping up a storm!");
})
.makeImmutable;
use Moose::Util::TypeConstraints;
use Moose::Util ();
my $TYPE_REGISTRY = Moose::Util::TypeConstraints->get_type_constraint_registry;
$TYPE_REGISTRY->add_type_constraint(
Moose::Meta::TypeConstraint::Parameterizable->new(
name => 'DBref',
package_defined_in => __PACKAGE__,
parent => Moose::Util::TypeConstraints::find_type_constraint('Item'),
has 'foo' => (is => 'rw', isa => 'DBref[Object::Foo]')