Skip to content

Instantly share code, notes, and snippets.

View vti's full-sized avatar

Viacheslav Tykhanovskyi vti

  • UPTOSMTH OÜ
  • Mars
View GitHub Profile
@vti
vti / Foo.pm6
Last active August 29, 2015 14:10
class Foo {
method foo () {
ROUTE: for ^1 {
}
}
}
@vti
vti / send-to-edge-500
Last active August 29, 2015 14:16
Reliably send GPX to Garmin EDGE 500
#!/bin/sh
#set -x
FILE=$1
DEV=$2
MOUNT=/tmp/garmin
FILE_BASENAME="${FILE%.gpx}"
FILE_DATES="$FILE_BASENAME-dates.gpx"
@vti
vti / gist:95cc50404d1a6f2d38ae
Created July 22, 2015 05:29
HTTP::Tiny loggable
use strict;
use warnings;
use HTTP::Tiny;
{
my $ua = HTTP::Tiny->new();
my $request = '';
my $response = '';
content - контент
escaping - экранирование
footer - подвал
header - шапка
helper
layout - общий шаблон
plain text - текст без форматирования
plugin - расширение
raw bytes
render
#!/usr/bin/env perl
use strict;
use warnings;
use Mojo::DOM;
use Data::Dumper;
my $file;
maestro% ~/dev/mojo/script/mojo get --header http://ya.ru
Connection: Keep-Alive
Date: Fri, 16 Jul 2010 11:15:33 GMT
Server: Mojolicious (Perl)
Content-Length: 38
Content-Type: text/plain
Congratulations, your Mojo is working!Couldn't open page "--header".
#!/usr/bin/env perl
use strict;
use warnings;
my $query = join ' ' => @ARGV;
my $url = 'http://www.google.com/search';
use Mojo::Client;
use Mojo::URL;
#!/usr/bin/env perl
use strict;
use warnings;
use Mojo::Client;
my $client = Mojo::Client->new;
my $news = 'http://digg.com';
#!/usr/bin/env perl
use strict;
use warnings;
use FindBin;
BEGIN {
use lib "/Users/vti/dev/protocol-websocket/lib";
}
@vti
vti / app.psgi
Created August 30, 2011 15:37
jsonp for metacpan
$app = Plack::Middleware::ReverseProxy->wrap($app);
$app = Plack::Middleware::RestrictedJSONP->wrap($app, path => qr{^/(?:author|release|pod)(?:$|/)});