Skip to content

Instantly share code, notes, and snippets.

View sukria's full-sized avatar

ASK sukria

View GitHub Profile
use strict;
use warnings;
use Data::Dumper;
my $MAX_INT = 2 ** 16;
sub rand_boundary {
my ($min, $max) = @_;
my @possible_values = ($min .. $max);
return $possible_values[ int(rand(@possible_values)) ];
use strict;
use warnings;
use Test::More import => ['!pass'];
{
use Dancer;
use Dancer::Plugin::SiteMap;
get '/foo' => sub { 11 };
@sukria
sukria / gist:1315973
Created October 26, 2011 10:24
changelog Dancer 1.3.8
1.3080
[ ENHANCEMENTS ]
* PSGI handler code cleaned up (chromatic).
* Improved warning localizations (chromatic).
[ DOCUMENTATION ]
* Dancer::Plugins typos (Olof Johansson).
* PSGI handler documented (chromatic).
get '/' => sub {
stream => sub {
send 'foo'
sleep 0.5;
send 'bar';
sleep 0.5;
};
* 8abaca8 fix conflict (24 hours ago, franck cuny)
|\
| * 64ecdbd reflect changes + remove TABS (24 hours ago, franck cuny)
| * 2e57b5f remove ':syntax'; no more warnings (24 hours ago, franck cuny)
* | 84c9622 Merge branch 'feature/fix_pod_typo' into devel (24 hours ago, Sawyer X)
|\ \
| * | 5ca5d6f reflecting change (24 hours ago, Sawyer X)
| * | dac940d Fix typo in Dancer::Config's POD documentation. (24 hours ago, Stefan Horn
|/ /
* | f1e4ae1 Merge branch 'review/ambs-PR/dancer_response_rendering_files' into devel (
@sukria
sukria / dancr.pl
Created November 26, 2010 13:10
tutorial : a complete dancer app
use Dancer;
use DBI;
use File::Spec;
use File::Slurp;
use Template;
set 'database' => File::Spec->tmpdir() . '/dancr.db';
set 'session' => 'Simple';
set 'template' => 'template_toolkit';
set 'logger' => 'console';
require 'Spore'
local github = Spore.new_from_spec 'github.json'
github:enable 'Format.JSON'
github:enable 'Runtime'
local r = github:user_information{format = 'json', username = 'schacon'}
print(r.status) --> 200
# install Plack::Middleware::Debug and Dancer::Debug
# environments/development.yml
plack_middlewares:
Debug:
- panels
-
- Memory
- Dancer::Session
22:33 sri : yea, so much spare energy and it's too warm outside for sport!
22:35 sri : so far i'm not even digging deeper, just showing the obvious flaws most web developers knowing sinatra would see instantly
22:36 sri : ruby folks already understand that there are now multple *classes* of web frameworks optimized for different tasks
22:39 sri : marketing wise a public fight with dancer would be priceless
22:40 sri : it gives the impression that there are only two options if done right
22:40 sri : and we can't lose that fight ;)
22:42 sri : taking on catalyst would be more effective, but i don't think there is someone passionate enough about it
23:02 sri : even dancer folks are rather underwhelming, seems like they don't really stand behind their project
23:09 sri : me ranting also works well for the revolutionary image i have in mind for mojolicious :D
# app.pl
use Dancer;
use MyApp::Forum;
use MyApp:Home;
dance;
# lib/MyApp/Forum.pm
package MyApp::Forum;