Skip to content

Instantly share code, notes, and snippets.

View gardejo's full-sized avatar

MORIYA Masaki gardejo

View GitHub Profile
@gardejo
gardejo / benchmark_plugin_authentication_store_datamodel.pl
Created July 14, 2009 11:47
Quest for efficient usage of Data::Model
#!/usr/local/bin/perl
# Quest for efficient usage of Data::Model - get by iterator vs. by list (vs. lookup)
use strict;
use warnings;
use Benchmark qw(cmpthese timethese);
use File::Temp;
my $db = "testdatabase_datamodel";
@gardejo
gardejo / DefinitionList.pm
Created July 16, 2009 16:31
HTML::Shakan::Renderer::HTML::DefinitionList
package HTML::Shakan::Renderer::HTML::DefinitionList;
use Any::Moose;
# use HTML::Shakan::Utils;
extends qw(
HTML::Shakan::Renderer::HTML
);
with qw(
HTML::Shakan::Renderer::HTML::SelectivelyEncodable
@gardejo
gardejo / DateTimeSeparatable.pm
Created July 16, 2009 16:33
HTML::Shakan::Renderer::HTML::DateTimeSeparatable
package HTML::Shakan::Renderer::HTML::DateTimeSeparatable;
use Any::Moose '::Role';
sub separate_datetime {
my ($self, $html) = @_;
$html =~ s{
(</select>)([\n\s]*<select \s name="[^"]+_(?:month|day)">)
}{$1/$2}xmsg;
$html =~ s{
@gardejo
gardejo / SelectivelyEncodable.pm
Created July 16, 2009 16:32
HTML::Shakan::Renderer::HTML::SelectivelyEncodable
package HTML::Shakan::Renderer::HTML::SelectivelyEncodable;
use HTML::Shakan::Utils;
use Any::Moose '::Role';
sub selectively_encode {
my ($self, $label) = @_;
my $label_for_render = $label;
my $prefix = q{};
@gardejo
gardejo / which_is_fast_to_replace_or_split.pl
Created July 29, 2009 16:42
Which is fast to replace or split?
#!/usr/bin/env perl
# Which is fast to replace or split?
use strict;
use warnings;
use Benchmark qw(cmpthese timethese);
use DateTime::TimeZone;
use Scalar::Util;
@gardejo
gardejo / era_role.pl
Created October 15, 2009 16:29
sample code snippet to explain circular dependeded attributes
#!/usr/local/bin/perl
# sample code snippet to explain circular dependeded attributes (with role)
# see http://blog.eorzea.asia/2009/10/post_72.html
use strict;
use warnings;
use utf8;
{
package MyApp::HasChristianEra;
@gardejo
gardejo / addressee.pl
Created October 15, 2009 16:26
sample code snippet to explain plurally dependeded attributes
#!/usr/local/bin/perl
# sample code snippet to explain plurally dependeded attributes
# see http://blog.eorzea.asia/2009/10/post_72.html
use strict;
use warnings;
use utf8;
{
package MyApp::Addressee;
@gardejo
gardejo / README
Created October 15, 2009 16:54
BAD sample code snippet to explain circular dependeded attributes (without clearer)
This is a BAD sample.
Use clearer method instead of rebuild mechanism!
See http://blog.eorzea.asia/2009/10/post_72.html for more details.
@gardejo
gardejo / password.pl
Created October 15, 2009 16:24
sample code snippet to explain one-way dependeded attributes
#!/usr/local/bin/perl
# sample code snippet to explain one-way dependeded attributes
# see http://blog.eorzea.asia/2009/10/post_72.html
use strict;
use warnings;
use utf8;
{
package MyApp::Authentication;
@gardejo
gardejo / README
Created October 23, 2009 16:14
Getting started with DBIx::Class::Schema::Loader
Getting started with DBIx::Class::Schema::Loader