Skip to content

Instantly share code, notes, and snippets.

View kraih's full-sized avatar

Sebastian Riedel kraih

View GitHub Profile
use Mojolicious::Lite;
use EV;
use AnyEvent;
use AnyEvent::Util;
get '/' => sub {
my $self = shift;
# Run Perl oneliner in separate process and capture STDOUT
fork_call {
package Test;
use Mojo::Base -base;
sub foo : lvalue { shift->{foo} }
package main;
use Mojo::Base -strict;
my $test = Test->new;
$test->foo = 'works!';
$ heroku login
...
$ mkdir hellomojo
$ cd hellomojo
$ touch myapp.pl
$ chmod +x myapp.pl
$ touch Makefile.PL
$ touch Perloku
$ chmod +x Perloku
#!/usr/bin/env perl
use Mojolicious::Lite;
get '/' => {text => 'Hello Mojo!'};
app->start;
#!/usr/bin/env perl
use ExtUtils::MakeMaker;
WriteMakefile(
PREREQ_PM => {'Mojolicious' => '2.98'}
);
#!/bin/sh
./myapp.pl daemon -l http://*:$PORT -m production
$ git init
$ git add .
$ git commit -m 'Initial version'
$ heroku create -s cedar --buildpack http://github.com/judofyr/perloku.git
$ git push heroku master
...
@kraih
kraih / a.pl
Created June 9, 2012 22:07 — forked from tempire/a.pl
use Mojo::UserAgent;
use Modern::Perl;
my $ua = Mojo::UserAgent->new;
my $delay = Mojo::IOLoop->delay;
$delay->begin;
$ua->get(
'tempi.re/ip' => sub {
warn Mojo::UserAgent->new->get('tempi.re/ip')->res->body;
@kraih
kraih / pr.md
Created August 23, 2012 15:57 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: