Skip to content

Instantly share code, notes, and snippets.

View b-abctech's full-sized avatar

Pussaaon b-abctech

  • abc-tech thailand
  • Bangkok
View GitHub Profile
@b-abctech
b-abctech / gist:7931035
Created December 12, 2013 16:41
Simple sample to create template plugins
# this example based on module to do html/text truncate
# the Template plugin package
package Template::Plugin::TextTruncater;
use warnings;
use strict;
use utf8;
use DateTime;
@b-abctech
b-abctech / gist:7481717
Created November 15, 2013 09:38
comparing elastic search query between specific range of date and using *
# ------------- using * ---------------------
POST /logstash-*/_search
{
"query": {
"filtered": {
"query": {
"match_phrase": {
"@fields.request": "/sok/google"
}
},
########################### config yml ###########################
---
name: SearchResponsive::EchoSlam
EchoSlam:
my_config:
channel_name: 'my_config_yml_channel'
########################### model ###########################
package SearchResponsive::EchoSlam;
use Moose;
for my $method (qw(build_date bought_date)) {
Sub::Install::install($_ => sub {
my ($self, $input_arg) = @_;
return format_string($self->$method);
});
}
sub apejens {}
@b-abctech
b-abctech / RomanConverter
Created May 13, 2013 10:10
Can't locate object method "ROMANS_TO_NUMBERS" via package "RomanConverter" at line 93
package RomanConverter;
use Moose;
use POSIX qw(floor);
use String::Util qw(trim);
use v5.10;
has 'NUMBERS_TO_ROMANS' => (
is => 'bare' ,
isa => 'Tree' ,
weak_ref => 1 ,
#!/usr/bin/perl -w
use strict;
use CGI qw(:all);
use CGI::Carp qw(fatalsToBrowser);
my($requested_color, $old_color, $color_cookie) = ("","");
$old_color="blue"; # Default value
# Is there a new color requested?
if(defined param('color')) {
$requested_color = param('color');
}