Skip to content

Instantly share code, notes, and snippets.

View akzhan's full-sized avatar

Akzhan Abdulin akzhan

View GitHub Profile
@akzhan
akzhan / Model.pm
Last active June 21, 2017 08:42
use JSON schema to validate params
sub update {
my $self = shift;
my $data = $self->req->json;
return $self->render(
json => {
success => \0,
error => "No data provided",
}
) unless $data;
@akzhan
akzhan / license-badges.md
Last active May 12, 2017 17:00 — forked from lukas-h/license-badges.md
License Badges for your Project

Markdown License badges

Collection of License badges for your Project's README file.
This list includes the most common open source and open data licenses.
Easily copy and paste the code under the badges into your Markdown files.

Notes

  • Badges are made with Shields.io.
  • This badges do not fully replace the license informations for your projects, they are only emblems for the README, that the user can see the License at first glance.  
  • 🇫🇷 Cette liste en français
@akzhan
akzhan / moose_dynamic.pl
Last active April 19, 2017 08:05
moose dynamic
package Cat;
use Moose;
package Generator;
use Mouse::Meta::Class;
use Mouse::Meta::Attribute;
sub generate {
my $siberian = Mouse::Meta::Class->create('Siberian');
@akzhan
akzhan / Redis.pm
Last active April 18, 2017 09:20
Simple Redis client module
package YourCompany::Util::Redis;
use YourCompany::Perl;
use YourCompany::Config ();
BEGIN {
require parent;
eval {
parent->import( 'Redis::Fast' );
@akzhan
akzhan / .perlcriticrc
Last active April 4, 2017 13:48
YourCompany Perl Prologue
include = BuiltinFunctions::ProhibitBooleanGrep BuiltinFunctions::ProhibitStringyEval BuiltinFunctions::ProhibitStringySplit BuiltinFunctions::ProhibitUniversalCan BuiltinFunctions::ProhibitUniversalIsa ClassHierarchies::ProhibitExplicitISA CodeLayout::ProhibitHardTabs ControlStructures::ProhibitMutatingListFunctions ControlStructures::ProhibitUnreachableCode ErrorHandling::RequireCarping InputOutput::ProhibitBarewordFileHandles InputOutput::RequireCheckedClose InputOutput::RequireCheckedOpen InputOutput::RequireCheckedSyscalls InputOutput::ProhibitInteractiveTest InputOutput::ProhibitOneArgSelect InputOutput::ProhibitTwoArgOpen Miscellanea::ProhibitFormats Modules::ProhibitEvilModules Modules::RequireEndWithOne Objects::ProhibitIndirectSyntax Policy::TestingAndDebugging::RequireUseStrict Policy::TestingAndDebugging::RequireUseWarnings RegularExpressions::ProhibitCaptureWithoutTest Subroutines::ProhibitBuiltinHomonyms Subroutines::ProhibitReturnSort Subroutines::ProhibitSubroutinePrototypes Subroutines::Prohi
package BUX::Util::JSON;
=encoding utf-8
=head1 NAME
BUX::Util::JSON
=head1 SYNOPSYS
@akzhan
akzhan / JSONColumn.pm
Created December 28, 2016 12:16
BUX::Util::JSONColumn for DBIx::Class
package BUX::Util::JSONColumn;
use strict;
use warnings;
use utf8;
use JSON::XS ();
use Encode qw( encode_utf8 decode_utf8 );
sub register_column {
@akzhan
akzhan / HashRefInflator.pm
Created July 5, 2016 13:32
HashRefInflator that knows about utf8
package BUX::DB::HashRefInflator;
use strict;
use warnings;
use utf8;
use parent qw( DBIx::Class::ResultClass::HashRefInflator );
sub inflate_result {
my ( $self, @args ) = @_;
use JSON::XS ();
use DBIx::Class::ResultClass::HashRefInflator;
my $jsoner = JSON::XS->new->utf8(0)->allow_blessed;
sub country {
my $self = shift;
my $c = schema->resultset('Country')->search(undef, {
result_class => 'DBIx::Class::ResultClass::HashRefInflator',
@akzhan
akzhan / habraproxy.py
Last active June 23, 2016 12:52 — forked from anonymous/habraproxy.py
just for fun, not tested :)
# habraproxy.py — это простейший http-прокси-сервер, запускаемый локально (порт на ваше
# усмотрение), который показывает содержимое страниц Хабра. С одним исключением: после
# каждого слова из шести букв должен стоять значок «™». Примерно так:
#
# http://habrahabr.ru/company/yandex/blog/258673/
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# Сейчас на фоне уязвимости Logjam все в индустрии в очередной раз обсуждают проблемы и
# особенности TLS. Я хочу воспользоваться этой возможностью, чтобы поговорить об одной из
# них, а именно — о настройке ciphersiutes.
#