Skip to content

Instantly share code, notes, and snippets.

@ssoriche
ssoriche / gist:1835649
Created February 15, 2012 13:24
undef attribute passed to Constructor causing an exception with MooseX::UndefTolerant
#!/usr/bin/env perl
use v5.12;
use Test::More tests => 2;
{
package Foo;
use Moose;
@ssoriche
ssoriche / gist:2067623
Created March 18, 2012 01:41
Test whether object is of a class that MooseX::UndefTolerant is used
use strict;
use warnings;
use v5.12;
use Test::More;
{
package Foo;
use Moose;
use MooseX::Constructor::AllErrors;
@ssoriche
ssoriche / tag_helper_app.t.results
Created April 7, 2012 20:11
tag helper failures when testing lite app tests with full app
[Sat Apr 7 16:08:50 2012] [debug] Your secret passphrase needs to be changed!!!
[Sat Apr 7 16:08:50 2012] [debug] OPTIONS /tags (Mojolicious (Perl)).
[Sat Apr 7 16:08:50 2012] [debug] Routing to "MojoliciousTest::Tags->index".
[Sat Apr 7 16:08:50 2012] [debug] MojoliciousTest::Tags does not exist, maybe a typo?
[Sat Apr 7 16:08:51 2012] [debug] Rendering template "tags/index.html.ep" from DATA section.
[Sat Apr 7 16:08:51 2012] [debug] 200 OK (0.008543s, 117.055/s).
[Sat Apr 7 16:08:51 2012] [debug] PATCH /more_tags (Mojolicious (Perl)).
[Sat Apr 7 16:08:51 2012] [debug] Routing to "MojoliciousTest::MoreTags->index".
[Sat Apr 7 16:08:51 2012] [debug] MojoliciousTest::MoreTags does not exist, maybe a typo?
[Sat Apr 7 16:08:51 2012] [debug] Rendering template "more_tags/index.html.ep" from DATA section.
@ssoriche
ssoriche / gist:2333098
Created April 8, 2012 00:22
Test Template Failure - Lite vs not
Test:
$t->get_ok('/links')->status_is(200)->content_is(<<EOF);
<a href="/path">Pa&lt;th</a>
<a href="http://example.com/" title="Foo">Foo</a>
<a href="http://example.com/"><foo>Example</foo></a>
<a href="/links">Home</a>
<a href="/form/23" title="Foo">Foo</a>
EOF
@ssoriche
ssoriche / gist:2337755
Created April 8, 2012 15:03
Failing Hash Ref Tag Helper
use Test::More tests => 72;
use Test::Mojo;
{
package Foo;
use Mojo::Base 'Mojolicious';
sub startup {
my $self = shift;
my $r = $self->routes;
@ssoriche
ssoriche / gist:2338286
Created April 8, 2012 16:24
checked check_box set from stash or param.
use Test::More tests => 3;
use Test::Mojo;
{
package Foo;
use Mojo::Base 'Mojolicious';
sub startup {
my $self = shift;
my $r = $self->routes;
@ssoriche
ssoriche / planetsnu.js
Created May 13, 2012 00:27
Compressed JSON accessed via node.js
var http = require('http');
var options = {
host: 'api.planets.nu',
port: 80,
path: '/game/loadinfo?gameid=815',
headers: {
"Accept-Encoding": "gzip"
}
};
@ssoriche
ssoriche / gist:2704810
Created May 15, 2012 20:19
Bridges with Parameters in Mojolicious.
#!/usr/bin/env perl
use Mojolicious::Lite;
# Documentation browser under "/perldoc"
plugin 'PODRenderer';
get '/' => sub {
my $self = shift;
$self->render('index');
};
@ssoriche
ssoriche / pr.md
Created August 15, 2012 12:15 — 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 = git@github.com: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:

@ssoriche
ssoriche / gist:3759458
Created September 21, 2012 02:37 — forked from jeserkin/gist:1953801
Twitter Bootstrap Fluid-Sticky example. Modified martinbean example.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Bootstrap, from Twitter</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link href="../assets/css/bootstrap.css" rel="stylesheet">
<style type="text/css">