Skip to content

Instantly share code, notes, and snippets.

View vovkasm's full-sized avatar

Vladimir Timofeev vovkasm

  • Self employed
  • Budva, Montenegro
View GitHub Profile
@vovkasm
vovkasm / bench-HereTemplate-vs-Xslate.pl
Created April 14, 2012 18:12
Simple dumb compare speed of Here::Template and Text::Xslate
#!perl
use 5.014;
use warnings;
use lib::abs './Here-Template/lib';
use Here::Template;
use Text::Xslate;
use Benchmark qw(cmpthese);
my %vpath = ( 'test.tx' => <<'XSLATETT' );
Hello, my pid is <: $a :>
#!perl
use 5.016;
use warnings;
use Benchmark 'timethese';
use Judy::1 qw/Set Get Count Unset MemUsed/;
say 'fill array...';
my %H;
my $J;
@vovkasm
vovkasm / html-tidy-silence-warnings.patch
Created October 9, 2012 05:53
fix warnings when no errors occured in HTML::Tidy::parse
diff --git a/lib/HTML/Tidy.pm b/lib/HTML/Tidy.pm
index 079c8a8..26ee3b0 100644
--- a/lib/HTML/Tidy.pm
+++ b/lib/HTML/Tidy.pm
@@ -228,9 +228,9 @@ sub parse {
$self->{config_file},
$self->{tidy_options}
);
- utf8::decode($errorblock);
-
@vovkasm
vovkasm / html-tidy-fix-inversed-unicode-conversion-logic.patch
Created October 9, 2012 05:56
HTML::Tidy: fix inversed utf8::encode logic
diff --git a/lib/HTML/Tidy.pm b/lib/HTML/Tidy.pm
index 26ee3b0..6393b00 100644
--- a/lib/HTML/Tidy.pm
+++ b/lib/HTML/Tidy.pm
@@ -223,7 +223,7 @@ sub parse {
}
my $html = join( '', @_ );
- utf8::encode($html) unless utf8::is_utf8($html);
+ utf8::encode($html) if utf8::is_utf8($html);
@vovkasm
vovkasm / bench-berkeleydb.pl
Created October 22, 2012 20:07
try benchmark berkeleydb hash impl
#!perl
use 5.016;
use Benchmark qw/timethis/;
use BerkeleyDB;
use Data::UUID;
my $ug = Data::UUID->new;
my %h0;
my %h1;
#!perl
while (1) {
my $o = bless {}, 'main';
test({});
$o->test;
}
sub test { &test2; }
sub test2 { ref($_[0]) && eval { $_[0]->isa(__PACKAGE__) }; }
@vovkasm
vovkasm / fix-perlbrew.patch
Created November 14, 2012 05:19
This may fix `perlbrew env` endless loop when some component in PERLBREW_ROOT is symlinks
diff --git a/lib/App/perlbrew.pm b/lib/App/perlbrew.pm
index 808a49f..c281399 100644
--- a/lib/App/perlbrew.pm
+++ b/lib/App/perlbrew.pm
@@ -7,6 +7,7 @@ our $VERSION = "0.57";
use Config;
use Capture::Tiny;
use Getopt::Long ();
+use Cwd 'realpath';
use File::Spec::Functions qw( catfile catdir );
@vovkasm
vovkasm / XS.pm
Last active December 10, 2015 04:18 — forked from anonymous/XS.pm
package X::XS;
# ... some other code (loading XS in my case)
our (%TRACE_PKGS,%TRACE_OBJS,$TRACE_FD);
if ($ENV{X_XS_TRACE}) {
enable_trace($ENV{X_XS_TRACE});
}
@vovkasm
vovkasm / storable-leaks.pl
Created July 5, 2013 11:23
leaks: 5.16 no leaks: 5.14
#!perl
{
package Test;
sub new { bless pop||{}, shift; }
sub STORABLE_freeze {
my ($self) = @_;
delete $self->{a};
@vovkasm
vovkasm / SnapshotHelper.h
Last active June 30, 2021 06:55
Objective C implementation of SnapshotHelper class for Fastline Snapshot tool (https://github.com/fastlane/fastlane/tree/master/snapshot).
/* This SnapshotHelper class should be compatible with SnapshotHelper.swift version 1.2 */
@import Foundation;
@import XCTest;
@interface SnapshotHelper : NSObject
- (instancetype)initWithApp:(XCUIApplication*)app;
- (void)snapshot:(NSString*)name waitForLoadingIndicator:(BOOL)wait;