Skip to content

Instantly share code, notes, and snippets.

View lestrrat's full-sized avatar

lestrrat lestrrat

View GitHub Profile
months = [ 31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ]
def is_leap_year(year):
if (year % 4):
return 0
elif (year % 100):
return 1
elif (year % 400):
return 0
else:
BEGIN {
unshift @INC, sub {
die if $_[1] eq 'XML/LibXML.pm';
return undef;
}
}
use XML::LibXML;
--- a/lib/Werewolf/BBS/Controller/Chatter.pm
+++ b/lib/Werewolf/BBS/Controller/Chatter.pm
@@ -177,8 +177,17 @@ sub view
my $village = $c->stash->{village};
my $chatter_api = $self->api('Chatter');
- my $chat = $chatter_api->find( $chat_id );
- if (! $chat || $chat->village_id ne $village->id) {
+
+ my $chat;
--- a/lib/Plack/Test.pm
+++ b/lib/Plack/Test.pm
@@ -116,7 +116,7 @@ my @TEST = (
},
diff --git a/lib/Plack/Test.pm b/lib/Plack/Test.pm
index fa9637d..40c4174 100644
--- a/lib/Plack/Test.pm
+++ b/lib/Plack/Test.pm
@@ -116,7 +116,7 @@ my @TEST = (
},
package Encodable;
use Moose::Role;
has encoder => (
is => 'rw',
isa => 'CodeRef'
);
sub encode {
my $self = shift;
package Acme::Morse;
use Moose::Role;
requires 'print_output';
sub encode {
my ($self, $thing) = @_;
my $morse = ....; # 変換
$self->print_output($morse);
use strict;
use KiokuDB;
use KiokuDB::Class;
print "Class::MOP -> ", $Class::MOP::VERSION, "\n";
print "Moose -> ", $Moose::VERSION, "\n";
print "KiokuDB -> ", $KiokuDB::VERSION, "\n";
my $meta = Moose::Meta::Class->initialize('KiokuDB::Class');
$meta->get_method_list();
# Extermely hackish way to realize case-sensitvie sort
# (without having to load a plugin)
# note, list.sort("foo") is not supported.
sub _build_template {
my $code = sub {
my ($list, @fields) = @_;
return $list unless @$list > 1; # no need to sort 1 item lists
return [
/*
* requires tokyodystopia, libapreq2
* TODO: make it possible to configure from httpd.conf
* remove all the hardcoded gunk
* test properly
* Yes, I looked at tdserver.c. Thanks to Kawai-san
*/
#include "httpd.h"
#include "http_config.h"
// ==UserScript==
// @name NoRadioTube
// @namespace http://mt.endeworks.jp/d-6/
// @description Silences RadioYoutube. RY is cool, but it gets annoying
// when your timeline is full of those tweets.
// @include http://twitter.com/*
// ==/UserScript==
function xpath(query, ctxt) {
if (ctxt == null) {
ctxt = document;