This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Mojolicious::Lite; | |
websocket '/echo' => sub { | |
my $self = shift; | |
$self->on(message => sub { | |
my ($self, $message) = @_; | |
$self->send("echo: $message"); | |
}); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Mojolicious::Lite; | |
get '/title' => sub { | |
my $self = shift; | |
my $url = $self->param('url'); | |
$self->render(text => | |
$self->client->get($url)->success->dom->at('title')->text); | |
}; | |
app->start; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Mojolicious::Lite; | |
my $feed = 'http://blog.kraih.com/rss.xml'; | |
get '/blog/atom/perl/atom.xml' => sub { | |
my $self = shift; | |
$self->ua->max_redirects(5)->get($feed => sub { | |
$self->render(text => shift->res->body, format => 'rss'); | |
}); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
# Use bundled libraries | |
use FindBin; | |
use lib "$FindBin::Bin/../lib"; | |
# Mamma Mia! The cruel meatball of war has rolled onto our laps and ruined |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tlrobinson@tlr-mac-pro ~/Projects/jslinux (1) $ node linux.js | |
loaded vmlinux26.bin (1753221 bytes to location 0x100000) | |
loaded root.bin (3461120 bytes to location 0x400000) | |
loaded linuxstart.bin (14858 bytes to location 0x10000) | |
Starting Linux | |
Linux version 2.6.20 (jdub@fehung) (gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4) ) #2 Tue May 17 21:52:21 EST 2011 | |
BIOS-provided physical RAM map: | |
sanitize start | |
sanitize bail 0 | |
BIOS-88: 0000000000000000 - 000000000009f000 (usable) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Mojo::IOWatcher::AnyEvent; | |
use Mojo::Base 'Mojo::IOWatcher'; | |
use AE; | |
use Scalar::Util 'weaken'; | |
$ENV{MOJO_IOWATCHER} ||= 'Mojo::IOWatcher::AnyEvent'; | |
my $SINGLETON; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use Mojolicious::Lite; | |
use EV; | |
use AnyEvent::IRC::Client; | |
# Join #mojo on irc.perl.org | |
my $irc = AnyEvent::IRC::Client->new; | |
$irc->connect('irc.perl.org', 6667, {nick => "mojobot$$"}); | |
$irc->send_srv(JOIN => '#mojo'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra/base' | |
require 'rack/flash' | |
require 'warden' | |
require 'slim' | |
require 'sequel' | |
require 'sqlite3' | |
DB = Sequel.sqlite | |
DB.create_table :users do | |
primary_key :id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: apache-2.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set background=dark | |
hi clear | |
if exists("syntax_on") | |
syntax reset | |
endif | |
let colors_name = "kraihlight" |
OlderNewer