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 / 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};
Sampling process 25086 for 3 seconds with 1 millisecond of run time between samples
Sampling completed, processing symbols...
Analysis of sampling ruby (pid 25086) every 1 millisecond
Process: ruby [25086]
Path: /usr/local/Cellar/ruby/2.4.3_1/bin/ruby
Load Address: 0x10646e000
Identifier: ruby
Version: 0
Code Type: X86-64
Parent Process: zsh [15045]
import React from 'react'
import { Keyboard, LayoutAnimation, View } from 'react-native'
class KeyboardSpacer extends React.Component {
constructor (props, ctx) {
super(props, ctx)
this.subscriptions = []
this.state = {
height: 0,
}