Skip to content

Instantly share code, notes, and snippets.

@ktat
ktat / gist:ee7da7230897b28c677455e48d18d098
Created August 18, 2021 04:50
東京の大規模接種会場用のBookmarklet(東京用)
// 自治体番号と自分の番号と生年月日を埋めて、Bookmarkに登録。フォームが表示された後に実行すればsubmitまでします。
// https://www.vaccine.mrso.jp/
javascript:(function(){document.getElementById("VisitnoAuthName").value="自治体番号"; document.getElementById("VisitnoAuthVisitno").value="個人用の番号";$("#VisitnoAuthYear").val("生年").change();$("#VisitnoAuthMonthMonth").val("月").change();$("#VisitnoAuthDayDay").val("日").change();$("button.auth-btn").click();})()
@ktat
ktat / gist:999684
Created May 31, 2011 00:35
WebSocket perl client(select)
#!/usr/bin/perl
use utf8;
use strict;
use warnings;
use Protocol::WebSocket::Handshake::Client;
use Protocol::WebSocket::Frame;
use IO::Socket;
use IO::Select;
@ktat
ktat / Install.pm
Last active November 10, 2017 05:26 — forked from ctyo/Install.pm
FreeStyleWiki上でMarkdown記法での記入を可能にするプラグイン
############################################################
#
# FreeStyleWiki上でMarkdown記法での記入を可能にします。
#
############################################################
package plugin::markdown::Install;
use strict;
sub install {
my $wiki = shift;
@ktat
ktat / dbd-mysql-mysql_insertid.pl
Last active June 11, 2016 11:14
DBD::mysql mysql_insertid returns 0
## 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 / gist:6176076
Last active December 20, 2015 18:29
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.
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
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 October 11, 2012 09:29
patch for regexp parentheses problem of Router::Simple
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!
@ktat
ktat / gist:3871091
Created October 11, 2012 08:55
Router Simple regexp with parentheses test
diff --git a/t/01_simple.t b/t/01_simple.t
index 1c6e110..2fd5dd7 100644
--- a/t/01_simple.t
+++ b/t/01_simple.t
@@ -7,6 +7,7 @@ my $r = Router::Simple->new();
$r->connect('home', '/' => {controller => 'Root', action => 'show'}, {method => 'GET', host => 'localhost'});
$r->connect('blog_monthly', '/blog/{year}/{month}', {controller => 'Blog', action => 'monthly'}, {method => 'GET'});
$r->connect('/blog/{year:\d{1,4}}/{month:\d{2}}/{day:\d\d}', {controller => 'Blog', action => 'daily'}, {method => 'GET'});
+$r->connect('/regexp/{year:(\d{1,4})}/{month:(\d{2})}/{day:(\d\d)}', {controller => 'Blog', action => 'daily'}, {method => 'GET'});
$r->connect('/comment', {controller => 'Comment', 'action' => 'create'}, {method => 'POST'});
@ktat
ktat / gist:3499604
Created August 28, 2012 16:10
Text::Xslateの謎な挙動
#!/usr/bin/perl
use strict;
use warnings;
use Text::Xslate;
use utf8;
use Encode;
my %vpath;
$vpath{"test.tt"} = <<_TMPL_;
@ktat
ktat / gist:3339545
Created August 13, 2012 11:04
Email::MIME bug?
#!/usr/bin/perl
# Using Transport::SMTP, body is grabled with some case.
# With same code,
# Transport::Sendmail is ok(not garbled)
# Transport::SMTP is ng(garbled)
use strict;
use Carp;
use warnings;