Skip to content

Instantly share code, notes, and snippets.

@MacoTasu
MacoTasu / irc-notification.pl
Last active December 16, 2015 13:49
script which contributes to irc from a command line
use strict;
use warnings;
use AnyEvent;
use AnyEvent::IRC::Client;
# conf
my $conf = {
irc => {
server => '*****',#server
channel => '#****',# channel
@MacoTasu
MacoTasu / test.sql
Created December 6, 2015 01:03
create test data sql
DROP TABLE IF EXISTS `entries`;
CREATE TABLE `entries` (
`id` INTEGER unsigned NOT NULL auto_increment,
`user_id` INTEGER,
`title` VARCHAR(191) NOT NULL,
`created_at` datetime,
`updated_at` datetime,
INDEX `user_id_idx` (`user_id`),
PRIMARY KEY (`id`)
@MacoTasu
MacoTasu / gist:4230822
Created December 7, 2012 04:48
redirect実装したい
ackage Actlog::Controller::Login;
use Ark 'Controller';
use Actlog::Models;
use Try::Tiny;
use JSON::Types;
use Facebook::Graph;
use CGI;
@MacoTasu
MacoTasu / p5-remove-remote-branch.pl
Last active September 10, 2015 04:56
remote branch remove script
use common::sense;
use Getopt::Long;
local $| = 1;
GetOptions(\my %opts, qw/
prod
/);
my $prod = $opts{'prod'};
@MacoTasu
MacoTasu / datetime-vs-datetime-epoch.pl
Last active September 1, 2015 10:11
Benchmark DateTime vs DateTime::epoch
#!/usr/bin/perl
use strict;
use utf8;
use warnings;
use DateTime;
use Benchmark qw(:all) ;
my $now_1 = DateTime->now;
@MacoTasu
MacoTasu / gist:746d42c6cced111508b2
Created June 24, 2015 07:42
ダンゲル氏の傑作コード
func (k *Ksatriya) handle(method, path string, hf HandlerFunc, filterFuncs map[string]FilterFunc) {
k.router.Handle(method, path, func(w http.ResponseWriter, req *http.Request, args httprouter.Params) {
ctx := NewContext(req, args)
if ff, ok := filterFuncs[BeforeFilterFuncKey]; ok {
ff(ctx)
if ctx.Response().StatusCode() == http.StatusFound {
ctx.Write(w)
return
}
@MacoTasu
MacoTasu / gist:7ce1f00d434fe72e0710
Last active August 29, 2015 14:22
intaractve select bucket
func getBucket(svc *s3.S3) string {
» var param *s3.ListBucketsInput
» resp, err := svc.ListBuckets(param)
» if err != nil {
» » assert(err)
» }
» var buckets []string
» for index, b := range resp.Buckets {
@MacoTasu
MacoTasu / mouse.pl
Last active August 29, 2015 14:16 — forked from hisaichi5518/mouse.pl
package Result::User {
use strict;
use warnings;
use utf8;
sub new { bless {}, shift }
sub to_model {
my $self = shift;
Model::User->new(user => $self);
@MacoTasu
MacoTasu / gist:3cd2d8d0b8af4ed759b7
Last active August 29, 2015 14:07
コードレビュー初心者視点
  1. 新しいチームに入って最初に見たコードなんでわからないことしか無いので、「なんでこうしてるんだ?」っておもったらまず聞くことを心がけた
  • 聞かないことには始まらないし、深い理由を追えない
  • 理由を聞くと思想がわかってくるから、他のコード見た時「あ、なるほどな」ってなるようになるのでいい
  1. コードで大切にしている方針を見ながらレビューするようにした
  • ポケットだと「良いコード = みんなが理解しやすいコード」みたいなのがざっくりあったからそれを意識してレビューしてた
  • ex) mapとgrep使いまくって一行で納めてるコードより、methodに細分化して名前をつけたコードのほうがみんな分かりやすい的な
  • チームで大切にしている考えをもとにレビューしていけば、いいプロダクトになる
  1. LGTMつかってこ