Skip to content

Instantly share code, notes, and snippets.

diff --git a/lib/Starman/Server.pm b/lib/Starman/Server.pm
index c98af6f..a927e0d 100644
--- a/lib/Starman/Server.pm
+++ b/lib/Starman/Server.pm
@@ -21,6 +21,29 @@ my $null_io = do { open my $io, "<", \""; $io };
use Net::Server::SIG qw(register_sig);
+sub SSL_key_file {
+ my ($self, $host, $port, $proto) = @_;
@sugar84
sugar84 / gist:952361
Created May 2, 2011 21:03
twiggy vs node.js vs HTTP::Server::Simple::PSGI
----------------------------------------------------------
== Twiggy ==
app.psgi:
my $app = sub {
return [ 200, ['Content-Type' => 'text/plain'], [ "Hello world\n"] ];
};
[sugar@host dir]$ twiggy --listen 127.0.0.1:8080 app.psgi
my $root = '.';
my @indexes = qw(index.html);
use strict;
use warnings;
use Plack::App::File;
use Plack::App::Cascade;
sub directory_indexes {
my ($root, @indexes) = @_;
my $file = Plack::App::File->new(root => $root)->to_app;
@audreyt
audreyt / gist:834671
Created February 19, 2011 00:31 — forked from fujiwara/gist:732822
mt.psgi (for both Melody and MT5)
#!/usr/bin/env perl
use strict;
use warnings;
use File::Basename;
use Plack::Builder;
use Plack::App::CGIBin;
my $basedir = dirname(__FILE__);
@sekimura
sekimura / infinite-scroll-typepad-entries.html
Created February 9, 2011 21:32
infinite scroll typepad blog entries
<div id="post-assets"></div>
<div class="module-header" id="loading-more-assets"><img src="http://static.typepad.com/.shared:v20110208.01-0-gebb190b:typepad:en_us/images/spinner.gif"/></div>
<style>
.entry-content {
border-bottom: solid 1px #CCC;
padding-bottom: 10px;
margin-bottom: 10px;
padding-top: 10px;
}
#!/usr/bin/env perl
use strict;
use warnings;
use Pod::Usage;
use Text::Markdown 'markdown';
use HTML::TreeBuilder;
use List::Util 'max';
@octplane
octplane / mongo_pubsub.rb
Created November 9, 2010 16:17
Simple Pub/Sub system using MongoDB, capped collections and tailable cursors in ruby
require 'rubygems'
require 'mongo'
module MongoPubSub
QUEUES_COLLECTION = 'queues'
class EndSubscriptionException < Exception; end
class Publisher
def initialize(queue_name, mongo_connection)
# Initialize queue collection as a capped collection
if not mongo_connection[QUEUES_COLLECTION].collection_names.include?(queue_name)
#!/usr/bin/env perl
use strict;
use warnings;
my $input = shift or die "Usage: $0 Masayoshi";
my %phoetic_alphabet;
while(<DATA>) {
chomp;
my ($letter, $word) = split(/\s+/, $_, 2);
use Data::Dumper;
my @r;
my $text = q{@hoge http://example.com/#@hoge/ aaa #hash aaa @hogehoge aaa http://example.com/};
my $re = qr{(http://[A-Za-z0-9_\-\~\.\%\?\#\@/]+(?{push @r, ["HTTP", @-,@+] })|(?:^|\s)\@[A-Za-z0-9_]+(?{push @r,["AT", @-,@+]})|(?:^|\s)#[A-Za-z0-9_]+(?{push @r,["HashTag",@-,@+]}))};
warn $text;
() = $text =~/$re/g;
warn Dumper @r;
=head1 NAME
Plack::Loader - (auto)load PSGI/Plack Servers
=head1 SYNOPSIS
#!/usr/bin/env perl
# printenv-like app in PSGI, F?CGI, AnyEvent, Coro, POE or Danga::Socket
use strict;
use warnings;