Skip to content

Instantly share code, notes, and snippets.

View kraih's full-sized avatar

Sebastian Riedel kraih

View GitHub Profile
use 5.14.0;
# Very common leak
my $foo;
$foo = sub {
my ($i, $j) = @_;
return if $i >= $j;
say $i++;
$foo->($i, $j);
};
set background=dark
hi clear
if exists("syntax_on")
syntax reset
endif
let colors_name = "kraihlight"
html {
font-family: "Consolas";
font-size: 11pt;
background-color: #1A1A1A;
color: #F9F9F9;
padding: 0;
margin: 0;
}
body {
$ twiggy -l :3000 twitter.psgi
#!/usr/bin/env perl
use Mojolicious::Lite;
use Coro;
use Mojo::IOLoop;
Mojo::IOLoop->recurring(0 => sub {cede});
hook around_dispatch => sub {
my $next = shift;
async { $next->() };
#!/usr/bin/env perl
use Mojolicious::Lite;
use Coro;
use Mojo::IOLoop;
Mojo::IOLoop->recurring(0 => sub {cede});
hook around_dispatch => sub {
my $next = shift;
async { $next->() };
# StreamingPSGI - Everything is streaming, no special cases
my $env = {
SERVER_NAME => 'localhost',
SERVER_PORT => 80,
SCRIPT_NAME => '',
REQUEST_METHOD => 'GET',
HTTP_CONTENT_LENGTH => 12,
version => 3,
url_scheme => 'http',
read => sub {...},
package Mojolicious::Command::files;
use Mojo::Base 'Mojo::Command';
use Mojo::Home;
has description => "List templates and static files.\n";
has usage => "usage: $0 files\n";
sub run {
my $self = shift;
package MyApp::Controller::Bar;
use Mojolicious::Lite;
get '/test' => sub {
my $self = shift;
$self->render('test');
};
1;
__DATA__
use Mojolicious::Lite;
use EV;
use IO::Async::Process;
use IO::Async::Loop::EV;
my $loop = IO::Async::Loop::EV->new;
get '/' => sub {
my $self = shift;