Skip to content

Instantly share code, notes, and snippets.

View benvanstaveren's full-sized avatar

Ben van Staveren benvanstaveren

View GitHub Profile
# the 0x67 message def
$srv_msg->[0x67] = def_msg(0x67, 'Set Slot', [
pair(window_id => MC_byte),
pair(slot => MC_short),
slotupdate('slot_data'),
]);
# MC_byte and MC_short reader implementations
sub read_byte { return unpack('c', shift->read(1)) }
# somewhere the app has a 'mango' attribute that was set up like this:
# $app->attr(mango => sub { Mango->new('localhost') });
sub some_action {
my $self = shift;
$self->render_later;
$self->mango->db('mydb')->collection('baz')->find_one({ _id => $self->req->param('id') } => sub {
my ($coll, $err, $doc) = (@_);
if($err) {
$self->render(json => { error => $err });
#!/usr/bin/perl
use strict;
use warnings;
use Mojo::IOLoop;
my ($ip, $port, $status);
Mojo::IOLoop->client({ port => $port, address => $ip } => sub {
my ($loop, $error, $stream) = (@_);
[
{
"title" : "Technical Engineer: U.S.S.R.",
"id" : 127,
"ident" : "mechanicEngineer0"
},
{
"title" : "maxPiercingSeries",
"id" : 32,
"ident" : "maxPiercingSeries"