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 Mojolicious::Lite; | |
use Mojo::EventEmitter; | |
helper events => sub { state $events = Mojo::EventEmitter->new }; | |
get '/' => 'chat'; | |
websocket '/channel' => sub { | |
my $c = shift; |
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
// Bad | |
"Your Framework Sucks." | |
// Bad | |
"Browserify? Have you heard about WebPack?" | |
// Bad | |
"Ember vs Angular: 10 Things You Should Know" |
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
#!/bin/csh | |
# Get the name of this script | |
if ( $?_ ) then | |
# With tcsh the name of the file being sourced is available in | |
# $_. | |
set script_name = `basename $_` | |
else | |
# Fall back to $0 which, sometimes, will be the name of the |
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
package Minion::Backend::Storable; | |
use Mojo::Base 'Minion::Backend'; | |
use Sys::Hostname 'hostname'; | |
use Time::HiRes 'time'; | |
sub new { shift->SUPER::new(file => shift) } | |
sub register_worker { | |
my $guard = shift->_guard; |
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
#!/usr/bin/env perl | |
=pod | |
Using Mojolicious and L<MCE> for forked independant workers, | |
communicating via L<MCE::Queue>. | |
Run this with C<./mce_mojolicious.pl daemon>, then visit C<http://localhost:3000>. | |
There are 4 queues: |
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
#!/usr/bin/env perl | |
package Mojo::URLQueue; | |
use Mojo::Base 'Mojo::EventEmitter'; | |
use Mojo::UserAgent; | |
has queue => sub { [] }; | |
has ua => sub { Mojo::UserAgent->new(max_redirects => 5) }; | |
has concurrency => 4; |
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
on check_file(filename) | |
tell application "Finder" | |
if exists filename then | |
return "yes" | |
else | |
return "no" | |
end if | |
end tell | |
end check_file |
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
AddHandler cgi-script .pl | |
Options +ExecCGI | |
IndexIgnore * | |
DirectoryIndex script.pl | |
RewriteEngine on |