Skip to content

Instantly share code, notes, and snippets.

View sukria's full-sized avatar

ASK sukria

View GitHub Profile
<script>
// returns the node, given its name, null if not found
function get_node_by_name(name, bigfish) {
for (var lookup in bigfish["nodes"]) {
if (lookup["name"] == name) {
return lookup;
}
}
return null;
@sukria
sukria / epub-converter.pl
Last active August 29, 2015 14:17
epub to mobi converter
#!/usr/bin/env perl -W
use strict;
use warnings;
use File::Spec;
foreach (<*.epub>) {
my $epub_file = $_;
my $mobi_file = $epub_file;
$mobi_file =~ s/\.epub/\.mobi/;
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