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 strict; | |
use warnings; | |
use utf8; | |
use Encode; | |
use Test::Mojo; | |
use Test::More; | |
use File::Basename; | |
use Mojo::Asset::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
use strict; | |
use warnings; | |
use utf8; | |
use Encode; | |
use Mojo::Server::Daemon; | |
use Test::More; | |
use Test::TCP; | |
use Mojo::UserAgent; | |
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
$ morbo script/myapp # Mojoliciousアプリの場合 | |
$ morbo myapp.pl # Mojolicious::Liteアプリの場合 |
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 strict; | |
use warnings; | |
use utf8; | |
use Test::More; | |
use Test::Mojo; | |
use File::Basename; | |
$ENV{MOJO_HOME} = dirname(__FILE__) . '/../'; | |
require "$ENV{MOJO_HOME}/myapp.pl"; |
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
JSON文字列に変換する + utf8フラグを外す |
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
#include <stdio.h> | |
int main() | |
{ | |
char buf[80]; | |
int a, b; | |
fgets(buf, 80, stdin); | |
sscanf(buf, "%d %d", &a, &b); |
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
# タイムアウト設定 | |
$poll->poll($timeout); | |
# Read OKとなったハンドルに対してコールバックを実行 | |
++$i and $self->_sandbox('Read', $self->{io}{fileno $_}{cb}, 0) | |
for $poll->handles(POLLIN | POLLPRI | POLLHUP | POLLERR); | |
# Write OKとなったハンドルに対してコールバックを実行 | |
++$i and $self->_sandbox('Write', $self->{io}{fileno $_}{cb}, 1) | |
for $poll->handles(POLLOUT); |
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 strict; | |
use warnings; | |
use File::Basename; | |
use Mojo::Server::Daemon; | |
use Test::TCP; | |
use Test::More; | |
use Test::Mojo; | |
my $t = Test::Mojo->new('SampleApp'); |
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 strict; | |
use warnings; | |
use POSIX qw( SIGKILL ); | |
my $TIMEOUT = 10; | |
my $cmd = "sleep 15"; | |
my $pid = fork(); | |
if (!defined($pid)) { die "failed to fork"; } | |
if ($pid == 0) { |
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
var is_array = function(value) { | |
return value && | |
typeof value === 'object' && | |
typeof value.length === 'number' && | |
typeof value.splice === 'function' && | |
!(value.propertyIsEnumerable('length')); | |
} | |
function parse_param(params) { | |
var build_hash; |
OlderNewer