Skip to content

Instantly share code, notes, and snippets.

use POSIX ();
### shorter with POSIX::floor
sub _modf { my $t = POSIX::floor($_[0]); ($t, $_[0] - $t) }
### with optimization for the common case where argument is integer
sub _modf {
@aferreira
aferreira / CheckIP.pm
Last active May 22, 2017 19:15
My take on "How to write checkip.amazonaws.com service with Mojo?"
# Take a look at https://github.com/aferreira/acme-docker-checkip
package CheckIP;
use Mojo::Base 'Mojo';
use Mojolicious::Commands;
use Scalar::Util;
@aferreira
aferreira / rl.pl
Created February 8, 2017 22:34
Read lines from a file non-blocking while doing non-blocking operations
use Mojo::Base -strict;
use Mojo::IOLoop::LineReader;
use Mojo::UserAgent;
use Mojo::IOLoop;
use Data::Dump 'pp';
use File::Temp qw(tempfile :seekable);
sub run {

Keybase proof

I hereby claim:

  • I am aferreira on github.
  • I am adrianof (https://keybase.io/adrianof) on keybase.
  • I have a public key ASCXeYJakdjgz7FjvRoIoqF-Ffh4SWuWLgenGCwecbfr8Qo

To claim this, I am signing this object: