Skip to content

Instantly share code, notes, and snippets.

View yko's full-sized avatar

Yaroslav Korshak yko

  • Plaid
  • Amsterdam, The Netherlands
View GitHub Profile
my $kw = $r->route('/keywords')
->to(controller => 'stats', action => 'keywords')
->name('keywords');
my $kwid = $kw->waypoint('/:id', id => qr/\d+/)
->to('action' => 'keyword_stats')
->name('keyword stats');
#!/usr/bin/perl
use strict;
use warnings;
use Mojo::Client;
my $client = Mojo::Client->new( max_redirects => 3 );
my @urls = qw(http://bash.org http://autocentre.ua);
<?xml version="1.0" encoding="iso-8859-1" ?>
<tests version="1.0">
<group>
<item>4</item>
<item>2</item>
<item>1</item>
</group>
<group>
<item>4</item>
#!/usr/bin/perl
use strict;
use warnings;
my $str = shift @ARGV;
if ($str =~ /(|\d+?)((?:(?:2[1..5][1..5]|1?\d?\d)\.){3}(?:2[1..5][1..5]|1?\d?\d))/) {
if ($1) { warn "Strange ip: $&" }
sub build_tx {
my ($self, $user, $pass) = @_;
croak("Basic authorization user name can't contain ':'")
if $user =~ /:/;
# or build_tx('POST|GET|...', ...), see Mojo::Client
my ($tx, $cb) = $self->client->build_form_tx($url, {
field => 'value',
# ...
Testing gist.vim
-- Updating gist with vim
Lalala
eeeee
mojolicious generate app prof
cd prof
perl -MDevel::NYTProf script/prof get /
nytprofhtml
package Lighter;
use strict;
use warnings;
use base 'Mojo::Base';
#use Mojolicious::Commands;
use Mojolicious::Plugins;
use MojoX::Dispatcher::Routes;