This file contains 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
==> own_operator.pl <== | |
use strict; | |
use warnings; | |
use feature qw(signatures say); | |
use RxPerl::IOAsync ':all'; | |
use Mojo::Util qw(trim); | |
use IO::Async::Loop; | |
use DDP; | |
my $loop = IO::Async::Loop->new; |
This file contains 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
# DbConnection | |
package DbConnection { | |
use Mojo::Base -base, -strict, -signatures; | |
use RxPerl::Mojo ':all'; | |
use Mojo::Pg; | |
use DDP; | |
has is_closed => 0; | |
has connection => undef; | |
has pg => sub { die 'need pg url' }; |
This file contains 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 feature qw(signatures); | |
my $fact = sub ($n) { | |
return 1 if $n == 0; | |
return $n * __SUB__->($n - 1); | |
}; | |
my $paths = sub ($h) { | |
return '' unless ref $h; |
This file contains 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 warnings; | |
use strict; | |
package App::Model::Product { | |
use Mojo::Base 'Mojo::EventEmitter', -strict, -signatures; | |
use Data::Fake qw/Core Names Text Dates/; | |
our %generated; | |
has [qw(name image description price id)]; | |
has _fake_data => sub ($self) { |
This file contains 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
1. Brugnara T. tbrugz/ribge. 2024. | |
2. Editorial E. O que determina o consumo de frutas, verduras e legumes dos brasileiros? Determinantes Sociais da Saúde. 2012. https://dssbr.ensp.fiocruz.br/o-que-determina-o-consumo-de-frutas-verduras-e-legumes-dos-brasileiros/. Accessed 6 May 2024. | |
3. Acessar Dados do IBGE no R: Um pacote incrível. 2020. | |
4. Riederer YX Christophe Dervieux, Emily. 4.5 Bibliographies and citations | R Markdown Cookbook. | |
5. Rocha L. Consumo de verduras e legumes permanece baixo no Brasil, alerta pesquisa. CNN Brasil. https://www.cnnbrasil.com.br/saude/consumo-de-verduras-e-legumes-permanece-baixo-no-brasil-alerta-pesquisa/. Accessed 6 May 2024. | |
6. Souza BBD, Cembranel F, Hallal ALC, d’Orsi E. Consumo de frutas, legumes e verduras e associação com hábitos de vida e estado nutricional: um estudo prospectivo em uma coorte de idosos. Ciênc saúde coletiva. 2019;24:1463–72. | |
7. Verly Junior E, Oliveira DCRSD, Sichieri R. Custo de uma alimentação saudável e culturalmente aceitável no Brasil em 2009 e |
This file contains 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
# JavaScript translation of a simple generator example, where pagination | |
# technique is necessary in order to process a big list of itens, possibly in | |
# async manner. | |
# | |
# The JS code was generated by ChatGPT | |
# ../../GPT/Questions/generators_and_iterators_js.md | |
# we translate this js example to a Perl version | |
use Mojo::Base -strict, -signatures, -async_await; | |
sub chunkGenerator($data, $chunkSize) { |
This file contains 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 v5.28; | |
use Mojo::Base -strict, -async_await, -signatures; | |
use Mojo::Promise; | |
=pod | |
=head2 myTimer($time, sub { ... }); | |
myTimer(3 => sub { say "printed 3 seconds later" }); |
This file contains 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 strictures 2; | |
package TailEvent { | |
use Mojo::Base 'Mojo::EventEmitter', -strict, -signatures; | |
use IO::Async::FileStream; | |
has ioloop => sub { die "needs io loop" }; | |
has file => sub { die "needs a file" }; | |
has poll_interval => 0.5; | |
sub new_line($self, $line) { |
This file contains 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 v5.26; | |
use Object::Pad; | |
role GitRole { | |
use Git::Wrapper; | |
use Carp qw(carp croak); | |
use Syntax::Keyword::Try; | |
field $repo :reader = undef; |
This file contains 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 strictures 2; | |
use 5.030; | |
## no critic Perl::Critic::Policy::Modules::RequireFilenameMatchesPackage | |
package Calculator::Actions { | |
use Mojo::Base "Mojo::EventEmitter", -async_await, -signatures; | |
use List::Util qw< reduce >; | |
async sub Answer( $self, $MATCH_ref ) { |
NewerOlder