Skip to content

Instantly share code, notes, and snippets.

use strict;
use warnings;
use Plack::Builder;
my $app = sub {
return [ 200, [ 'Content-Type' => 'text/html; charset=utf-8' ], [ <<HTML ] ];
<h1>こんにちは!!</h1>
<p>ようこそ!!ここは僕のホームページです!!</p>
<p>今日は<code>Perl</code>を書きました!!</p>
<p>以下は僕の趣味と特技です</p>
@hitode909
hitode909 / perl_lint.rb
Last active September 29, 2018 14:18
ソースコード褒めてくれるやつ
#! /usr/bin/env ruby
unless ARGV.length > 0
warn "usage: ruby perl_lint.rb YOUR_SOURCE_CODE.pl"
exit 1
end
puts %w(やるじゃん すごい がんばって やればできる 努力だ ワッショイ お上手).sample + '!' * (rand*10).to_i
@hitode909
hitode909 / a.pl
Created June 18, 2014 03:26
smartmatch最悪
use experimental 'smartmatch';
use Test::More tests => 5;
sub in_tripartite_pact {
my ($country) = @_;
return $country ~~ ['Japan', 'Germany', 'Italy'];
}
ok in_tripartite_pact('Japan'), 'Japan signed the pact.';
@hitode909
hitode909 / encode.pl
Created June 11, 2014 09:52
encode_utf8しまくるやつ
use strict;
use warnings;
use Encode qw(encode_utf8);
use Time::HiRes qw/usleep/;
my ($value) = @ARGV;
while(1) {
print "$value\n";
usleep 100000;
@hitode909
hitode909 / chou.txt
Last active August 29, 2015 14:01
長で終わる単語のリスト Wikipediaの見出し語リストから生成
FRB議長
JUNK2 陣内智則のひとり番長
KuRaRe編集長
NATO事務総長
NHK会長
QT延長
SS上級曹長
SS伍長
SS曹長
SS特務曹長
@hitode909
hitode909 / hamuo
Created May 14, 2014 10:27
はむお
#!/usr/bin/env ruby
puts "🐹 < #{ ARGV.empty? ? ARGF.read : ARGV.join(' ') }"
@hitode909
hitode909 / mosikasite.pl
Created May 13, 2014 10:11
メソッドが呼ばれたときに同名のフィールドがあったらもしかしてって言いながら死ぬやつ
package Mosikasite {
sub new {
my ($class) = @_;
bless {}, $class;
}
sub AUTOLOAD {
my ($self) = @_;
my $method = (split '::', $AUTOLOAD)[-1];
@hitode909
hitode909 / commit-dates-for-word-of-repository.rb
Created January 4, 2014 09:31
リポジトリ内で指定した単語が書かれた時期を調べる
require 'shellwords'
class AnnotateLine
attr_reader :content, :meta
def initialize
@meta = {}
@content = nil
end
def add_line line
@hitode909
hitode909 / wifi_to_internet.rb
Created November 25, 2013 00:13
接続中のWiFiのSSIDからインターネットにチェックインするやつ
#! /usr/bin/env ruby
# -*- coding: utf-8 -*-
# 接続中のWiFiのSSIDからインターネットにチェックインするやつ
ssid = `/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I`.split(/\n/).find{|line| line =~ /\bSSID/ }.scan(/SSID: (.+)$/).flatten.first
system "open 'http://t.heinter.net/#{ ssid }'"