Skip to content

Instantly share code, notes, and snippets.

View TristinDavis's full-sized avatar

Tristin Davis TristinDavis

  • Thrivent Financial
  • Arkansas, USA
  • 06:53 (UTC -06:00)
View GitHub Profile
@sharifulin
sharifulin / lj_export.pl
Created August 8, 2011 09:51
Export LJ posts to MongoDB using Mojolicious
#!/usr/bin/env perl
use common::sense;
use Mojo::IOLoop;
use Mojo::UserAgent;
use MongoDB;
use Data::Dumper;
my $ua = Mojo::UserAgent->new;
#!/usr/bin/env perl
use Mojolicious::Lite;
use Test::Mojo;
use Test::More tests => 2;
get '/first' => sub {
shift->redirect_to('second');
};
package WWW::FGen;
use WWW::Mechanize;
# constructor
sub new {
my $class = shift;
return bless {
_mechanize => WWW::Mechanize->new( agent => 'Perl of Love' ),
_url => 'http://mendel.cs.rhul.ac.uk/mendel.php?topic=fgen-file',
#!/usr/bin/env perl
# put.t
use Test::More tests => 3;
use Mojolicious::Lite;
use Test::Mojo;
$ENV{MOJO_MAX_MEMORY_SIZE} = 2; # Force temp files.
$ENV{MOJO_TMPDIR} = "/nosuchdir"; # test setting tempdir dynamically
#!/usr/bin/env perl
use Mojolicious::Lite;
use Coro;
use Mojo::IOLoop;
Mojo::IOLoop->recurring(0 => sub {cede});
hook around_dispatch => sub {
my $next = shift;
async { $next->() };
use Mojolicious::Lite;
use EV;
use IO::Async::Process;
use IO::Async::Loop::EV;
my $loop = IO::Async::Loop::EV->new;
get '/' => sub {
my $self = shift;
@larrybotha
larrybotha / A.markdown
Last active December 28, 2022 19:00
Monokai Sidebar Theme | Sublime Text

Sublime Text Monokai Sidebar Theme

A theme for the sidebar in Sublime Text to match the workspace of the Monokai theme.

This theme only modifies the sidebar to better match the Monokai theme, without modifying any of the styling elsewhere defined by Monokai.

File location: Packages/User

For a theme that extends beyond just the sidebar, visit https://gist.github.com/umpirsky/5842174

@dvinciguerra
dvinciguerra / index.pl
Created August 24, 2012 17:09
Mojolicious::Lite and Ajax Example
#!/usr/bin/env perl
use DateTime;
use Mojolicious::Lite;
get '/' => 'index';
get '/service/datetime' => sub {
my $self = shift;
my $dt = DateTime->now;
#!/usr/bin/perl
use Mojolicious::Lite;
get '/' => { message => '' } => 'index';
post '/' => sub {
my $self = shift;
# getting params
my $email = $self->param('email') || '';
Event Driven Programming
- no blocking
- no polling
- no sleeping
- events and callbacks
- inotify vs stat
- sleep vs timers
- web services