Skip to content

Instantly share code, notes, and snippets.

Atsushi Kato ktat

Block or report user

Report or block ktat

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ktat
ktat / dbd-mysql-mysql_insertid.pl
Last active Jun 11, 2016
DBD::mysql mysql_insertid returns 0
View dbd-mysql-mysql_insertid.pl
## version
# Perl 5.18.1
# DBI 1.636
# DBD::mysql 4.033
## create table SQL
# create table t(id integer not null auto_increment, primary key (id)) ;
## this can get mysql_insertid
my $dbh = DBI->connect("dbi:mysql:test;user=root");
@ktat
ktat / Install.pm
Last active Nov 10, 2017 — forked from ctyo/Install.pm
FreeStyleWiki上でMarkdown記法での記入を可能にするプラグイン
View Install.pm
############################################################
#
# FreeStyleWiki上でMarkdown記法での記入を可能にします。
#
############################################################
package plugin::markdown::Install;
use strict;
sub install {
my $wiki = shift;
View gist:2ef7f2610576a917c06f
use base qw/Qudo::Worker/;
sub import{
my $class = shift;
if($class->split_process_from_initial_character()){
no strict 'refs';
my $package = $class;
*{"$package\::InitialLowerCase::ISA"} = [$package];
*{"$package\::InitialUpperCase::ISA"} = [$package];
*{"$package\::InitialNumber::ISA"} = [$package];
*{"$package\::get_splited_worker_classname"} = sub {
View gist:5e54ae2a9118e05651b1
#!/usr/bin/env perl
use feature 'say';
package Hoge{
sub new {
my $class = shift;
my $args = ref $_[0] ? $_[0] : +{@_};
bless $args, $class;
}
View gist:902a9996de10eb9e40b7
#!/usr/bin/env perl
package Hoge{
sub new {
my $class = shift;
my $args = ref $_[0] ? $_[0] : +{@_};
$args->{package} = __PACKAGE__;
bless $args, $class;
}
View goto_test.pl
#!/usr/bin/perl
use strict;
use warnings;
package Test;
use Carp;
sub hoge {
View gist:9597471
use Data::Delay;
my $test = 1;
my $data = Data::Delay->new(\$test);
print $data; # 1
$test = 2;
print $test; # 2
my $plus = Data::Delay->New(sub { $data + 2 });
@ktat
ktat / gist:6176076
Last active Dec 20, 2015
patch for backlogs plugin v0.9.26 add start date, due date, progress when creating task. change progress to 100% and due_date is current date if empty when task is finished. start_date is null when task is created. start_date is set as current date when task's start date is null and task is moved to in progress.
View gist:6176076
diff --git a/app/models/rb_task.rb b/app/models/rb_task.rb
index fae445f..f64a748 100644
--- a/app/models/rb_task.rb
+++ b/app/models/rb_task.rb
@@ -36,7 +36,9 @@ class RbTask < Issue
task = new(attribs)
if params['parent_issue_id']
parent = Issue.find(params['parent_issue_id'])
- task.start_date = parent.start_date
+ if ! task.start_date
View gist:3871366
diff --git a/lib/Router/Simple/Route.pm b/lib/Router/Simple/Route.pm
index 6c5ba4a..2e664f1 100644
--- a/lib/Router/Simple/Route.pm
+++ b/lib/Router/Simple/Route.pm
@@ -33,7 +33,7 @@ sub new {
}
$row->{pattern} = $pattern;
-
+ my $pattern_re_capture = $pattern;
@ktat
ktat / gist:3871233
Created Oct 11, 2012
patch for regexp parentheses problem of Router::Simple
View gist:3871233
diff --git a/lib/Router/Simple/Route.pm b/lib/Router/Simple/Route.pm
index 6c5ba4a..09103cc 100644
--- a/lib/Router/Simple/Route.pm
+++ b/lib/Router/Simple/Route.pm
@@ -41,6 +41,7 @@ sub new {
$row->{_regexp_capture} = 1;
$pattern;
} else {
+ my $n = -1;
$pattern =~ s!
You can’t perform that action at this time.