Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env perl
use utf8;
use strict;
use warnings;
my $app;
BEGIN { $app = 'stream2libnotify' }
use Config::Pit;
From 8ab9f7d1e72072fa8ec6ccb01fc579d2d4d18026 Mon Sep 17 00:00:00 2001
From: Yoshihiro Sasaki <[email protected]>
Date: Tue, 26 Oct 2010 15:51:41 +0900
Subject: [PATCH] FIXED: find_or_create failed if table has multi-pk
---
lib/DBIx/Skinny.pm | 6 +++++-
t/216_multi_pk.t | 17 +++++++++++++++++
2 files changed, 22 insertions(+), 1 deletions(-)
@ysasaki
ysasaki / Exception.pm
Created November 2, 2010 06:09
Using Exception::Class for Error Handling
package MyApp::Exception;
use strict;
use warnings;
use Scalar::Util qw/blessed/;
use Exception::Class (
'MyApp::Exception' =>
{ description => 'base class for myapp\'s exceptions' },
'MyApp::Exception::Params' => {
isa => 'MyApp::Exception',
@ysasaki
ysasaki / die_if_filefield_is_empty.t
Created February 25, 2011 17:53
die if HTML::Shakan 0.08 or 0.09 + FormValidator::Lite 0.23
use strict;
use warnings;
use Test::More;
use Test::Exception;
use HTTP::Request::Common;
use Plack::Request;
use Plack::Test;
use HTML::Shakan;
note "FormValidator::Lite $FormValidator::Lite::VERSION";
@ysasaki
ysasaki / main.m
Created March 1, 2011 06:27
NSMutableArrayの使い方確認
#import <stdio.h>
#import <Foundation/NSArray.h>
void* make_array(void) {
NSLog(@"initialize NSMutableArray");
NSMutableArray *ar = [[NSMutableArray alloc] initWithObjects:@"aaa", @"bbb", @"ccc", nil];
return ar;
}
int append(NSMutableArray* ar, NSString* str) {
#!/usr/bin/env perl
package Foo;
use strict;
use warnings;
use LWP::UserAgent;
my $agent = LWP::UserAgent->new;
sub request {
my $class = shift;
@ysasaki
ysasaki / perl_prereqscanner.pl
Created May 17, 2011 04:34
Perl::PrereqScanner
#!/usr/bin/env perl
# Usage:$0 filename
# e.g. ack --perl -f | xargs perl perl_prereqscanner.pl
use strict;
use warnings;
use Perl::PrereqScanner;
if ( @ARGV == 0 ) {
@ysasaki
ysasaki / push-notify.pl
Created July 27, 2011 05:30
exec @argv as command and send push-notification for iPhone using im.kayac.com
#!/usr/bin/env perl
use strict;
use warnings;
use Config::Pit;
my $config = pit_get( 'im.kayac.com',
require => { username => 'anon-perl-monger' } );
# find curl command
@ysasaki
ysasaki / mock.t
Created August 2, 2011 16:34
mock LWP::UserAgent::request without Test::Mock::LWP
use strict;
use warnings;
use Test::More;
use Test::MockObject;
use LWP::UserAgent;
use HTTP::Request::Common;
my $mock = Test::MockObject->new;
$mock->fake_module(
'LWP::UserAgent',
@ysasaki
ysasaki / yapcasia2011-talk-iine.pl
Created August 16, 2011 06:32
YAPC::Asia Tokyo 2011のtalkの+1とLikeの集計
#!perl
# Usage: $0 [last_talk_id] | sort -nrk1
use strict;
use warnings;
use Furl;
use JSON;
use Encode qw(encode_utf8);
use URI::Escape;