-
-
Save valitnon/b1c0ae82d163cc1b9a085afa5e39c78a to your computer and use it in GitHub Desktop.
Revisions
-
jberger revised this gist
Oct 27, 2013 . 2 changed files with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -82,5 +82,5 @@ %= tag label => for => 'content' => 'Paste Content' %= text_area 'content', class => 'form-control' % end %= submit_button 'Paste' => class => 'btn btn-primary' % end This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -88,5 +88,5 @@ %= tag label => for => 'content' => 'Paste Content' %= text_area 'content', class => 'form-control' % end %= submit_button 'Paste' => class => 'btn btn-primary' % end -
jberger revised this gist
Oct 27, 2013 . 2 changed files with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -82,5 +82,5 @@ %= tag label => for => 'content' => 'Paste Content' %= text_area 'content', class => 'form-control' % end %= submit_button class => 'btn btn-primary' => 'Paste' % end This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -88,5 +88,5 @@ %= tag label => for => 'content' => 'Paste Content' %= text_area 'content', class => 'form-control' % end %= submit_button class => 'btn btn-primary' => 'Paste' % end -
jberger revised this gist
Oct 27, 2013 . 2 changed files with 4 additions and 14 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,14 +2,10 @@ use Mojolicious::Lite; use Mango; use Mango::BSON 'bson_oid'; helper mango => sub { state $mango = Mango->new($ENV{PASTEDB}) }; helper pastes => sub { shift->mango->db->collection('pastes') }; get '/' => 'submit'; @@ -19,7 +15,6 @@ my $content = $self->param('content') or return $self->redirect_to('/'); my $doc = { title => $title, content => $content, }; @@ -29,7 +24,7 @@ get '/:id' => sub { my $self = shift; my $id = bson_oid $self->stash('id'); my $doc = $self->pastes->find_one({ _id => $id }) or return $self->redirect_to('/'); $self->stash( doc => $doc ); This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,14 +2,10 @@ use Mojolicious::Lite; use Mango; use Mango::BSON 'bson_oid'; helper mango => sub { state $mango = Mango->new($ENV{PASTEDB}) }; helper pastes => sub { shift->mango->db->collection('pastes') }; get '/' => 'submit'; @@ -19,7 +15,6 @@ my $content = $self->param('content') or return $self->redirect_to('/'); my $doc = { title => $title, content => $content, }; @@ -32,7 +27,7 @@ get '/:id' => sub { my $self = shift; my $id = bson_oid $self->stash('id'); $self->render_later; $self->pastes->find_one({ _id => $id }, sub { my ($coll, $err, $doc) = @_; -
jberger revised this gist
Oct 13, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -39,7 +39,7 @@ return $self->redirect_to('/') if ( $err or not $doc ); $self->render( show => doc => $doc ); }); } => 'show'; app->start; -
jberger revised this gist
Oct 12, 2013 . 2 changed files with 18 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -59,10 +59,16 @@ % title $doc->{title}; % layout 'basic'; %= stylesheet begin pre.prettyprint { background-color:inherit; border:none; } % end %= tag h1 => $doc->{title} %= tag div => class => 'well' => begin %= tag pre => class => 'prettyprint' => begin <%= $doc->{content} =%> % end % end %= javascript 'https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js' @@ -82,4 +88,4 @@ %= text_area 'content', class => 'form-control' % end %= tag button => type => 'submit', class=>'btn btn-primary' => 'Paste' % end This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -65,10 +65,16 @@ % title $doc->{title}; % layout 'basic'; %= stylesheet begin pre.prettyprint { background-color:inherit; border:none; } % end %= tag h1 => $doc->{title} %= tag div => class => 'well' => begin %= tag pre => class => 'prettyprint' => begin <%= $doc->{content} =%> % end % end %= javascript 'https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js' @@ -88,4 +94,4 @@ %= text_area 'content', class => 'form-control' % end %= tag button => type => 'submit', class=>'btn btn-primary' => 'Paste' % end -
jberger revised this gist
Oct 12, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -39,7 +39,7 @@ return $self->redirect_to('/') if ( $err or not $doc ); $self->render( show => doc => $doc ); }); }; app->start; -
jberger created this gist
Oct 8, 2013 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,85 @@ #!/usr/bin/env perl use Mojolicious::Lite; use Mango; helper mango => sub { state $mango = Mango->new($ENV{PASTEDB}) }; helper pastes => sub { shift->mango->db->collection('pastes') }; helper count => sub { shift->pastes->find->count }; helper next => sub { state $count = shift->count || 0; return $count++; }; get '/' => 'submit'; post '/' => sub { my $self = shift; my $title = $self->param('title') || 'Untitled'; my $content = $self->param('content') or return $self->redirect_to('/'); my $doc = { _id => $self->next, title => $title, content => $content, }; my $oid = $self->pastes->save($doc); $self->redirect_to( show => id => "$oid" ); }; get '/:id' => sub { my $self = shift; my $id = $self->stash('id') + 0; my $doc = $self->pastes->find_one({ _id => $id }) or return $self->redirect_to('/'); $self->stash( doc => $doc ); } => 'show'; app->start; __DATA__ @@ layouts/basic.html.ep <!DOCTYPE html> <html> <head> <title><%= title =%></title> %= stylesheet '//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css' </head> <body> <div class="container"> <%= content =%> </div> </body> </html> @@ show.html.ep % title $doc->{title}; % layout 'basic'; %= tag h1 => $doc->{title} %= tag div => class => 'well' => begin %= tag code => class => 'prettyprint', style => 'background-color:inherit;' => begin %= $doc->{content} % end % end %= javascript 'https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js' @@ submit.html.ep % title 'Paste your content'; % layout 'basic'; %= form_for '/' => role => form => method => POST => begin %= tag div => class => 'form-group' => begin %= tag label => for => 'title' => 'Title' %= text_field 'title', class => 'form-control' % end %= tag div => class => 'form-group' => begin %= tag label => for => 'content' => 'Paste Content' %= text_area 'content', class => 'form-control' % end %= tag button => type => 'submit', class=>'btn btn-primary' => 'Paste' % end This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,91 @@ #!/usr/bin/env perl use Mojolicious::Lite; use Mango; helper mango => sub { state $mango = Mango->new($ENV{PASTEDB}) }; helper pastes => sub { shift->mango->db->collection('pastes') }; helper count => sub { shift->pastes->find->count }; helper next => sub { state $count = shift->count || 0; return $count++; }; get '/' => 'submit'; post '/' => sub { my $self = shift; my $title = $self->param('title') || 'Untitled'; my $content = $self->param('content') or return $self->redirect_to('/'); my $doc = { _id => $self->next, title => $title, content => $content, }; $self->render_later; $self->pastes->save($doc, sub { my ($coll, $err, $oid) = @_; $self->redirect_to( show => id => "$oid" ); }); }; get '/:id' => sub { my $self = shift; my $id = $self->stash('id') + 0; $self->render_later; $self->pastes->find_one({ _id => $id }, sub { my ($coll, $err, $doc) = @_; return $self->redirect_to('/') if ( $err or not $doc ); $self->render( show => doc => $doc ); }); } => 'show'; app->start; __DATA__ @@ layouts/basic.html.ep <!DOCTYPE html> <html> <head> <title><%= title =%></title> %= stylesheet '//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css' </head> <body> <div class="container"> <%= content =%> </div> </body> </html> @@ show.html.ep % title $doc->{title}; % layout 'basic'; %= tag h1 => $doc->{title} %= tag div => class => 'well' => begin %= tag code => class => 'prettyprint', style => 'background-color:inherit;' => begin %= $doc->{content} % end % end %= javascript 'https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js' @@ submit.html.ep % title 'Paste your content'; % layout 'basic'; %= form_for '/' => role => form => method => POST => begin %= tag div => class => 'form-group' => begin %= tag label => for => 'title' => 'Title' %= text_field 'title', class => 'form-control' % end %= tag div => class => 'form-group' => begin %= tag label => for => 'content' => 'Paste Content' %= text_area 'content', class => 'form-control' % end %= tag button => type => 'submit', class=>'btn btn-primary' => 'Paste' % end