Skip to content

Instantly share code, notes, and snippets.

View kyanny's full-sized avatar

Kensuke Nagae kyanny

View GitHub Profile
#!/usr/bin/env perl
use strict;
use Text::CSV_XS;
use Data::Dumper;
use Perl6::Say;
use Email::Address::Loose;
my $csv = Text::CSV_XS->new;
while (my $row = $csv->getline(*STDIN)) {
#!/usr/bin/env perl
use strict;
use Array::Diff;
use Data::Dumper;
my ($old, $new) = @ARGV;
open my $io, '<', $old;
my @old = <$io>;
chomp @old;
close $io;
<script src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
if (location.href.match(/^http:\/\/.*?\/archives\/\d+\.html$/)) {
google.load('jquery', '1');
google.setOnLoadCallback(function(){
$('<a>').attr({
href : 'http://b.hatena.ne.jp/entry/' + location.href
}).append(
$('<img>').attr({
src : 'http://d.hatena.ne.jp/images/b_entry.gif',
#!/usr/bin/env perl
use strict;
use warnings;
use Getopt::Long::Descriptive;
use WebService::Simple;
use Encode;
use Term::Encoding qw(term_encoding);
my $base_url = 'http://weather.livedoor.com/forecast/webservice/rest/v1';
#!/usr/bin/env perl
use strict;
use HTML::TokeParser;
my $filename = shift or die;
my $p = HTML::TokeParser->new($filename);
my $html;
while (my $token = $p->get_token) {
if ($token->[0] eq 'S'
#import <Cocoa/Cocoa.h>
int main(int argc, const char *argv[]) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSURL *url = [NSURL URLWithString:@"http://clip.livedoor.com/"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
NSURLResponse *response;
NSError *error;
NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
printf("%d\n", [data length]);
#import <Cocoa/Cocoa.h>
int main(int argc, const char *argv[]) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSString *string;
NSArray *array;
string = @"foo<>bar<>baz";
//string = [[NSString alloc] initWithString:@"foo<>bar<>baz"];
array = [string componentsSeparatedByString:@"<>"];
printf("%d\n", [array count]);
#import <Cocoa/Cocoa.h>
@interface Split : NSObject
{
}
- (NSArray *)split:(NSString *)string;
@end
@implementation Split
- (NSArray *)split:(NSString *)string
;; key modifier
(when (and (eq system-type 'darwin) (eq window-system 'ns))
(setq mac-command-modifier 'meta)
(setq mac-option-modifier 'super))
#!/usr/bin/env perl
use strict;
use DateTime;
use DateTime::Duration;
use Benchmark qw(timethese cmpthese);
use Date::Calc qw(check_date check_time Today Today_and_Now Delta_DHMS);
use Data::Dumper;
$Data::Dumper::Terse = 1;
$Data::Dumper::Indent = 0;