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 v6; | |
| grammar JSON::Tiny::Grammar; | |
| rule TOP { ^[ <object> | <array> ]$ } | |
| rule object { '{' ~ '}' <pairlist> } | |
| rule pairlist { [ <pair> ** [ \, ] ]? } | |
| rule pair { <string> ':' <value> } | |
| rule array { '[' ~ ']' [ <value> ** [ \, ] ]? } | |
| proto token value { <...> }; |
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
| #!perl | |
| package Gate; | |
| use Data::Dumper; | |
| use warnings; | |
| use Carp; | |
| sub new { | |
| my $self = bless {}, 'Gate'; |
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 File::Find; | |
| use File::Copy; | |
| use Cwd; | |
| use File::Path qw(make_path); | |
| my $workdir = getcwd; | |
| find(sub { | |
| return if -d; | |
| return if -l; |
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 File::Find; | |
| use File::Copy; | |
| use Cwd; | |
| my $workdir = getcwd; | |
| find(sub { | |
| return if -d; | |
| return if -l; | |
| return if /^\./; |
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
| sub _hdlr_entry_body_has_width { | |
| my($ctx, $args, $cond) = @_; | |
| return 0 if ( ! $ctx->stash('entry') ); | |
| unless( $args->{'width'} ) { | |
| ## tut nado chto-to sdelat s soobsheniem - ono ne sootwetstvuet logike | |
| &MT::log('Unexpected parameter width for tag <MTIfEntryBodyHasWidth>'); | |
| return 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
| sub _hdlr_entry_body_has_image { | |
| my($ctx, $args, $cond) = @_; | |
| return 0 if (!$ctx->stash('entry')); | |
| my $entry_text = &MT::Template::Context::_hdlr_entry_body; | |
| my @paragraphs = split(/<p[^>]*>/i, $entry_text); | |
| ## just checking for img tag in the | |
| ## first three paragraphs, skip first array element, | |
| ## because of that element is fake element |
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
| # Setting loggers | |
| log4perl.logger.ConsoleFile=INFO, Console, File | |
| log4perl.logger.Console=INFO, Console | |
| log4perl.rootLogger=INFO, Console, File | |
| # File appender | |
| log4perl.appender.File=Log::Log4perl::Appender::File | |
| log4perl.appender.File.filename= sub { HP::Logger::get_log_file_name(); } | |
| log4perl.appender.File.mode=append |
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 HP::Logger; | |
| BEGIN { | |
| use FindBin qw($Bin $Script); | |
| $Script =~ s/.pl//; | |
| unshift @INC, "$Bin/../lib/perl"; | |
| unshift @INC, "$Bin/../lib/mt/extlib"; | |
| } | |
| use Exporter; |
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
| to_tz(R, Tz) -> | |
| Tz_offset = ((Tz#timezone.hour * 60) + Tz#timezone.minute) * 60, | |
| R_offset = (((R#timestamp.timezone)#timezone.hour * 60) + (R#timestamp.timezone)#timezone.minute) * 60, | |
| R_seconds = calendar:datetime_to_gregorian_seconds(to_datetime(R)), | |
| New_seconds = R_seconds - R_offset + Tz_offset, | |
| Datetime = calendar:gregorian_seconds_to_datetime(New_seconds), | |
| {ok, New_R} = from_datetime(Datetime), | |
| New_R#timestamp{timezone = Tz, fraction = R#timestamp.fraction}. |
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
| parse_iso8601(Time) when is_list(Time) -> | |
| parse_iso8601( list_to_binary(Time) ); | |
| parse_iso8601(Time) when is_binary(Time) -> | |
| try | |
| {ok, iso_to_rec( | |
| year, | |
| Time, | |
| #timestamp{ | |
| year = 0, |