Skip to content

Instantly share code, notes, and snippets.

View SpringMT's full-sized avatar

Spring_MT SpringMT

View GitHub Profile
#!/usr/bin/env perl
use strict;
use warnings;
use FindBin;
use lib "$FindBin::Bin/extlib/lib/perl5";
use lib "$FindBin::Bin/lib";
use Isucon;
use Cache::Memcached::Fast;
use strict;
use warnings;
use Test::More;
open my $fh, '>', \(my $output_buffer = '');
Test::More->builder->output($fh);
Test::More->builder->failure_output($fh);
Test::More->builder->todo_output($fh);
note "hoge";
class PirateValidator < ActiveModel::Validator
def validate(document)
unless document.comment.include? 'matey'
document.errors[:comment] << 'does not sound like a pirate'
end
end
end
#!/usr/bin/env perl
=head1 NAME
idezawaman.pl -
=head1 WHY THIS NAME?
16:24 < Yappo> ちょっとしたツールかきたいのに良い名前が思い浮かばなくてかけてない
16:28 < teranishi> まかせなさい
@chitchcock
chitchcock / 20111011_SteveYeggeGooglePlatformRant.md
Created October 12, 2011 15:53
Stevey's Google Platforms Rant

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real

@zigorou
zigorou / poll.pl
Created October 25, 2011 13:40
perl echo servers
#!/usr/bin/env perl
use strict;
use warnings;
use FindBin;
use lib "$FindBin::Bin/../lib";
use Getopt::Long;
use IO::Socket::INET;
use IO::Poll;
use Log::Minimal;
@zigorou
zigorou / redis_connect.c
Created November 8, 2011 16:23
connect to redis by hiredis
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <hiredis/hiredis.h>
/**
* gcc -I/usr/local/include -L/usr/local/lib -lhiredis -Wall -o connect connect.c
*/
void redisDisconnect(redisContext *ctx) {
@tily
tily / scaling_isomorphic_javascript_code.ja.markdown
Last active July 19, 2025 22:00
サバクラ両方で動く JavaScript の大規模開発を行うために

サバクラ両方で動く JavaScript の大規模開発を行うために

原文:Scaling Isomorphic Javascript Code (This is just for study, please contact me at tily05 atmark gmail.com if any problem.)

考えてみれば Model-View-Controller とか MVC ってよく聞くよね。実際どんなものか知ってる? 抽象的に言うなら「オブジェクト情報の保持されるグラフィック・システム (つまり、ラスターではないグラフィック。ゲームとか) 上に構築された、表示系を中心としたアプリケーションにおいて、主要な機能どうしの関わりをうまく分離すること」とでも言おうか。もう少し深く考えを押し進めてみれば、これは当然、他のさまざまなアプリケーションにもあてはまる言葉 (bucket term ?) だ。

過去に多くの開発コミュニティが MVC による解決案を提供し、それによってよくあるユースケースにうまく対処し、地位を築くことができた。例をあげるなら、Ruby や Python コミュニティは Rails や Django を作り、MVC アーキテクチャを実現した。

@wok
wok / multi_statements_mysql2.rb
Created November 15, 2011 19:02
ActiveRecord MULTI_STATEMENTS with mysql2
# place in config/initalizers
module ActiveRecord
class Base
# Establishes a connection to the database that's used by all Active Record objects.
def self.mysql2_connection(config)
config[:username] = 'root' if config[:username].nil?
if Mysql2::Client.const_defined? :FOUND_ROWS
config[:flags] = Mysql2::Client::FOUND_ROWS | Mysql2::Client::MULTI_STATEMENTS
@makoto
makoto / real_world_druby.md
Created November 19, 2011 15:13 — forked from seki/real_world_druby.md
実世界でのdRubyの使用例

実世界でのdRubyの使用例

dRubyはこれまでに多くの大規模システムの基盤として利用されてきました。dRubyはいつものRubyプログラミングに非常に近い感覚で分散オブジェクトを実現します。これにより、複雑な分散システムであってもアイデアをすぐに実現することができます。 dRubyが提供するのは汎用のRMIです。スケッチの段階でdRubyを用い、有用性を確認したのちに用途に特化したミドルウェアに置き換えるといったように成長していったシステムも多いようです。 以下に実世界でのdRubyの使用例を示します。

Hatena Screen Shot (http://www.hatena.ne.jp/)

Hatena は日本を代表するインターネットカンパニーで、ブログ、ソーシャルブックマークサービスなどを提供しています。2006年当時(現在はサービス終了) Hatena Screen Shotという、登録されたURLのスクリーンショットをサムネイルとして表示するサービスがありました。このサービスのアーキテクチャーのユニークな点にWebフロントエンドはLinux上に構築されているが、スクリーンショットの撮影はWindowsのIEコンポーネントを用いて実現されていることにある。これはWindows環境の方がスクリーンショットを撮影できる環境が整っていたためであるが、クロスプラットフォーム間のシステムを協調させるdRubyを使った良い例といえよう。またスクリーンショットマシーンは並列処理が行われていたため、スケーラビリティも確保されていた。