EOL: remove trailing whitespace.

master
Matt Miller 2014-10-28 20:36:15 +02:00
parent dfcf39f650
commit da70710f7d
129 changed files with 712 additions and 712 deletions

View File

@ -30,7 +30,7 @@ handle remainder => sub {
my $query = $_; my $query = $_;
# split the query on whitespace and rm whitespace # split the query on whitespace and rm whitespace
my @words = grep { length } split /\s+/, $query; my @words = grep { length } split /\s+/, $query;
return if query_is_malformed(@words); return if query_is_malformed(@words);
@ -48,7 +48,7 @@ handle remainder => sub {
return $choices[$index]." (random)"; return $choices[$index]." (random)";
}; };
# The query must look like # The query must look like
# '<choice> or <choice> or <choice>' # '<choice> or <choice> or <choice>'
# #
# Note this method also prevents choices from being > 1 word long as this # Note this method also prevents choices from being > 1 word long as this

View File

@ -34,7 +34,7 @@ my %eras = (
handle query_parts => sub { handle query_parts => sub {
# Ignore single word queries # Ignore single word queries
return unless scalar(@_) > 1; return unless scalar(@_) > 1;
if ($_ =~ /^(.*\b)(meiji|taisho|taishou|showa|shouwa|heisei|juche|minguo)\s+(\d*[1-9]\d*)(\b.*)$/i) { if ($_ =~ /^(.*\b)(meiji|taisho|taishou|showa|shouwa|heisei|juche|minguo)\s+(\d*[1-9]\d*)(\b.*)$/i) {
my $era_name = ucfirst($2); my $era_name = ucfirst($2);
my $era_year = $3; my $era_year = $3;
@ -42,18 +42,18 @@ handle query_parts => sub {
my $result = $1.$year.$4; my $result = $1.$year.$4;
my $wiki = 'https://en.wikipedia.org/wiki/'; my $wiki = 'https://en.wikipedia.org/wiki/';
my $answer; my $answer;
if ($result =~ /^[0-9]{4}$/) { if ($result =~ /^[0-9]{4}$/) {
$answer = "$era_name $era_year is equivalent to $year in the Gregorian Calendar"; $answer = "$era_name $era_year is equivalent to $year in the Gregorian Calendar";
} else { } else {
$answer = "$result ($era_name $era_year is equivalent to $year in the Gregorian Calendar)"; $answer = "$result ($era_name $era_year is equivalent to $year in the Gregorian Calendar)";
} }
my $answer_html = $answer.'<br><a href="'.$wiki.$eras{$era_name}[1].'">More at Wikipedia</a>'; my $answer_html = $answer.'<br><a href="'.$wiki.$eras{$era_name}[1].'">More at Wikipedia</a>';
return $answer, html => $answer_html; return $answer, html => $answer_html;
}; };
return ; return ;
}; };

View File

@ -16,7 +16,7 @@ zci answer_type => "ascii_conversion";
zci is_cached => 1; zci is_cached => 1;
handle remainder => sub { handle remainder => sub {
my $ascii = pack("B*", $1) if /^(([0-1]{8})*)\s+(in|to)$/; my $ascii = pack("B*", $1) if /^(([0-1]{8})*)\s+(in|to)$/;
return "$1 in binary is \"$ascii\" in ASCII" if $ascii; return "$1 in binary is \"$ascii\" in ASCII" if $ascii;
return; return;
}; };

View File

@ -23,7 +23,7 @@ handle remainder => sub {
if ($_) { if ($_) {
my $char; my $char;
my $result; my $result;
while (/(.)/g) { while (/(.)/g) {
if ($1 =~ /([a-z])/) { if ($1 =~ /([a-z])/) {
# Substitute lowercase characters # Substitute lowercase characters
@ -36,7 +36,7 @@ handle remainder => sub {
else { $char = $1; } else { $char = $1; }
$result .= $char; $result .= $char;
} }
return "Atbash: $result"; return "Atbash: $result";
} }
return; return;

View File

@ -52,7 +52,7 @@ handle remainder => sub {
@nums = sort { $a <=> $b } @nums; @nums = sort { $a <=> $b } @nums;
my $med; my $med;
if ($len % 2 eq 0) { if ($len % 2 eq 0) {
# get the two middle numbers, since the # get the two middle numbers, since the
# length is even, and calculate their mean # length is even, and calculate their mean
$med = ($nums[$len/2] + $nums[$len/2-1])/2; $med = ($nums[$len/2] + $nums[$len/2-1])/2;
} else { } else {

View File

@ -37,7 +37,7 @@ handle remainder => sub {
$str = decode( "UTF-8", $str ); $str = decode( "UTF-8", $str );
chomp $str; chomp $str;
return "Base64 decoded: $str"; return "Base64 decoded: $str";
} }
else { else {
$str = encode_base64( encode( "UTF-8", $str ) ); $str = encode_base64( encode( "UTF-8", $str ) );

View File

@ -78,22 +78,22 @@ handle remainder => sub {
return unless ($op && $right_arg); return unless ($op && $right_arg);
return unless $if_description{$op}; return unless $if_description{$op};
my $text_output = $if_description{$op}; my $text_output = $if_description{$op};
$text_output =~ s/^true/false/ if $not; $text_output =~ s/^true/false/ if $not;
my $html_output = html_enc($text_output); my $html_output = html_enc($text_output);
my $html_right_arg = html_enc($right_arg); my $html_right_arg = html_enc($right_arg);
if ($left_arg) { if ($left_arg) {
my $html_left_arg = html_enc($left_arg); my $html_left_arg = html_enc($left_arg);
$text_output =~ s/ARG1/$left_arg/g; $text_output =~ s/ARG1/$left_arg/g;
$html_output =~ s/ARG1/<pre>$html_left_arg<\/pre>/g; $html_output =~ s/ARG1/<pre>$html_left_arg<\/pre>/g;
} }
$text_output =~ s/ARG2/$right_arg/g; $text_output =~ s/ARG2/$right_arg/g;
$html_output =~ s/ARG2/<pre>$html_right_arg<\/pre>/g; $html_output =~ s/ARG2/<pre>$html_right_arg<\/pre>/g;
my $intro = "The Bash expression <pre>" . html_enc($_) . "</pre> results to"; my $intro = "The Bash expression <pre>" . html_enc($_) . "</pre> results to";
return "$intro $text_output.", html => "$intro $html_output.", heading => html_enc($_) . " (Bash)"; return "$intro $text_output.", html => "$intro $html_output.", heading => html_enc($_) . " (Bash)";
}; };

View File

@ -13,7 +13,7 @@ triggers query_raw => qr/not\s+.*/;
triggers query_raw => qr/¬.*/; triggers query_raw => qr/¬.*/;
zci is_cached => 1; zci is_cached => 1;
zci answer_type => "binary_logic"; zci answer_type => "binary_logic";
attribution attribution
github => ['https://github.com/MithrandirAgain', 'MithrandirAgain'], github => ['https://github.com/MithrandirAgain', 'MithrandirAgain'],
@ -21,8 +21,8 @@ attribution
twitter => ['https://twitter.com/Prypjat', 'Bjoern Paschen']; twitter => ['https://twitter.com/Prypjat', 'Bjoern Paschen'];
primary_example_queries '4 xor 5', '3 and 2', '1 or 1234'; primary_example_queries '4 xor 5', '3 and 2', '1 or 1234';
secondary_example_queries secondary_example_queries
'9489 xor 394 xor 9349 xor 39 xor 29 xor 4967 xor 3985', '9489 xor 394 xor 9349 xor 39 xor 29 xor 4967 xor 3985',
'10 and 12', '10 and 12',
'34 or 100', '34 or 100',
'10 and (30 or 128)', '10 and (30 or 128)',
@ -46,7 +46,7 @@ Term ::=
| Term 'and' Term action => do_and | Term 'and' Term action => do_and
| Term 'or' Term action => do_or | Term 'or' Term action => do_or
Number ::= Number ::=
HexNumber action => hex_number HexNumber action => hex_number
| HexNumberCaps action => hex_number | HexNumberCaps action => hex_number
| BinaryNumber action => binary_number | BinaryNumber action => binary_number
@ -104,7 +104,7 @@ handle query_raw => sub {
my $input = $_; my $input = $_;
# Substitute the unicode characters. The parser does not seem to # Substitute the unicode characters. The parser does not seem to
# like unicode. # like unicode.
$input =~ s/⊕/ xor /; $input =~ s/⊕/ xor /;
$input =~ s/∧/ and /; $input =~ s/∧/ and /;

View File

@ -16,7 +16,7 @@ topics 'special_interest', 'entertainment';
category 'random'; category 'random';
attribution github => [ 'https://github.com/austinheimark', 'austin_heimark' ]; attribution github => [ 'https://github.com/austinheimark', 'austin_heimark' ];
my %birthstones = ( my %birthstones = (
"january" => "Garnet", "january" => "Garnet",
"february" => "Amethyst", "february" => "Amethyst",
"march" => "Aquamarine", "march" => "Aquamarine",

View File

@ -6,7 +6,7 @@ use DDG::Goodie;
use strict; use strict;
use warnings; use warnings;
triggers startend => 'donor compatibility', 'donor', 'donors for', triggers startend => 'donor compatibility', 'donor', 'donors for',
'blood donor', 'blood donors for', 'blood donor for', 'blood donor', 'blood donors for', 'blood donor for',
'blood type', 'blood compatibility', 'compatibility', 'blood donor compatibility'; 'blood type', 'blood compatibility', 'compatibility', 'blood donor compatibility';
@ -43,7 +43,7 @@ handle remainder => sub {
my @criticalResults = (); my @criticalResults = ();
return unless defined $typeMap{$type}; return unless defined $typeMap{$type};
# ideally same Rh # ideally same Rh
foreach our $donorType (split(",", $typeMap{$type})) { foreach our $donorType (split(",", $typeMap{$type})) {
push(@idealResults, $donorType . $rh); push(@idealResults, $donorType . $rh);
@ -55,20 +55,20 @@ handle remainder => sub {
my $output = ''; my $output = '';
my $html = "<table class='blooddonor'>"; my $html = "<table class='blooddonor'>";
my $idealStr = join(' or ', @idealResults); my $idealStr = join(' or ', @idealResults);
my $criticalStr = join(' or ', @criticalResults); my $criticalStr = join(' or ', @criticalResults);
$output .= "Ideal donor: " . uc($_) . "\n"; $output .= "Ideal donor: " . uc($_) . "\n";
$output .= "Other donors: " . $idealStr . "\n"; $output .= "Other donors: " . $idealStr . "\n";
$html .= table_data("Ideal donor:", uc($_)); $html .= table_data("Ideal donor:", uc($_));
$html .= table_data("Other donors:", $idealStr); $html .= table_data("Other donors:", $idealStr);
if($rh eq '+') { if($rh eq '+') {
$output .= "Only if no Rh(+) found: " . $criticalStr . "\n"; $output .= "Only if no Rh(+) found: " . $criticalStr . "\n";
$html .= table_data("<i>Only if</i> no Rh(+) found:", $criticalStr); $html .= table_data("<i>Only if</i> no Rh(+) found:", $criticalStr);
} }
$html .= '</table>'; $html .= '</table>';
return $output, html => $html, heading => "Donors for blood type ".uc($_); return $output, html => $html, heading => "Donors for blood type ".uc($_);
} }

View File

@ -21,21 +21,21 @@ zci answer_type => 'root';
handle query => sub { handle query => sub {
# The 'root' trigger is very ambigous so this regex provides the specific triggers # The 'root' trigger is very ambigous so this regex provides the specific triggers
return unless m/^((?:.*square|.*cube(?:d|)|.*th|.*rd|.*nd|.*st|.*[0-9]+)) root(?: of|) (?!of)(.*)/i; return unless m/^((?:.*square|.*cube(?:d|)|.*th|.*rd|.*nd|.*st|.*[0-9]+)) root(?: of|) (?!of)(.*)/i;
# Common phrases that won't be caught by str2nbr() # Common phrases that won't be caught by str2nbr()
my %function = ( my %function = (
'square' => 2, 'square' => 2,
'cubed' => 3, 'cubed' => 3,
'cube' => 3, 'cube' => 3,
); );
# Seperate the exponent and base courtesy of the above regex # Seperate the exponent and base courtesy of the above regex
my $exp = $1; my $exp = $1;
my $base = $2; my $base = $2;
# Figure out what number the exponent is # Figure out what number the exponent is
if ($exp =~ m/negative\s|minus\s|\A-/i) { if ($exp =~ m/negative\s|minus\s|\A-/i) {
$exp = $function{$'} ? $function{$'} * -1 : str2nbr($') * -1; $exp = $function{$'} ? $function{$'} * -1 : str2nbr($') * -1;
} }
else { else {
$exp = $function{$exp} ? $function{$exp} : str2nbr($exp); $exp = $function{$exp} ? $function{$exp} : str2nbr($exp);
@ -49,17 +49,17 @@ handle query => sub {
# 1. Negative base and even exponent (imaginary numbers) # 1. Negative base and even exponent (imaginary numbers)
# 2. Negative base and odd exponenet # 2. Negative base and odd exponenet
# 3. Positive base # 3. Positive base
if ($base =~ m/negative\s|minus\s|\A-/i && $exp % 2 == 0) { if ($base =~ m/negative\s|minus\s|\A-/i && $exp % 2 == 0) {
# Figure out what number the base is # Figure out what number the base is
$base = $'; $base = $';
$base = str2nbr($base) if $base =~ /[^0-9]/; $base = str2nbr($base) if $base =~ /[^0-9]/;
# Solve using the absolute value of the base # Solve using the absolute value of the base
$base = abs($base); $base = abs($base);
my $calc = $base ** (1/$exp); my $calc = $base ** (1/$exp);
# If the result is a whole number (n), the answer is n*i # If the result is a whole number (n), the answer is n*i
if (($calc - int($calc)) == 0) { if (($calc - int($calc)) == 0) {
return $calc . 'i', html => "<sup>$exp</sup>&radic;-$base = $calc<em>i</em>"; return $calc . 'i', html => "<sup>$exp</sup>&radic;-$base = $calc<em>i</em>";
@ -69,12 +69,12 @@ handle query => sub {
my $count = int($calc); my $count = int($calc);
while ($count > 1) { while ($count > 1) {
# See if the current number raised to the given exponent is a factor of our base. If it is, the answer is n * i * exponent-root(the other factor) # See if the current number raised to the given exponent is a factor of our base. If it is, the answer is n * i * exponent-root(the other factor)
my $newBase = $base / ($count ** $exp); my $newBase = $base / ($count ** $exp);
if ( ($newBase - int($newBase)) == 0) { if ( ($newBase - int($newBase)) == 0) {
return "The $exp-root of -$base is $count * i * the $exp-root of $newBase.", html=> "<sup>$exp</sup>&radic;-$base = $count<em>i</em>&sdot;<sup>$exp</sup>&radic;$newBase"; return "The $exp-root of -$base is $count * i * the $exp-root of $newBase.", html=> "<sup>$exp</sup>&radic;-$base = $count<em>i</em>&sdot;<sup>$exp</sup>&radic;$newBase";
} }
$count--; $count--;
@ -84,25 +84,25 @@ handle query => sub {
return "The $exp-root of -$base is i * the $exp-root of $base", html => "<sup>$exp</sup>&radic;-$base = <em>i</em>&sdot;<sup>$exp</sup>&radic;$base"; return "The $exp-root of -$base is i * the $exp-root of $base", html => "<sup>$exp</sup>&radic;-$base = <em>i</em>&sdot;<sup>$exp</sup>&radic;$base";
} }
elsif ($base =~ m/negative\s|minus\s|\A-/i && $exp % 2 != 0) { elsif ($base =~ m/negative\s|minus\s|\A-/i && $exp % 2 != 0) {
# Solve normally # Solve normally
$base = $'; $base = $';
$base = str2nbr($base) if $base =~ m/[^0-9]/; $base = str2nbr($base) if $base =~ m/[^0-9]/;
$base =~ s/[^0-9\.]//g; $base =~ s/[^0-9\.]//g;
if ($base ne '') { if ($base ne '') {
my $calc = $base ** (1/$exp) * -1; my $calc = $base ** (1/$exp) * -1;
# Try and simplify the radical # Try and simplify the radical
my $count = int(abs($calc)); my $count = int(abs($calc));
while ($count > 1) { while ($count > 1) {
# See if the current number raised to the given exponent is a factor of our base. If it is, we can give them a simplified version of the radical in addition to the answer. # See if the current number raised to the given exponent is a factor of our base. If it is, we can give them a simplified version of the radical in addition to the answer.
my $newBase = $base / ($count ** $exp); my $newBase = $base / ($count ** $exp);
if ( ($newBase - int($newBase)) == 0) { if ( ($newBase - int($newBase)) == 0) {
return "The $exp-root of -$base is $calc (-$count times the $exp-root of $newBase).", html=> qq|<sup>$exp</sup>&radic;-$base = <a href="javascript:;" onclick="document.x.q.value='$calc';document.x.q.focus();">$calc</a> (-$count&sdot;<sup>$exp</sup>&radic;$newBase)|; return "The $exp-root of -$base is $calc (-$count times the $exp-root of $newBase).", html=> qq|<sup>$exp</sup>&radic;-$base = <a href="javascript:;" onclick="document.x.q.value='$calc';document.x.q.focus();">$calc</a> (-$count&sdot;<sup>$exp</sup>&radic;$newBase)|;
} }
$count--; $count--;
@ -112,23 +112,23 @@ handle query => sub {
} }
} }
elsif ($exp =~ m/[0-9]+/) { elsif ($exp =~ m/[0-9]+/) {
# Solve normally # Solve normally
$base = str2nbr($base) if $base =~ m/[^0-9]/; $base = str2nbr($base) if $base =~ m/[^0-9]/;
$base =~ s/[^0-9\.]//g; $base =~ s/[^0-9\.]//g;
if ($base ne '') { if ($base ne '') {
my $calc = $base ** (1/$exp); my $calc = $base ** (1/$exp);
# Try and simplify the radical # Try and simplify the radical
my $count = int($calc); my $count = int($calc);
while ($count > 1) { while ($count > 1) {
# See if the current number raised to the given exponent is a factor of our base. If it is, we can give them a simplified version of the radical in addition to the answer. # See if the current number raised to the given exponent is a factor of our base. If it is, we can give them a simplified version of the radical in addition to the answer.
my $newBase = $base / ($count ** $exp); my $newBase = $base / ($count ** $exp);
if ( ($newBase - int($newBase)) == 0) { if ( ($newBase - int($newBase)) == 0) {
return "The $exp-root of $base is $calc ($count times the $exp-root of $newBase).", html=> qq|<sup>$exp</sup>&radic;$base = <a href="javascript:;" onclick="document.x.q.value='$calc';document.x.q.focus();">$calc</a> ($count&sdot;<sup>$exp</sup>&radic;$newBase)|; return "The $exp-root of $base is $calc ($count times the $exp-root of $newBase).", html=> qq|<sup>$exp</sup>&radic;$base = <a href="javascript:;" onclick="document.x.q.value='$calc';document.x.q.focus();">$calc</a> ($count&sdot;<sup>$exp</sup>&radic;$newBase)|;
} }
$count--; $count--;
@ -138,7 +138,7 @@ handle query => sub {
} }
} }
return; return;
}; };
1; 1;

View File

@ -40,7 +40,7 @@ triggers query_nowhitespace => qr<
(?: [0-9 \. ,]* ) (?: [0-9 \. ,]* )
(?: gross | dozen | pi | e | c | squared | score |) (?: gross | dozen | pi | e | c | squared | score |)
[\( \) x X * % + / \^ 0-9 \. , \$ -]* =? [\( \) x X * % + / \^ 0-9 \. , \$ -]* =?
$ $
>xi; >xi;

View File

@ -10,11 +10,11 @@ zci answer_type => 'calendar';
zci is_cached => 0; zci is_cached => 0;
primary_example_queries "calendar"; primary_example_queries "calendar";
secondary_example_queries "calendar november", secondary_example_queries "calendar november",
"calendar next november", "calendar next november",
"calendar november 2015", "calendar november 2015",
"cal 29 nov 1980", "cal 29 nov 1980",
"cal 29.11.1980", "cal 29.11.1980",
"cal 1980-11-29"; "cal 1980-11-29";
description "Print calendar of current / given month and highlight (to)day"; description "Print calendar of current / given month and highlight (to)day";
@ -70,7 +70,7 @@ handle remainder => sub {
sub format_result { sub format_result {
my $args = shift; my $args = shift;
my ($firstDay, $first_day_num, $lastDay, $highlightDay) = @{$args}{qw(first_day first_day_num last_day highlight)}; my ($firstDay, $first_day_num, $lastDay, $highlightDay) = @{$args}{qw(first_day first_day_num last_day highlight)};
# Print heading # Print heading
my $rText = "\n"; my $rText = "\n";
my $rHtml = '<table class="calendar"><tr><th class="calendar__header" colspan="7"><b>'; my $rHtml = '<table class="calendar"><tr><th class="calendar__header" colspan="7"><b>';

View File

@ -73,7 +73,7 @@ Locale::Country::add_country_alias('United States' => 'America');
# Easter eggs # Easter eggs
Locale::Country::add_country_alias('Russian Federation' => 'Kremlin'); Locale::Country::add_country_alias('Russian Federation' => 'Kremlin');
Locale::Country::add_country_alias('United States' => 'murica'); Locale::Country::add_country_alias('United States' => 'murica');
Locale::Country::add_country_alias('Canada' => 'Canadia'); Locale::Country::add_country_alias('Canada' => 'Canadia');
Locale::Country::add_country_alias('Australia' => 'down under'); Locale::Country::add_country_alias('Australia' => 'down under');
handle remainder => sub { handle remainder => sub {

View File

@ -60,9 +60,9 @@ handle query_nowhitespace_nodash => sub {
my $length = scalar(@chars); my $length = scalar(@chars);
my $char_count = 0; my $char_count = 0;
my $sum = 0; my $sum = 0;
foreach my $char (@chars) { foreach my $char (@chars) {
$char_count++; $char_count++;
next if $char_count < 3; next if $char_count < 3;

View File

@ -122,7 +122,7 @@ handle query => sub {
my $query = $_; my $query = $_;
my $pos = undef; my $pos = undef;
return unless ($query =~ /\bchess960\b/i && return unless ($query =~ /\bchess960\b/i &&
($query =~ /\brandom\b/i || (($pos) = $query =~ /\b(\d+)\b/))) ; ($query =~ /\brandom\b/i || (($pos) = $query =~ /\b(\d+)\b/))) ;

View File

@ -28,9 +28,9 @@ handle query_lc => sub {
elsif ($_ =~ /^(?:flip|toss) (\d{0,2}) coins?$/) { elsif ($_ =~ /^(?:flip|toss) (\d{0,2}) coins?$/) {
$flips = $1; $flips = $1;
} }
return unless ($flips); return unless ($flips);
my @output; my @output;
my @ht = ("heads", "tails"); my @ht = ("heads", "tails");

View File

@ -100,15 +100,15 @@ handle query_lc => sub {
# fix precision and rounding: # fix precision and rounding:
my $precision = 3; my $precision = 3;
my $nearest = '.' . ('0' x ($precision-1)) . '1'; my $nearest = '.' . ('0' x ($precision-1)) . '1';
my $styler = number_style_for($factor); my $styler = number_style_for($factor);
return unless $styler; return unless $styler;
my $result = $c->convert( { my $result = $c->convert( {
'factor' => $styler->for_computation($factor), 'factor' => $styler->for_computation($factor),
'from_unit' => $matches[0], 'from_unit' => $matches[0],
'to_unit' => $matches[1], 'to_unit' => $matches[1],
'precision' => $precision, 'precision' => $precision,
} ); } );
return if !$result->{'result'}; return if !$result->{'result'};
@ -116,16 +116,16 @@ handle query_lc => sub {
my $f_result; my $f_result;
# if $result = 1.00000 .. 000n, where n <> 0 then $result != 1 and throws off pluralization, so: # if $result = 1.00000 .. 000n, where n <> 0 then $result != 1 and throws off pluralization, so:
$result->{'result'} = nearest($nearest, $result->{'result'}); $result->{'result'} = nearest($nearest, $result->{'result'});
if ($result->{'result'} == 0 || length($result->{'result'}) > 2*$precision + 1) { if ($result->{'result'} == 0 || length($result->{'result'}) > 2*$precision + 1) {
if ($result->{'result'} == 0) { if ($result->{'result'} == 0) {
# rounding error # rounding error
$result = $c->convert( { $result = $c->convert( {
'factor' => $styler->for_computation($factor), 'factor' => $styler->for_computation($factor),
'from_unit' => $matches[0], 'from_unit' => $matches[0],
'to_unit' => $matches[1], 'to_unit' => $matches[1],
'precision' => $precision, 'precision' => $precision,
} ); } );
} }

View File

@ -124,7 +124,7 @@ handle query_nowhitespace => sub {
#If the degrees are expressed in decimal... #If the degrees are expressed in decimal...
if ($degrees =~ /\./) { if ($degrees =~ /\./) {
#If this isn't the first conversion, make sure the #If this isn't the first conversion, make sure the
# user hasn't passed a mix of decimal and DMS # user hasn't passed a mix of decimal and DMS
return if $toFormat && ! $toFormat eq 'DMS'; return if $toFormat && ! $toFormat eq 'DMS';
$toFormat = 'DMS'; $toFormat = 'DMS';
@ -166,7 +166,7 @@ handle query_nowhitespace => sub {
# minutes/seconds given) # minutes/seconds given)
} else { } else {
#If this isn't the first conversion, make sure the #If this isn't the first conversion, make sure the
# user hasn't passed a mix of decimal and DMS # user hasn't passed a mix of decimal and DMS
return if $toFormat && ! $toFormat eq 'decimal'; return if $toFormat && ! $toFormat eq 'decimal';
$toFormat = 'decimal'; $toFormat = 'decimal';

View File

@ -17,16 +17,16 @@ topics "computing", "geek", "programming", "sysadmin";
primary_example_queries 'crontab help', 'crontab cheat sheet', 'crontab example'; primary_example_queries 'crontab help', 'crontab cheat sheet', 'crontab example';
triggers startend => ( triggers startend => (
'cron cheat sheet', 'cron cheat sheet',
'cron cheatsheet', 'cron cheatsheet',
'cron guide', 'cron guide',
'cron help', 'cron help',
'cron quick reference', 'cron quick reference',
'cron reference', 'cron reference',
'cron example', 'cron example',
'cron examples', 'cron examples',
'crontab cheat sheet', 'crontab cheat sheet',
'crontab cheatsheet', 'crontab cheatsheet',
'crontab guide', 'crontab guide',
'crontab help', 'crontab help',
'crontab quick reference', 'crontab quick reference',
@ -38,7 +38,7 @@ triggers startend => (
attribution github => ["nkorth", "Nathan Korth"]; attribution github => ["nkorth", "Nathan Korth"];
handle remainder => sub { handle remainder => sub {
return return
heading => 'Cron Cheat Sheet', heading => 'Cron Cheat Sheet',
html => html_cheat_sheet(), html => html_cheat_sheet(),
answer => text_cheat_sheet(), answer => text_cheat_sheet(),

View File

@ -25,57 +25,57 @@ topics 'cryptography';
attribution github => ['https://github.com/digit4lfa1l', 'digit4lfa1l']; attribution github => ['https://github.com/digit4lfa1l', 'digit4lfa1l'];
# Remainder function with links to the Wikipedia resources. # Remainder function with links to the Wikipedia resources.
handle remainder => sub { handle remainder => sub {
my ($md5) = /^[0-9a-f]{32}$/i; my ($md5) = /^[0-9a-f]{32}$/i;
if ($md5){ if ($md5){
my $text = sprintf qq(This is a 128 bit MD5 cryptographic hash.); my $text = sprintf qq(This is a 128 bit MD5 cryptographic hash.);
my $html = sprintf qq(This is a 128 bit <a href="%s">MD5</a> cryptographic hash.),MD5HERF; my $html = sprintf qq(This is a 128 bit <a href="%s">MD5</a> cryptographic hash.),MD5HERF;
return $text, html => $html; return $text, html => $html;
} }
my ($sha1) = /^[0-9a-f]{40}$/i; my ($sha1) = /^[0-9a-f]{40}$/i;
if ($sha1){ if ($sha1){
my $text = sprintf qq(This is a 160 bit SHA-1 cryptographic hash.); my $text = sprintf qq(This is a 160 bit SHA-1 cryptographic hash.);
my $html = sprintf qq(This is a 160 bit <a href="%s">SHA-1</a> cryptographic hash.),SHA1HREF; my $html = sprintf qq(This is a 160 bit <a href="%s">SHA-1</a> cryptographic hash.),SHA1HREF;
return $text, html => $html; return $text, html => $html;
} }
my ($sha224) = /^[0-9a-f]{56}$/i; my ($sha224) = /^[0-9a-f]{56}$/i;
if ($sha224){ if ($sha224){
my $text = sprintf qq(This is a 224 bit SHA-2/SHA-3 cryptographic hash.); my $text = sprintf qq(This is a 224 bit SHA-2/SHA-3 cryptographic hash.);
my $html = sprintf qq(This is a 224 bit <a href="%s">SHA-2</a>/<a href="%s">SHA-3</a> cryptographic hash.),SHA2HREF,SHA3HREF; my $html = sprintf qq(This is a 224 bit <a href="%s">SHA-2</a>/<a href="%s">SHA-3</a> cryptographic hash.),SHA2HREF,SHA3HREF;
return $text, html => $html; return $text, html => $html;
} }
my ($sha256) = /^[0-9a-f]{64}$/i; my ($sha256) = /^[0-9a-f]{64}$/i;
if ($sha256){ if ($sha256){
my $text = sprintf qq(This is a 256 bit SHA-2/SHA-3 cryptographic hash.); my $text = sprintf qq(This is a 256 bit SHA-2/SHA-3 cryptographic hash.);
my $html = sprintf qq(This is a 256 bit <a href="%s">SHA-2</a>/<a href="%s">SHA-3</a> cryptographic hash.),SHA2HREF,SHA3HREF; my $html = sprintf qq(This is a 256 bit <a href="%s">SHA-2</a>/<a href="%s">SHA-3</a> cryptographic hash.),SHA2HREF,SHA3HREF;
return $text, html => $html; return $text, html => $html;
} }
my ($sha384) = /^[0-9a-f]{96}$/i; my ($sha384) = /^[0-9a-f]{96}$/i;
if ($sha384){ if ($sha384){
my $text = sprintf qq(This is a 384 bit SHA-2/SHA-3 cryptographic hash.); my $text = sprintf qq(This is a 384 bit SHA-2/SHA-3 cryptographic hash.);
my $html = sprintf qq(This is a 384 bit <a href="%s">SHA-2</a>/<a href="%s">SHA-3</a> cryptographic hash.),SHA2HREF,SHA3HREF; my $html = sprintf qq(This is a 384 bit <a href="%s">SHA-2</a>/<a href="%s">SHA-3</a> cryptographic hash.),SHA2HREF,SHA3HREF;
return $text, html => $html; return $text, html => $html;
} }
my ($sha512) = /^[0-9a-f]{128}$/i; my ($sha512) = /^[0-9a-f]{128}$/i;
if ($sha512){ if ($sha512){
my $text = sprintf qq(This is a 512 bit SHA-2/SHA-3 cryptographic hash.); my $text = sprintf qq(This is a 512 bit SHA-2/SHA-3 cryptographic hash.);
my $html = sprintf qq(This is a 512 bit <a href="%s">SHA-2</a>/<a href="%s">SHA-3</a> cryptographic hash.),SHA2HREF,SHA3HREF; my $html = sprintf qq(This is a 512 bit <a href="%s">SHA-2</a>/<a href="%s">SHA-3</a> cryptographic hash.),SHA2HREF,SHA3HREF;
return $text, html => $html; return $text, html => $html;
} }
return; return;
}; };
1; 1;

View File

@ -3,7 +3,7 @@ package DDG::Goodie::CurrencyIn;
# TODO: At the moment it return value only if user inputs the whole country name... # TODO: At the moment it return value only if user inputs the whole country name...
# ...if user types "Salvador" instead of "El Salvador" then no results... # ...if user types "Salvador" instead of "El Salvador" then no results...
# TODO: think about how often currency in countries changes? # TODO: think about how often currency in countries changes?
# Parser (for Wikipedia) is included in share directory... # Parser (for Wikipedia) is included in share directory...
# In some countries there are more than one currency. # In some countries there are more than one currency.
@ -37,9 +37,9 @@ triggers any => 'currency', 'currencies'; # User typed currency...
# Countries are lowercased but input from user, too ... so those always match... # Countries are lowercased but input from user, too ... so those always match...
# ...country is capitalized on output... # ...country is capitalized on output...
my %countries = share('currency.txt')->slurp; my %countries = share('currency.txt')->slurp;
sub clear_country_name { sub clear_country_name {
my $txt = shift; my $txt = shift;
$txt =~ s/^\?$|\?$//g; # Query may end with "?". If so take it away. $txt =~ s/^\?$|\?$//g; # Query may end with "?". If so take it away.
$txt =~ s/^\s+|\s+$//g; # Trim spaces before and after the country name $txt =~ s/^\s+|\s+$//g; # Trim spaces before and after the country name
@ -58,17 +58,17 @@ handle remainder => sub {
return if $@ || !$loc; return if $@ || !$loc;
$country = lc($loc->country); $country = lc($loc->country);
} }
if (exists $countries{$country."\n"}){ if (exists $countries{$country."\n"}){
my $string_currency = $countries{$country."\n"}; # Load currencies as string (one line from .txt) my $string_currency = $countries{$country."\n"}; # Load currencies as string (one line from .txt)
my @currencies = split(',', $string_currency); # Split currencies into array my @currencies = split(',', $string_currency); # Split currencies into array
my $count = $#currencies + 1; # Get number of currencies my $count = $#currencies + 1; # Get number of currencies
my $output_country = $country; # Pass country name to the output_country my $output_country = $country; # Pass country name to the output_country
$output_country =~ s/\b(\w)/\U$1/g; # so it can by capitalized $output_country =~ s/\b(\w)/\U$1/g; # so it can by capitalized
my $result = $count == 1 ? "The currency in $output_country is the " : "Currencies in $output_country are: \n"; my $result = $count == 1 ? "The currency in $output_country is the " : "Currencies in $output_country are: \n";
# Append result with all currencies # Append result with all currencies
for (@currencies) { for (@currencies) {
chomp; chomp;
@ -78,9 +78,9 @@ handle remainder => sub {
chomp $result; chomp $result;
my $html = $result; my $html = $result;
$html =~ s|\n|<br/>|g; $html =~ s|\n|<br/>|g;
return $result, html=>$html; return $result, html=>$html;
} }
} }
return; return;

View File

@ -18,24 +18,24 @@ triggers startend => "cusip", "check cusip", "cusip check";
zci answer_type => "cusip"; zci answer_type => "cusip";
# magic number to identify the length of the CUSIP ID # magic number to identify the length of the CUSIP ID
my $CUSIPLENGTH = 9; my $CUSIPLENGTH = 9;
handle remainder => sub { handle remainder => sub {
# strip beginning and end whitespace from remainder # strip beginning and end whitespace from remainder
s/^\s+|\s+$//g; s/^\s+|\s+$//g;
# capitalize all letters in the CUSIP # capitalize all letters in the CUSIP
$_ = uc; $_ = uc;
# check that the remainder is the correct length and # check that the remainder is the correct length and
# only contains alphanumeric chars and *, @, and # # only contains alphanumeric chars and *, @, and #
return if not m/^[A-Z0-9\*\@\#]{$CUSIPLENGTH}$/; return if not m/^[A-Z0-9\*\@\#]{$CUSIPLENGTH}$/;
my $cusip = Business::CUSIP->new($_); my $cusip = Business::CUSIP->new($_);
my ($output, $htmlOutput); my ($output, $htmlOutput);
if ($cusip->is_valid) { if ($cusip->is_valid) {
$output = html_enc($_)." is a properly formatted CUSIP number."; $output = html_enc($_)." is a properly formatted CUSIP number.";
$htmlOutput = "<div class='zci--cusip text--primary'>".html_enc($_)." is a properly formatted <span class='text--secondary'>CUSIP number.</span></div>"; $htmlOutput = "<div class='zci--cusip text--primary'>".html_enc($_)." is a properly formatted <span class='text--secondary'>CUSIP number.</span></div>";

View File

@ -42,13 +42,13 @@ handle query_lc => sub {
my $number = $action eq '-' ? 0 - $input_number : $input_number; my $number = $action eq '-' ? 0 - $input_number : $input_number;
$unit =~ s/s$//g; $unit =~ s/s$//g;
my ($years, $months, $days, $weeks) = (0, 0, 0, 0); my ($years, $months, $days, $weeks) = (0, 0, 0, 0);
$years = $number if $unit eq "year"; $years = $number if $unit eq "year";
$months = $number if $unit eq "month"; $months = $number if $unit eq "month";
$days = $number if $unit eq "day"; $days = $number if $unit eq "day";
$days = 7*$number if $unit eq "week"; $days = 7*$number if $unit eq "week";
my $dur = DateTime::Duration->new( my $dur = DateTime::Duration->new(
years => $years, years => $years,
months => $months, months => $months,

View File

@ -22,12 +22,12 @@ my $datestring_regex = datestring_regex();
handle remainder => sub { handle remainder => sub {
return unless $_ =~ qr/^($datestring_regex) (?:(?:and|to) )?($datestring_regex)(?:[,]? inclusive)?$/i; return unless $_ =~ qr/^($datestring_regex) (?:(?:and|to) )?($datestring_regex)(?:[,]? inclusive)?$/i;
my ($date1, $date2) = parse_all_datestrings_to_date($1, $2); my ($date1, $date2) = parse_all_datestrings_to_date($1, $2);
return unless ($date1 && $date2); return unless ($date1 && $date2);
($date1, $date2) = ($date2, $date1) if ( DateTime->compare($date1, $date2) == 1 ); ($date1, $date2) = ($date2, $date1) if ( DateTime->compare($date1, $date2) == 1 );
my $difference = $date1->delta_days($date2); my $difference = $date1->delta_days($date2);
my $daysBetween = abs($difference->in_units('days')); my $daysBetween = abs($difference->in_units('days'));
my $inclusive = ''; my $inclusive = '';

View File

@ -69,7 +69,7 @@ my %desserts = (
v => ['Vanilla Swirl', 'Valentine Cake', 'Vanilla Poached Peaches', 'Vanilla Pudding', 'Valentine Cupcakes'], v => ['Vanilla Swirl', 'Valentine Cake', 'Vanilla Poached Peaches', 'Vanilla Pudding', 'Valentine Cupcakes'],
w => ['Waffles','Watermelon','White Chocolate', 'Whole Wheat Muffins', 'Walnut Fudge', 'White Chocolate Snowflakes', 'Watermelon Pie'], w => ['Waffles','Watermelon','White Chocolate', 'Whole Wheat Muffins', 'Walnut Fudge', 'White Chocolate Snowflakes', 'Watermelon Pie'],
x => ['Xmas Cake'], x => ['Xmas Cake'],
y => ['Yellow Layer Cake', 'Yogurt Fruit Pops', 'Yogurt Sundae', 'Yogurt Cheesecake'], y => ['Yellow Layer Cake', 'Yogurt Fruit Pops', 'Yogurt Sundae', 'Yogurt Cheesecake'],
z => ['Zeppole', 'Zucchini Cake', 'Zebra-Stripe Cheesecake'], z => ['Zeppole', 'Zucchini Cake', 'Zebra-Stripe Cheesecake'],
); );

View File

@ -57,8 +57,8 @@ handle remainder => sub {
return if lc($word) eq 'system'; # don't respond to "dewey decimal system" return if lc($word) eq 'system'; # don't respond to "dewey decimal system"
my @results = grep(/$word/i, keys %types); my @results = grep(/$word/i, keys %types);
return unless @results; return unless @results;
if (@results > 1) { if (@results > 1) {
$out_html .= "<tr>".line($types{$_})."</tr>" for @results; $out_html .= "<tr>".line($types{$_})."</tr>" for @results;
$multi = 1; $multi = 1;
} else { } else {
my $num = $types{$results[0]}; my $num = $types{$results[0]};
@ -71,7 +71,7 @@ handle remainder => sub {
else { else {
$_ = sprintf "%03d", $_; $_ = sprintf "%03d", $_;
unless ($multi) { unless ($multi) {
$out .= single_format $_, lc((get_info($_) or return)); $out .= single_format $_, lc((get_info($_) or return));
$out_html = $out; $out_html = $out;
} }
@ -86,7 +86,7 @@ handle remainder => sub {
} }
} }
} }
$out_html =~ s/\[\[([^\]]+?)\|(.+?)\]\]/<a href="\/\?q=$1">$2<\/a>/g; $out_html =~ s/\[\[([^\]]+?)\|(.+?)\]\]/<a href="\/\?q=$1">$2<\/a>/g;
$out_html =~ s/\[\[(.+?)\]\]/<a href="\/?q=$1">$1<\/a>/g; $out_html =~ s/\[\[(.+?)\]\]/<a href="\/?q=$1">$1<\/a>/g;
$out =~ s/\[\[.+?\|(.+?)\]\]/$1/g; $out =~ s/\[\[.+?\|(.+?)\]\]/$1/g;

View File

@ -29,7 +29,7 @@ my %utf8_dice = (
6 => "\x{2685}", 6 => "\x{2685}",
); );
# roll_dice generate pseudo random roll # roll_dice generate pseudo random roll
# param $_[0] number of faces # param $_[0] number of faces
# return roll # return roll
sub roll_die { sub roll_die {
@ -79,11 +79,11 @@ handle remainder_lc => sub {
my @values = split(' and ', $_); my @values = split(' and ', $_);
my $values = @values; # size of @values; my $values = @values; # size of @values;
my $out = ''; my $out = '';
my $html = ''; my $html = '';
my $heading = "Random Dice Roll"; my $heading = "Random Dice Roll";
my $total; # total of all dice rolls my $total; # total of all dice rolls
foreach (@values) { foreach (@values) {
if ($_ =~ /^(?:a? ?die|(\d{0,2})\s*dic?e)$/) { if ($_ =~ /^(?:a? ?die|(\d{0,2})\s*dic?e)$/) {
# ex. 'a die', '2 dice', '5dice' # ex. 'a die', '2 dice', '5dice'
my @output; my @output;
my $sum = 0; my $sum = 0;
@ -99,7 +99,7 @@ handle remainder_lc => sub {
$html .= '<span class="zci--dice-die">' . join(' ', @output).'</span>' $html .= '<span class="zci--dice-die">' . join(' ', @output).'</span>'
.'<span class="zci--dice-sum">'." = ". $sum.'</span></br>'; .'<span class="zci--dice-sum">'." = ". $sum.'</span></br>';
} }
elsif ($_ =~ /^(\d*)[d|w](\d+)\s?([+-])?\s?(\d+|[lh])?$/) { elsif ($_ =~ /^(\d*)[d|w](\d+)\s?([+-])?\s?(\d+|[lh])?$/) {
# ex. '2d8', '2w6 - l', '3d4 + 4', '3d4-l' # ex. '2d8', '2w6 - l', '3d4 + 4', '3d4-l'
# 'w' is the German form of 'd' # 'w' is the German form of 'd'
my (@rolls, $output); my (@rolls, $output);
@ -148,7 +148,7 @@ handle remainder_lc => sub {
$out .= 'Total: ' . $total; $out .= 'Total: ' . $total;
$html .= 'Total: ' . $total; $html .= 'Total: ' . $total;
} }
$out =~ s/<br\/>$//g; # remove trailing newline $out =~ s/<br\/>$//g; # remove trailing newline
if($out eq ''){ if($out eq ''){
return; # nothing to return return; # nothing to return
}else{ }else{

View File

@ -39,7 +39,7 @@ handle remainder => sub {
); );
# Danger: address returns possible modified string! # Danger: address returns possible modified string!
my $result = $email_valid->address($address); my $result = $email_valid->address($address);
if (!$result) { if (!$result) {
my $message = ''; my $message = '';

View File

@ -19,7 +19,7 @@ category 'calculations';
attribution github => [ 'https://github.com/austinheimark', 'austin_heimark' ]; attribution github => [ 'https://github.com/austinheimark', 'austin_heimark' ];
handle remainder => sub { handle remainder => sub {
return unless /^\d+$/; return unless /^\d+$/;
my @factors = divisors($_); my @factors = divisors($_);
return "Factors of $_: @factors"; return "Factors of $_: @factors";
}; };

View File

@ -33,7 +33,7 @@ triggers query_nowhitespace_nodash => qr/
# Fedex package tracking. # Fedex package tracking.
# #
# For detailed specification: # For detailed specification:
# http://images.fedex.com/us/solutions/ppe/FedEx_Ground_Label_Layout_Specification.pdf # http://images.fedex.com/us/solutions/ppe/FedEx_Ground_Label_Layout_Specification.pdf
# #
# For brief description see: # For brief description see:

View File

@ -31,13 +31,13 @@ handle remainder => sub {
{ {
if ($_ =~ /[a-z]/) if ($_ =~ /[a-z]/)
{ {
if ($collect =~ /all|letters|characters|chars/) { ++$freq{$_}; } if ($collect =~ /all|letters|characters|chars/) { ++$freq{$_}; }
else { ++$freq{$_} if $_ eq $collect; } else { ++$freq{$_} if $_ eq $collect; }
++$count; ++$count;
}; };
}; };
my @out; my @out;
foreach my $key (keys %freq) foreach my $key (keys %freq)
{ {

View File

@ -58,7 +58,7 @@ my $color_ranges =
]; ];
# reference: https://en.wikipedia.org/wiki/Musical_acoustics # reference: https://en.wikipedia.org/wiki/Musical_acoustics
#Ranges for common instruments #Ranges for common instruments
my $instrument_ranges = my $instrument_ranges =
[ [
[ "87", "1046", "human voice" ], [ "87", "1046", "human voice" ],
@ -86,19 +86,19 @@ my $instrument_ranges =
]; ];
# Reference: https://en.wikipedia.org/wiki/Ultraviolet # Reference: https://en.wikipedia.org/wiki/Ultraviolet
my $ultraviolet_ranges = my $ultraviolet_ranges =
[ [
[ 7.495*(10**14), 3*(10**16), "UV light is found in sunlight and is emitted by electric arcs and specialized lights such as mercury lamps and black lights." ], [ 7.495*(10**14), 3*(10**16), "UV light is found in sunlight and is emitted by electric arcs and specialized lights such as mercury lamps and black lights." ],
]; ];
# Reference: https://en.wikipedia.org/wiki/X-ray # Reference: https://en.wikipedia.org/wiki/X-ray
my $xray_ranges = my $xray_ranges =
[ [
[ 3*(10**16), 3*(10**19), "X-rays are used for various medical and industrial uses such as radiographs and CT scans. "], [ 3*(10**16), 3*(10**19), "X-rays are used for various medical and industrial uses such as radiographs and CT scans. "],
]; ];
# Reference: # Reference:
my $gamma_ranges = my $gamma_ranges =
[ [
[ 10**19, 10**24, "Gamma rays are can be used to treat cancer and for diagnostic purposes." ], [ 10**19, 10**24, "Gamma rays are can be used to treat cancer and for diagnostic purposes." ],
]; ];
@ -112,7 +112,7 @@ handle query => sub {
my $freq_hz; my $freq_hz;
my $hz_abbrev; my $hz_abbrev;
my $freq_formatted; my $freq_formatted;
if($freq =~ m/^(.+?)\s(?:hz|hertz)$/i) { if($freq =~ m/^(.+?)\s(?:hz|hertz)$/i) {
$freq_hz = $1; $freq_hz = $1;
} elsif($freq =~ m/^(.+?)\s(?:khz|kilohertz)$/i) { } elsif($freq =~ m/^(.+?)\s(?:khz|kilohertz)$/i) {
@ -127,7 +127,7 @@ handle query => sub {
#unexpected case #unexpected case
return; return;
} }
if($freq_hz >= TRILLION){ if($freq_hz >= TRILLION){
$hz_abbrev = "THz"; $hz_abbrev = "THz";
$freq_formatted = $freq_hz / TRILLION; $freq_formatted = $freq_hz / TRILLION;
@ -144,9 +144,9 @@ handle query => sub {
$hz_abbrev = "Hz"; $hz_abbrev = "Hz";
$freq_formatted = $freq_hz; $freq_formatted = $freq_hz;
} }
$freq = $freq_formatted . " " . $hz_abbrev; $freq = $freq_formatted . " " . $hz_abbrev;
return prepare_result($freq, $freq_hz); return prepare_result($freq, $freq_hz);
}; };

View File

@ -3,8 +3,8 @@ package DDG::Goodie::GenerateMAC;
use DDG::Goodie; use DDG::Goodie;
triggers startend => "generate mac addr", triggers startend => "generate mac addr",
"generate mac address", "generate mac address",
"random mac addr", "random mac addr",
"random mac address", "random mac address",
"mac address generator", "mac address generator",

View File

@ -29,7 +29,7 @@ triggers startend => (
attribution github => ["elebow", "Eddie Lebow"]; attribution github => ["elebow", "Eddie Lebow"];
handle remainder => sub { handle remainder => sub {
return return
heading => "GIMP Shortcut Cheat Sheet", heading => "GIMP Shortcut Cheat Sheet",
html => html_cheat_sheet(), html => html_cheat_sheet(),
answer => text_cheat_sheet(), answer => text_cheat_sheet(),

View File

@ -22,7 +22,7 @@ attribution twitter => 'crazedpsyc',
handle remainder => sub { handle remainder => sub {
my $input = $_; my $input = $_;
my $golden_ratio = (1 + sqrt(5)) / 2; my $golden_ratio = (1 + sqrt(5)) / 2;
my $result = 0; my $result = 0;
if ($input =~ /^(?:(?:(\?)\s*:\s*(\d+(?:\.\d+)?))|(?:(\d+(?:\.\d+)?)\s*:\s*(\?)))$/) { if ($input =~ /^(?:(?:(\?)\s*:\s*(\d+(?:\.\d+)?))|(?:(\d+(?:\.\d+)?)\s*:\s*(\?)))$/) {
if ($1 && $1 eq "?") { if ($1 && $1 eq "?") {
@ -30,10 +30,10 @@ handle remainder => sub {
$result = $2 / $golden_ratio; $result = $2 / $golden_ratio;
return "Golden ratio: $result : $2"; return "Golden ratio: $result : $2";
} elsif ($4 && $4 eq "?") { } elsif ($4 && $4 eq "?") {
# x : ? # x : ?
$result = $3 * $golden_ratio; $result = $3 * $golden_ratio;
return "Golden ratio: $3 : $result"; return "Golden ratio: $3 : $result";
} }
} }
return; return;
}; };

View File

@ -20,14 +20,14 @@ handle remainder => sub {
sub gcf { sub gcf {
my ($x, $y) = @_; my ($x, $y) = @_;
($x, $y) = ($y, $x % $y) while $y; ($x, $y) = ($y, $x % $y) while $y;
return $x; return $x;
} }
my $result = 'Greatest common factor of ' . $1 . ' and ' . $2 . ' is ' . gcf($1,$2) . '.' if /^(\d+)\s(\d+)$/; my $result = 'Greatest common factor of ' . $1 . ' and ' . $2 . ' is ' . gcf($1,$2) . '.' if /^(\d+)\s(\d+)$/;
my $link = qq(More at <a href="https://en.wikipedia.org/wiki/Greatest_common_factor">Wikipedia</a>.); my $link = qq(More at <a href="https://en.wikipedia.org/wiki/Greatest_common_factor">Wikipedia</a>.);
return $result, 'html' => "$result $link" if $result; return $result, 'html' => "$result $link" if $result;
return; return;
}; };
1; 1;

View File

@ -39,17 +39,17 @@ handle remainder => sub {
my $entity = $1; my $entity = $1;
$entity =~ s/^&?/&/; # append '&' at the front $entity =~ s/^&?/&/; # append '&' at the front
$entity =~ s/;?$/;/; # append ';' at the back $entity =~ s/;?$/;/; # append ';' at the back
# Attempt to decode, exit if unsuccessful # Attempt to decode, exit if unsuccessful
my $decoded = decode_entities($entity); # decode_entities() returns the input if unsuccesful my $decoded = decode_entities($entity); # decode_entities() returns the input if unsuccesful
my $decimal = ord($decoded); my $decimal = ord($decoded);
my $hex = sprintf("%04x", $decimal); my $hex = sprintf("%04x", $decimal);
return if (lc $entity eq lc $decoded); # safety net -- makes trying to decode something not real like "&enchantedbunny;" fail return if (lc $entity eq lc $decoded); # safety net -- makes trying to decode something not real like "&enchantedbunny;" fail
# If invisible character, provide link instead of displaying it # If invisible character, provide link instead of displaying it
my $info = charinfo($decimal); # charinfo() returns undef if input is not a "real" character my $info = charinfo($decimal); # charinfo() returns undef if input is not a "real" character
return unless (defined $info); # another safety net return unless (defined $info); # another safety net
if ($$info{name} eq '<control>') { if ($$info{name} eq '<control>') {
$decoded = "Unicode control character (no visual representation)"; $decoded = "Unicode control character (no visual representation)";
$entity = "<a href='https://en.wikipedia.org/wiki/Unicode_control_characters'>Unicode control character</a> (no visual representation)"; $entity = "<a href='https://en.wikipedia.org/wiki/Unicode_control_characters'>Unicode control character</a> (no visual representation)";
} elsif(substr($$info{category},0,1) eq 'C') { } elsif(substr($$info{category},0,1) eq 'C') {

View File

@ -275,7 +275,7 @@ handle remainder => sub {
$key = $hashes_query; $key = $hashes_query;
$value = $accented_chars{$key}; $value = $accented_chars{$key};
# Not an accented character -- lookup the $codes hash instead # Not an accented character -- lookup the $codes hash instead
} else { } else {
$key = lc $hashes_query; $key = lc $hashes_query;
$value = $codes{$key}; $value = $codes{$key};
} }
@ -304,7 +304,7 @@ handle remainder => sub {
$entity = '#' . $entity; # dress it up like a decimal $entity = '#' . $entity; # dress it up like a decimal
} }
# Remove '&' and ';' from the output of html_enc(), these will be added in html # Remove '&' and ';' from the output of html_enc(), these will be added in html
$entity =~ s/^&//g; $entity =~ s/^&//g;
$entity =~ s/;$//g; $entity =~ s/;$//g;
# Make final answer # Make final answer
my $answer = [[$_, $entity]]; my $answer = [[$_, $entity]];

View File

@ -12,11 +12,11 @@ my $text;
my $key; my $key;
my $value; my $value;
my %keys = ('backspace' => '8', my %keys = ('backspace' => '8',
'tab' => '9', 'tab' => '9',
'enter' => '13', 'enter' => '13',
'shift' => '16', 'shift' => '16',
'ctrl' => '17', 'ctrl' => '17',
'alt' => '18', 'alt' => '18',
'pause' => '19', 'pause' => '19',
'break' => '19', 'break' => '19',
'caps lock' => '20', 'caps lock' => '20',
@ -26,7 +26,7 @@ my %keys = ('backspace' => '8',
'end' => '35', 'end' => '35',
'home' => '36', 'home' => '36',
'left arrow' => '37', 'left arrow' => '37',
'up arrow' => '38', 'up arrow' => '38',
'right arrow' => '39', 'right arrow' => '39',
'down arrow' => '40', 'down arrow' => '40',
'insert' => '45', 'insert' => '45',
@ -105,7 +105,7 @@ my %keys = ('backspace' => '8',
my $header = share('header.txt')->slurp; my $header = share('header.txt')->slurp;
my $footer = share('footer.txt')->slurp; my $footer = share('footer.txt')->slurp;
handle remainder => sub { handle remainder => sub {
my $query = lc($_); my $query = lc($_);
return unless exists $keys{$query} return unless exists $keys{$query}
@ -117,13 +117,13 @@ handle remainder => sub {
$html .= "\n<tr><td class='c1'><b>$query</b></td>" $html .= "\n<tr><td class='c1'><b>$query</b></td>"
. "\n<td class='c2'><b>$keys{$query}</b></td></tr>" . "\n<td class='c2'><b>$keys{$query}</b></td></tr>"
if exists $keys{$query}; if exists $keys{$query};
foreach $key (sort keys %keys){ foreach $key (sort keys %keys){
$html .= "\n<tr><td class='c1'>$key</td>" $html .= "\n<tr><td class='c1'>$key</td>"
. "\n<td class='c2'>$keys{$key}</td></tr>" . "\n<td class='c2'>$keys{$key}</td></tr>"
unless $key eq $query; unless $key eq $query;
}; };
$html .= $footer; $html .= $footer;
$text = "Keycode for $query: $keys{$query} (JavaScript)" $text = "Keycode for $query: $keys{$query} (JavaScript)"
unless not exists $keys{$query}; unless not exists $keys{$query};

View File

@ -10,7 +10,7 @@ zci answer_type => 'loan';
zci is_cached => 1; zci is_cached => 1;
primary_example_queries 'loan $500000 at 4.5% with 20% down'; primary_example_queries 'loan $500000 at 4.5% with 20% down';
secondary_example_queries secondary_example_queries
'loan $500000 at 4.5% with 20% down 15 years', 'loan $500000 at 4.5% with 20% down 15 years',
'borrow $500000 4.5%', 'borrow $500000 4.5%',
'mortgage $500000 4.5% 20% down 15 years'; 'mortgage $500000 4.5% 20% down 15 years';
@ -35,9 +35,9 @@ my %symbol_to_currency = ( );
# A map of all the known currency codes, filled in below # A map of all the known currency codes, filled in below
my %supported_currency_codes = ( ); my %supported_currency_codes = ( );
# From the symbol used, guess the currency (this will override any location data that comes in with the user). # From the symbol used, guess the currency (this will override any location data that comes in with the user).
# This is pretty imprecise. Assume USD if a $ is used. More assumptions can be added here later to priorize # This is pretty imprecise. Assume USD if a $ is used. More assumptions can be added here later to priorize
# currency guessing. Perhaps location data can be used to break ties. # currency guessing. Perhaps location data can be used to break ties.
sub convert_symbol_to_currency { sub convert_symbol_to_currency {
my ($symbol, $country) = @_; my ($symbol, $country) = @_;
my @syms = @{$symbol_to_currency{$symbol} // []}; my @syms = @{$symbol_to_currency{$symbol} // []};
@ -50,31 +50,31 @@ sub convert_symbol_to_currency {
} }
# Given the country code and currency formatting rules, the input can be made ready to convert # Given the country code and currency formatting rules, the input can be made ready to convert
# to a useable number. Examples: # to a useable number. Examples:
# In USD: 400,000 => 400000 # In USD: 400,000 => 400000
# In EUR: 400.000,00 => 400000.00 # In EUR: 400.000,00 => 400000.00
sub normalize_formatted_currency_string { sub normalize_formatted_currency_string {
my ($str, $currency_code) = @_; my ($str, $currency_code) = @_;
my $thousands_separator = thousands_separator($currency_code) // ','; my $thousands_separator = thousands_separator($currency_code) // ',';
my $decimal_separator = decimal_separator($currency_code) // '.'; my $decimal_separator = decimal_separator($currency_code) // '.';
$str =~ s/\Q$thousands_separator//g; $str =~ s/\Q$thousands_separator//g;
if ($decimal_separator ne ".") { if ($decimal_separator ne ".") {
$str =~ s/\Q$decimal_separator/\./g; $str =~ s/\Q$decimal_separator/\./g;
} }
return $str; return $str;
} }
# Attempt to extract terms of a loan from the input query. Interest rate and principal must be found in the # Attempt to extract terms of a loan from the input query. Interest rate and principal must be found in the
# query, downpayment and years of the loan are optional and will default to 0 and 30, respectively. This # query, downpayment and years of the loan are optional and will default to 0 and 30, respectively. This
# method first looks for years, interest rate, and downpayment numbers and removes them from the query # method first looks for years, interest rate, and downpayment numbers and removes them from the query
# string so they are not confused for the principal loan amount, which may be present simply as a raw # string so they are not confused for the principal loan amount, which may be present simply as a raw
# number. # number.
handle remainder => sub { handle remainder => sub {
my $query = $_; my $query = $_;
# Loan rate is required, query will be ignored if it is missing # Loan rate is required, query will be ignored if it is missing
my $rate = 0; my $rate = 0;
@ -95,7 +95,7 @@ handle remainder => sub {
return; return;
} }
# Downpayment information that may be discovered. It will be combined with the discovered currency. # Downpayment information that may be discovered. It will be combined with the discovered currency.
my $downpayment_in_query = 0; my $downpayment_in_query = 0;
my $downpayment_is_in_cash = 0; my $downpayment_is_in_cash = 0;
my $downpayment_without_units = 0; my $downpayment_without_units = 0;
@ -112,9 +112,9 @@ handle remainder => sub {
if ($query =~ /(\p{Currency_Symbol})?([\d\.,]+)\s?([A-Za-z]{3})?/) { if ($query =~ /(\p{Currency_Symbol})?([\d\.,]+)\s?([A-Za-z]{3})?/) {
my $symbol = $1; my $symbol = $1;
my $principal = $2; my $principal = $2;
my $input_currency_code = $3; my $input_currency_code = $3;
my $downpayment = 0; my $downpayment = 0;
if (defined $input_currency_code) { if (defined $input_currency_code) {
$input_currency_code = uc($input_currency_code); $input_currency_code = uc($input_currency_code);
} }
@ -131,7 +131,7 @@ handle remainder => sub {
} }
# Given the country code and currency formatting rules, the input can be made ready to convert # Given the country code and currency formatting rules, the input can be made ready to convert
# to a useable number. # to a useable number.
$principal = normalize_formatted_currency_string($principal, $currency_code); $principal = normalize_formatted_currency_string($principal, $currency_code);
# Deal with downpayment information if it was found in the query # Deal with downpayment information if it was found in the query
@ -144,23 +144,23 @@ handle remainder => sub {
$downpayment = $principal * .01 * $downpayment_without_units; $downpayment = $principal * .01 * $downpayment_without_units;
} }
} }
my $loan_amount = $principal - $downpayment; my $loan_amount = $principal - $downpayment;
my $monthly_payment = loan_monthly_payment($loan_amount, $rate / 12 * .01, $years * 12); my $monthly_payment = loan_monthly_payment($loan_amount, $rate / 12 * .01, $years * 12);
my $total_interest = ($monthly_payment * 12 * $years) - $loan_amount; my $total_interest = ($monthly_payment * 12 * $years) - $loan_amount;
return "Monthly Payment is " . currency_format($currency_code, $monthly_payment, FMT_SYMBOL) . return "Monthly Payment is " . currency_format($currency_code, $monthly_payment, FMT_SYMBOL) .
" for $years years. Total interest paid is " . " for $years years. Total interest paid is " .
currency_format($currency_code, $total_interest, FMT_SYMBOL); currency_format($currency_code, $total_interest, FMT_SYMBOL);
} }
return; return;
}; };
# A map of 2 letter country code to 3 letter currency code. Copied from Locale::Object perl module # A map of 2 letter country code to 3 letter currency code. Copied from Locale::Object perl module
# (http://search.cpan.org/~jrobinson/Locale-Object/) which carries some extra baggage with it, and # (http://search.cpan.org/~jrobinson/Locale-Object/) which carries some extra baggage with it, and
# has also not been updated since 2007. If the mapping between any country and currency needs to be # has also not been updated since 2007. If the mapping between any country and currency needs to be
# changed, this is where to change it. # changed, this is where to change it.
%country_to_currency = ( %country_to_currency = (
'ad' => 'EUR', 'ad' => 'EUR',
'ae' => 'AED', 'ae' => 'AED',

View File

@ -21,11 +21,11 @@ handle remainder => sub {
return unless $_; return unless $_;
my $lower = lc $_; my $lower = lc $_;
my $text = $lower; my $text = $lower;
# Encode the variable before putting it in HTML. # Encode the variable before putting it in HTML.
# There's no need to encode the $text variable because that gets encoded internally. # There's no need to encode the $text variable because that gets encoded internally.
$lower = html_enc($lower); $lower = html_enc($lower);
my $html = qq(<div class="zci--lowercase"><span class="text--primary">$lower</span></div>); my $html = qq(<div class="zci--lowercase"><span class="text--primary">$lower</span></div>);
return $text, html => $html; return $text, html => $html;

View File

@ -19,9 +19,9 @@ zci answer_type => 'xkcd_sandwich';
zci is_cached => 1; zci is_cached => 1;
handle remainder => sub { handle remainder => sub {
return 'Okay.', return 'Okay.',
html => 'Okay. <br><a href="http://xkcd.com/149/">More at xkcd</a>' if $_ eq 'sudo'; html => 'Okay. <br><a href="http://xkcd.com/149/">More at xkcd</a>' if $_ eq 'sudo';
return 'What? Make it yourself.', return 'What? Make it yourself.',
html => 'What? Make it yourself. <br><a href="http://xkcd.com/149/">More at xkcd</a>' if $_ eq ''; html => 'What? Make it yourself. <br><a href="http://xkcd.com/149/">More at xkcd</a>' if $_ eq '';
return; return;
}; };

View File

@ -47,7 +47,7 @@ my %triggerQueries = (
); );
handle query_lc => sub { handle query_lc => sub {
# Make sure the query is on the list # Make sure the query is on the list
my $queryStripped = $_; my $queryStripped = $_;
$queryStripped =~ s/[^a-zA-z\s]//g; $queryStripped =~ s/[^a-zA-z\s]//g;
@ -68,10 +68,10 @@ handle query_lc => sub {
$phase = 'First Quarter' if $phaseAngle == 25; $phase = 'First Quarter' if $phaseAngle == 25;
$phase = 'Full Moon' if $phaseAngle == 50; $phase = 'Full Moon' if $phaseAngle == 50;
$phase = 'Third Quarter' if $phaseAngle == 75; $phase = 'Third Quarter' if $phaseAngle == 75;
my $phaseUrl = $phase; my $phaseUrl = $phase;
$phaseUrl =~ s/\s+/+/g; $phaseUrl =~ s/\s+/+/g;
return "The current lunar phase is: $phase", html => qq(The current lunar phase is: <a href="?q=$phaseUrl">$phase</a>); return "The current lunar phase is: $phase", html => qq(The current lunar phase is: <a href="?q=$phaseUrl">$phase</a>);
}; };

View File

@ -67,7 +67,7 @@ my @presidents = (
"George W. Bush", "George W. Bush",
"Barack Obama", "Barack Obama",
); );
handle remainder => sub { handle remainder => sub {
s/ s/
|who\s+(is|was)\s+the\s+ |who\s+(is|was)\s+the\s+

View File

@ -1,5 +1,5 @@
package DDG::Goodie::Palindrome; package DDG::Goodie::Palindrome;
# ABSTRACT: Return if the a string is a palindrome, formatted requests: # ABSTRACT: Return if the a string is a palindrome, formatted requests:
# 'is <string> a[n] palindrome[?]' or 'isPalindrome <string>' # 'is <string> a[n] palindrome[?]' or 'isPalindrome <string>'
use DDG::Goodie; use DDG::Goodie;

View File

@ -35,9 +35,9 @@ triggers query_nowhitespace_nodash => qr/
handle query_nowhitespace_nodash => sub { handle query_nowhitespace_nodash => sub {
my $parcel_number = $+{parcel_number}; my $parcel_number = $+{parcel_number};
if ($parcel_number && $parcel_number !~ /^isbn/i) { if ($parcel_number && $parcel_number !~ /^isbn/i) {
return $parcel_number, return $parcel_number,
heading => 'Parcelforce Tracking', heading => 'Parcelforce Tracking',
html => html =>

View File

@ -30,7 +30,7 @@ handle remainder => sub {
my $err = $per*100; my $err = $per*100;
my $html = qq(Accepted: $acc Experimental: $exp Error: <a href="javascript:;" onclick="document.x.q.value='$per';document.x.q.focus();">$err%</a>); my $html = qq(Accepted: $acc Experimental: $exp Error: <a href="javascript:;" onclick="document.x.q.value='$per';document.x.q.focus();">$err%</a>);
return "Accepted: $acc Experimental: $exp Error: $err%", html => $html; return "Accepted: $acc Experimental: $exp Error: $err%", html => $html;
}; };

View File

@ -22,7 +22,7 @@ handle query_lc => sub {
if ($_ =~ m/^(?:circumference (?:of\s|)(?:circle\s|)(\d+(?:\.\d+)?))|(?:(perimeter) (?:of\s|)(?:(square|circle|pentagon|hexagon|octagon) (\d+(?:\.\d+)?)|(rectangle) (\d+(?:\.\d+)?)[,;]?\s(\d+(?:\.\d+)?)|(triangle) (\d+(?:\.\d+)?)[,;]?\s(\d+(?:\.\d+)?)[,;]?\s(\d+(?:\.\d+)?)))$/) { if ($_ =~ m/^(?:circumference (?:of\s|)(?:circle\s|)(\d+(?:\.\d+)?))|(?:(perimeter) (?:of\s|)(?:(square|circle|pentagon|hexagon|octagon) (\d+(?:\.\d+)?)|(rectangle) (\d+(?:\.\d+)?)[,;]?\s(\d+(?:\.\d+)?)|(triangle) (\d+(?:\.\d+)?)[,;]?\s(\d+(?:\.\d+)?)[,;]?\s(\d+(?:\.\d+)?)))$/) {
my %polygons = ("pentagon" => 5, "hexagon" => 6, "octagon" => 8); my %polygons = ("pentagon" => 5, "hexagon" => 6, "octagon" => 8);
my $shape = $1 ? "circle" : $3 || $5 || $8; my $shape = $1 ? "circle" : $3 || $5 || $8;
my $answerPrefix = "Perimeter of $shape: "; my $answerPrefix = "Perimeter of $shape: ";
my $answer; my $answer;
@ -41,7 +41,7 @@ handle query_lc => sub {
} }
} }
return $answerPrefix.$answer; return $answerPrefix.$answer;
} }
return; return;

View File

@ -52,7 +52,7 @@ sub format_prime {
foreach my $factor (@factors) { foreach my $factor (@factors) {
my ($text, $html) = format_exp($factor); my ($text, $html) = format_exp($factor);
push(@text_result, $text); push(@text_result, $text);
push(@html_result, $html); push(@html_result, $html);
} }
@ -77,7 +77,7 @@ handle remainder => sub {
my $start_time = time(); my $start_time = time();
my @factors = (); my @factors = ();
# Provide only one second for computing the factors. # Provide only one second for computing the factors.
eval { eval {
alarm(1); alarm(1);

View File

@ -2,7 +2,7 @@ package DDG::Goodie::Randagram;
# ABSTRACT: Take a query and spit it out randomly. # ABSTRACT: Take a query and spit it out randomly.
use DDG::Goodie; use DDG::Goodie;
use List::Util 'shuffle'; use List::Util 'shuffle';
triggers start => "randagram"; triggers start => "randagram";

View File

@ -9,27 +9,27 @@ use DDG::Goodie;
zci answer_type => "regex_cheat"; zci answer_type => "regex_cheat";
zci is_cached => 1; zci is_cached => 1;
triggers start => triggers start =>
'regex cheatsheet', 'regex cheatsheet',
'regex cheat sheet', 'regex cheat sheet',
'regex help', 'regex help',
'regexp cheatsheet', 'regexp cheatsheet',
'regexp cheat sheet', 'regexp cheat sheet',
'regexp help', 'regexp help',
'regex symbols', 'regex symbols',
'regex symbol', 'regex symbol',
'regexp symbols', 'regexp symbols',
'regexp symbol', 'regexp symbol',
'regex chars', 'regex chars',
'regex char', 'regex char',
'regexp chars', 'regexp chars',
'regexp char', 'regexp char',
'regex characters', 'regex characters',
'regex character', 'regex character',
'regexp characters', 'regexp characters',
'regexp character', 'regexp character',
'regex', 'regex',
'regexp', 'regexp',
'regular expressions', 'regular expressions',
'regular expression', 'regular expression',
'regex guide', 'regex guide',
@ -99,7 +99,7 @@ my %syntax_map = (
'[a-q]' => 'Single character range (a or b ... or q)', '[a-q]' => 'Single character range (a or b ... or q)',
'[A-Z]' => 'Single character range (A or B ... or Z)', '[A-Z]' => 'Single character range (A or B ... or Z)',
'[0-9]' => 'Single digit from 0 to 9', '[0-9]' => 'Single digit from 0 to 9',
'^' => "Start of string or line", '^' => "Start of string or line",
'\A' => "Start of string", '\A' => "Start of string",
'$' => "End of string or line", '$' => "End of string or line",
'\Z' => "End of string", '\Z' => "End of string",
@ -216,29 +216,29 @@ handle remainder => sub {
elsif ($_ =~ /^\{([0-9]+),([0-9]+)?\}$/) { elsif ($_ =~ /^\{([0-9]+),([0-9]+)?\}$/) {
if ($2) { if ($2) {
return unless ($1 < $2); return unless ($1 < $2);
return answer => "$_ - Between $1 and $2 occurrences", return answer => "$_ - Between $1 and $2 occurrences",
html => "<code>" . html_enc($_) . "</code> - Between $1 and $2 occurrences", html => "<code>" . html_enc($_) . "</code> - Between $1 and $2 occurrences",
heading => $heading; heading => $heading;
} }
return answer => "$_ - $1 or more", return answer => "$_ - $1 or more",
html => "<code>" . html_enc($_) . "</code> - $1 or more occurrences", html => "<code>" . html_enc($_) . "</code> - $1 or more occurrences",
heading => $heading; heading => $heading;
} }
# Check our map if it's in our list of regex patterns. # Check our map if it's in our list of regex patterns.
return unless $syntax_map{$syntax_key}; return unless $syntax_map{$syntax_key};
my $text_output = "$_ - $syntax_map{$syntax_key}"; my $text_output = "$_ - $syntax_map{$syntax_key}";
my $html_output = "<code>" . html_enc($_) . "</code> - " . html_enc($syntax_map{$syntax_key}); my $html_output = "<code>" . html_enc($_) . "</code> - " . html_enc($syntax_map{$syntax_key});
return answer => $text_output, html => $html_output, heading => $heading; return answer => $text_output, html => $html_output, heading => $heading;
} }
# Otherwise display the complete tabular output, into n columns in the order specified. # Otherwise display the complete tabular output, into n columns in the order specified.
my $text_output = ''; my $text_output = '';
# Content of the div column wrapper. # Content of the div column wrapper.
my @html_columns = (); my @html_columns = ();
# Add a helper function for adding the <td> tag. # Add a helper function for adding the <td> tag.
sub add_table_data { sub add_table_data {
my ($text, $is_code) = @_; my ($text, $is_code) = @_;
@ -258,13 +258,13 @@ handle remainder => sub {
$new_table .= "<tr>" . add_table_data($syntax_object, 1) . add_table_data($syntax_map{$syntax_object}, 0) . "</tr>\n"; $new_table .= "<tr>" . add_table_data($syntax_object, 1) . add_table_data($syntax_map{$syntax_object}, 0) . "</tr>\n";
$text_output .= "\t$syntax_object - $syntax_map{$syntax_object}\n"; $text_output .= "\t$syntax_object - $syntax_map{$syntax_object}\n";
} }
$text_output .= "\n"; $text_output .= "\n";
$new_table .= "</table>\n"; $new_table .= "</table>\n";
$html_columns[$column] .= $new_table; $html_columns[$column] .= $new_table;
} }
} }
my $html_output = "<div class='regex-container'><div class='regex-column'>"; my $html_output = "<div class='regex-container'><div class='regex-column'>";
$html_output .= join ("</div><div class='regex-column'>", @html_columns); $html_output .= join ("</div><div class='regex-column'>", @html_columns);
$html_output .= "</div></div>"; $html_output .= "</div></div>";

View File

@ -42,7 +42,7 @@ handle remainder => sub {
#Reverse #Reverse
$sequence = reverse($sequence); $sequence = reverse($sequence);
return $sequence, html => wrap_html('DNA reverse complement:', $sequence); return $sequence, html => wrap_html('DNA reverse complement:', $sequence);
}; };

View File

@ -48,11 +48,11 @@ handle query_raw => sub {
$resistance += ($coloursToDigits{$colours[0]}{value} * 10); $resistance += ($coloursToDigits{$colours[0]}{value} * 10);
$resistance += $coloursToDigits{$colours[1]}{value}; $resistance += $coloursToDigits{$colours[1]}{value};
for (my $i = 0; $i < $coloursToDigits{$colours[2]}{value}; $i++) { for (my $i = 0; $i < $coloursToDigits{$colours[2]}{value}; $i++) {
$resistance = $resistance * 10; $resistance = $resistance * 10;
} }
my $mult = $coloursToDigits{$colours[2]}{value}; my $mult = $coloursToDigits{$colours[2]}{value};
if (exists $colours[3]) { if (exists $colours[3]) {
$marginE = $coloursToDigits{$colours[3]}{tolerance}; $marginE = $coloursToDigits{$colours[3]}{tolerance};
} else { } else {
$marginE = 20; $marginE = 20;
} }
@ -67,7 +67,7 @@ handle query_raw => sub {
if ($resistance > 1000000000) { if ($resistance > 1000000000) {
$resistance = $resistance / 1000000000; $resistance = $resistance / 1000000000;
$append = "G"; $append = "G";
} }
#U+2126 is the ohm symbol, U+00B1 is the plus-minus sign. #U+2126 is the ohm symbol, U+00B1 is the plus-minus sign.
my $answer = "A $_ resistor has a resistance of $resistance $append\x{2126} \x{00B1} $marginE\%."; my $answer = "A $_ resistor has a resistance of $resistance $append\x{2126} \x{00B1} $marginE\%.";
my $source = '<a href="https://en.wikipedia.org/wiki/Electronic_color_code">More at Wikipedia</a>'; my $source = '<a href="https://en.wikipedia.org/wiki/Electronic_color_code">More at Wikipedia</a>';

View File

@ -19,7 +19,7 @@ zci is_cached => 1;
handle remainder => sub { handle remainder => sub {
if ($_) { if ($_) {
$_ =~ tr[a-zA-Z][n-za-mN-ZA-M]; $_ =~ tr[a-zA-Z][n-za-mN-ZA-M];
return "ROT13: $_"; return "ROT13: $_";
}; };
return; return;

View File

@ -4378,10 +4378,10 @@ handle query => sub {
# default $router password # default $router password
|^(?:(?:default|password)\ )(.+)(?:\ (?:default|password))$ |^(?:(?:default|password)\ )(.+)(?:\ (?:default|password))$
# $router default password # $router default password
# default password $router # default password $router
|^(?:(.+)\ )?(?:default\ password|password\ default)(?:\ (.+))?$ |^(?:(.+)\ )?(?:default\ password|password\ default)(?:\ (.+))?$
# password $router # password $router
# $router password # $router password
|^(?:(.+)\ )?(?:password)(?:\ (.+))?$ |^(?:(.+)\ )?(?:password)(?:\ (.+))?$
# $router # $router
|^(.+)$ |^(.+)$

View File

@ -14,8 +14,8 @@ topics 'special_interest';
source 'http://math.cos.ucf.edu/~reid/Rubik/patterns.html'; source 'http://math.cos.ucf.edu/~reid/Rubik/patterns.html';
attribution web => ['robert.io', 'Robert Picard'], twitter => '__rlp', github => ['https://github.com/rpicard', 'rpicard']; attribution web => ['robert.io', 'Robert Picard'], twitter => '__rlp', github => ['https://github.com/rpicard', 'rpicard'];
triggers start => "rcube", "rubik", "rubiks", "rubix", triggers start => "rcube", "rubik", "rubiks", "rubix",
"rubicks", "rubik's", "rubic's", "rubick's", "rubicks", "rubik's", "rubic's", "rubick's",
"rubik cube", "rubiks cube", "rubic cube", "rubics cube", "rubik cube", "rubiks cube", "rubic cube", "rubics cube",
"rubik's cube patterns", "rubiks cube patterns"; "rubik's cube patterns", "rubiks cube patterns";
@ -28,15 +28,15 @@ our %patterns = (
"swap centers" => "U D' R L' F B' U D'", "swap centers" => "U D' R L' F B' U D'",
"checkerboard" => "F2 B2 R2 L2 U2 D2", "checkerboard" => "F2 B2 R2 L2 U2 D2",
"cube in a cube" => "F L F U' R U F2 L2 U' L' B D' B' L2 U", "cube in a cube" => "F L F U' R U F2 L2 U' L' B D' B' L2 U",
"cube in a cube in a cube" => "U' L' U' F' R2 B' R F U B2 U B' L U' F U R F'", "cube in a cube in a cube" => "U' L' U' F' R2 B' R F U B2 U B' L U' F U R F'",
"exchanged peaks" => "F2 R2 D R2 U D F2 D' R' D' F L2 F' D R U'", "exchanged peaks" => "F2 R2 D R2 U D F2 D' R' D' F L2 F' D R U'",
"t's" => "F2 R2 U2 F' B D2 L2 F B", "t's" => "F2 R2 U2 F' B D2 L2 F B",
"anaconda" => "L U B' U' R L' B R' F B' D R D' F'", "anaconda" => "L U B' U' R L' B R' F B' D R D' F'",
"python" => "F2 R' B' U R' L F' L F' B D' R B L2", "python" => "F2 R' B' U R' L F' L F' B D' R B L2",
"black mamba" => "R D L F' R L' D R' U D' B U' R' D'", "black mamba" => "R D L F' R L' D R' U D' B U' R' D'",
); );
sub to_titlecase($) sub to_titlecase($)
{ {
$a = pop; $a = pop;
$a =~ s/(\w\S*)/\u\L$1/g; $a =~ s/(\w\S*)/\u\L$1/g;
@ -49,7 +49,7 @@ sub render_text($) {
my $name = pop; my $name = pop;
return to_titlecase($name) . ": $patterns{$name} \n"; return to_titlecase($name) . ": $patterns{$name} \n";
} }
sub render_html($) { sub render_html($) {
my $name = pop; my $name = pop;
my $output = "<div><i>" . to_titlecase($name) . "</i>"; my $output = "<div><i>" . to_titlecase($name) . "</i>";
@ -60,16 +60,16 @@ sub render_html($) {
handle remainder => sub { handle remainder => sub {
$_ = lc($_); $_ = lc($_);
#support British English! #support British English!
s/centre/center/; s/centre/center/;
#hack for the trigger "rubiks cube in a cube" #hack for the trigger "rubiks cube in a cube"
s/^in a cube/cube in a cube/; s/^in a cube/cube in a cube/;
#show answer #show answer
return render_text($_), html => render_html($_) if ($patterns{$_}); return render_text($_), html => render_html($_) if ($patterns{$_});
#display the cheatsheet #display the cheatsheet
my $output = my $html_output = ""; my $output = my $html_output = "";
foreach my $pattern (keys %patterns) { foreach my $pattern (keys %patterns) {

View File

@ -1,6 +1,6 @@
#!/bin/env perl #!/bin/env perl
package DDG::Goodie::SubnetCalc; package DDG::Goodie::SubnetCalc;
# ABSTRACT: Calculate IP ranges & Subnet Information from a host & CIDR or netmask # ABSTRACT: Calculate IP ranges & Subnet Information from a host & CIDR or netmask
use strict; use strict;
use warnings; use warnings;
@ -35,7 +35,7 @@ handle query => sub {
my ($input) = @_; my ($input) = @_;
my ($address, $cidr) = split qr`[\s/]`, $input; my ($address, $cidr) = split qr`[\s/]`, $input;
my @octlets = split /\./, $address; my @octlets = split /\./, $address;
for (@octlets) { for (@octlets) {
return if int($_) > 255; return if int($_) > 255;
@ -48,8 +48,8 @@ handle query => sub {
# Convert CIDR & Subnets # Convert CIDR & Subnets
if ($cidr =~ /^[0-9]+$/) { if ($cidr =~ /^[0-9]+$/) {
return if ($cidr > 32 || $cidr < 1); return if ($cidr > 32 || $cidr < 1);
$wildcard_mask = 2**(32-$cidr) - 1; $wildcard_mask = 2**(32-$cidr) - 1;
# Flip the bits. # Flip the bits.
$mask = 0xffffffff ^ $wildcard_mask; $mask = 0xffffffff ^ $wildcard_mask;
} elsif ($cidr =~ /([0-9]{1,3}\.){3}([0-9]{1,3})/) { } elsif ($cidr =~ /([0-9]{1,3}\.){3}([0-9]{1,3})/) {
@ -59,44 +59,44 @@ handle query => sub {
for(@cidr_octlets) { for(@cidr_octlets) {
return if int($_) > 255; return if int($_) > 255;
} }
$mask = ip_to_int(@cidr_octlets); $mask = ip_to_int(@cidr_octlets);
# Convert the integer into its binary representation. # Convert the integer into its binary representation.
my $mask_binary = sprintf("%b", $mask); my $mask_binary = sprintf("%b", $mask);
# The mask cannot have alternating 1s and 0s. # The mask cannot have alternating 1s and 0s.
return unless ($mask_binary =~ /^1+0*$/); return unless ($mask_binary =~ /^1+0*$/);
# Flip the bits. # Flip the bits.
$wildcard_mask = 0xffffffff ^ $mask; $wildcard_mask = 0xffffffff ^ $mask;
# Count the number of 1s. # Count the number of 1s.
$cidr = ($mask_binary =~ tr/1//); $cidr = ($mask_binary =~ tr/1//);
} else { } else {
return; return;
} }
my $host = $address_raw & $wildcard_mask; my $host = $address_raw & $wildcard_mask;
my $network = $address_raw & $mask; my $network = $address_raw & $mask;
my $start = $network + 1; my $start = $network + 1;
my $end = $network + ($wildcard_mask - 1); my $end = $network + ($wildcard_mask - 1);
my $broadcast = $network + $wildcard_mask; my $broadcast = $network + $wildcard_mask;
my $host_count = 1 + $end - $start; my $host_count = 1 + $end - $start;
# Check the class type of the IP address. # Check the class type of the IP address.
my $class = "A"; my $class = "A";
$class = "E (reserved)" if (($network >> 28 & 0x0F) == 0x0F); $class = "E (reserved)" if (($network >> 28 & 0x0F) == 0x0F);
$class = "D (multicast)" if (($network >> 28 & 0x0F) == 0x0E); $class = "D (multicast)" if (($network >> 28 & 0x0F) == 0x0E);
$class = "C" if (($network >> 29 & 0x07) == 0x06); $class = "C" if (($network >> 29 & 0x07) == 0x06);
$class = "B" if (($network >> 30 & 0x03) == 0x02); $class = "B" if (($network >> 30 & 0x03) == 0x02);
my $which_specified = "Host #".($host); my $which_specified = "Host #".($host);
$which_specified = "Network" if ($host == 0); $which_specified = "Network" if ($host == 0);
$which_specified = "Broadcast" if ($host == $host_count+1); $which_specified = "Broadcast" if ($host == $host_count+1);
$which_specified = "Point-To-Point (".int_to_str($end).", ".int_to_str($start).")" if ($cidr == 31); $which_specified = "Point-To-Point (".int_to_str($end).", ".int_to_str($start).")" if ($cidr == 31);
$which_specified = "Host Only" if ($cidr == 32); $which_specified = "Host Only" if ($cidr == 32);
sub to_html { sub to_html {
my $results = ""; my $results = "";
my $minwidth = "70px"; my $minwidth = "70px";
@ -121,12 +121,12 @@ handle query => sub {
["Netmask", int_to_str($mask)], ["Netmask", int_to_str($mask)],
["Specified", "$which_specified"], ["Specified", "$which_specified"],
); );
unless($cidr > 30) { unless($cidr > 30) {
push @output, (["Host Address Range", int_to_str($start) . "-" . int_to_str($end) . " ($host_count hosts)"], push @output, (["Host Address Range", int_to_str($start) . "-" . int_to_str($end) . " ($host_count hosts)"],
["Broadcast", int_to_str($broadcast)]); ["Broadcast", int_to_str($broadcast)]);
} }
return answer => to_text(@output), html => to_html(@output); return answer => to_text(@output), html => to_html(@output);
}; };

View File

@ -28,7 +28,7 @@ sub parse_to_html_table(@)
for my $line (@sudoku_lines) for my $line (@sudoku_lines)
{ {
my @chars = split(/ /, $line); my @chars = split(/ /, $line);
for my $char (@chars) for my $char (@chars)
{ {
$char = "<input maxlength='1'/>" if $char eq "_"; $char = "<input maxlength='1'/>" if $char eq "_";
} }
@ -54,13 +54,13 @@ handle remainder => sub {
$sudoku->generate(blanks => (9 ** 2) * $blanks); $sudoku->generate(blanks => (9 ** 2) * $blanks);
my $str_output = $sudoku->as_string(); my $str_output = $sudoku->as_string();
#switch 0 to more sensible placeholders #switch 0 to more sensible placeholders
$str_output =~ s/0/_/g; $str_output =~ s/0/_/g;
my @sudoku_lines = split(/\n/, $str_output); my @sudoku_lines = split(/\n/, $str_output);
my $html_table = parse_to_html_table(@sudoku_lines); my $html_table = parse_to_html_table(@sudoku_lines);
return $str_output, html => $html_table; return $str_output, html => $html_table;
}; };

View File

@ -24,14 +24,14 @@ zci is_cached => 1;
handle remainder => sub { handle remainder => sub {
my @output = (); my @output = ();
# Create an IPv6 address from the query value # Create an IPv6 address from the query value
my $ip = new Net::IP ($_,6) if $_; my $ip = new Net::IP ($_,6) if $_;
# Verify the query value is a valid Teredo IPv6 address # Verify the query value is a valid Teredo IPv6 address
if ((defined $ip) && ($ip->version() == 6) && (substr($ip->ip(),0,9) eq "2001:0000")) { if ((defined $ip) && ($ip->version() == 6) && (substr($ip->ip(),0,9) eq "2001:0000")) {
my $binip = $ip->binip(); my $binip = $ip->binip();
# bits 32 to 64 designate IPv4 address of the Teredo server used # bits 32 to 64 designate IPv4 address of the Teredo server used
push @output, (new Net::IP (Net::IP::ip_bintoip((substr $binip, 32, 32),4))); push @output, (new Net::IP (Net::IP::ip_bintoip((substr $binip, 32, 32),4)));
@ -52,8 +52,8 @@ handle remainder => sub {
# Params: server, port, client # Params: server, port, client
sub to_html { sub to_html {
return "<div><span class=\"teredo__label text--secondary\">Teredo Server IPv4: </span><span class=\"text--primary\">" . $_[0]->ip() return "<div><span class=\"teredo__label text--secondary\">Teredo Server IPv4: </span><span class=\"text--primary\">" . $_[0]->ip()
. "</span></div><div><span class=\"teredo__label text--secondary\">NAT Public IPv4: </span><span class=\"text--primary\">" . $_[2]->ip() . "</span></div><div><span class=\"teredo__label text--secondary\">NAT Public IPv4: </span><span class=\"text--primary\">" . $_[2]->ip()
. "</span></div><div><span class=\"teredo__label text--secondary\">Client Port: </span><span class=\"text--primary\">" . $_[1] . "</span></div>"; . "</span></div><div><span class=\"teredo__label text--secondary\">Client Port: </span><span class=\"text--primary\">" . $_[1] . "</span></div>";
} }
}; };

View File

@ -18,7 +18,7 @@ secondary_example_queries 'tmux quick reference', 'tmux guide';
triggers startend => ( triggers startend => (
'tmux cheat sheet', 'tmux cheat sheet',
'tmux cheatsheet', 'tmux cheatsheet',
'tmux commands', 'tmux commands',
'tmux guide', 'tmux guide',
'tmux help', 'tmux help',
@ -37,7 +37,7 @@ attribution github => ["charles-l", "Charles Saternos"],
web => ["http://charles-l.github.io", "Charles Saternos"]; web => ["http://charles-l.github.io", "Charles Saternos"];
handle remainder => sub { handle remainder => sub {
return return
heading => 'Tmux Cheat Sheet', heading => 'Tmux Cheat Sheet',
html => html_cheat_sheet(), html => html_cheat_sheet(),
answer => text_cheat_sheet(), answer => text_cheat_sheet(),

View File

@ -28,7 +28,7 @@ handle query_raw => sub {
#remove triggers and trim #remove triggers and trim
s/(^$trigger_words)|($trigger_words$)//i; s/(^$trigger_words)|($trigger_words$)//i;
s/(^\s+)|(\s+$)//; s/(^\s+)|(\s+$)//;
my $decoded = decodeURIComponent($_); my $decoded = decodeURIComponent($_);
if($decoded =~ /^\s+$/) if($decoded =~ /^\s+$/)

View File

@ -2,16 +2,16 @@ package DDG::Goodie::UltimateAnswer;
# ABSTRACT: A Hitchhiker's Guide to the Galaxy easter egg. # ABSTRACT: A Hitchhiker's Guide to the Galaxy easter egg.
use DDG::Goodie; use DDG::Goodie;
triggers start => 'what is the ultimate answer', 'what is the ultimate answer to life the universe and everything', 'what is the answer to the ultimate question of life the universe and everything'; triggers start => 'what is the ultimate answer', 'what is the ultimate answer to life the universe and everything', 'what is the answer to the ultimate question of life the universe and everything';
primary_example_queries 'what is the answer to the ultimate question of life the universe and everything'; primary_example_queries 'what is the answer to the ultimate question of life the universe and everything';
name 'Ultimate Answer'; name 'Ultimate Answer';
description 'Hichhiker\'s Guide to the Galaxy reference.'; description 'Hichhiker\'s Guide to the Galaxy reference.';
category 'special'; category 'special';
topics 'entertainment'; topics 'entertainment';
code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/UltimateAnswer.pm'; code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/UltimateAnswer.pm';
attribution github => ['https://github.com/jfeeneywm/', 'jfeeneywm'], attribution github => ['https://github.com/jfeeneywm/', 'jfeeneywm'],
twitter => ['https://twitter.com/jfeeneywm', 'jfeeneywm']; twitter => ['https://twitter.com/jfeeneywm', 'jfeeneywm'];
zci answer_type => 'UltimateAnswer'; zci answer_type => 'UltimateAnswer';

View File

@ -1,5 +1,5 @@
package DDG::Goodie::Unicornify; package DDG::Goodie::Unicornify;
# ABSTRACT: Return Gravatar image given an email address # ABSTRACT: Return Gravatar image given an email address
use DDG::Goodie; use DDG::Goodie;
use CGI qw/img/; use CGI qw/img/;
@ -13,13 +13,13 @@ handle remainder => sub {
my $link = 'http://unicornify.appspot.com/'; my $link = 'http://unicornify.appspot.com/';
if (Email::Valid->address($_)) { if (Email::Valid->address($_)) {
s/[\s\t]+//g; # strip whitespace from the remainder, we just need the email address. s/[\s\t]+//g; # strip whitespace from the remainder, we just need the email address.
my $answer = 'This is a unique unicorn for ' . $_ . ':' . "\nLearn more at unicornify.appspot.com"; my $answer = 'This is a unique unicorn for ' . $_ . ':' . "\nLearn more at unicornify.appspot.com";
my $heading = $_ . ' (Unicornify)'; my $heading = $_ . ' (Unicornify)';
my $html = 'This is a unique unicorn for ' . $_ . ':' my $html = 'This is a unique unicorn for ' . $_ . ':'
.'<br /><a href="' . unicornify_url(email => $_, size => 128) .'">' .'<br /><a href="' . unicornify_url(email => $_, size => 128) .'">'
.'<img src="/iu/?u='.unicornify_url(email => $_, size => "100").'" class="zci--unicornify-img" /></a>' .'<img src="/iu/?u='.unicornify_url(email => $_, size => "100").'" class="zci--unicornify-img" /></a>'
. 'Learn more at <a href="'.$link.'">unicornify.appspot.com</a>'; . 'Learn more at <a href="'.$link.'">unicornify.appspot.com</a>';
return $answer, heading => $heading, html => $html; return $answer, heading => $heading, html => $html;
} }
return; return;

View File

@ -27,11 +27,11 @@ handle remainder => sub {
return unless $_; return unless $_;
my $upper = uc $_; my $upper = uc $_;
my $text = $upper; my $text = $upper;
# Encode the variable before putting it in HTML. # Encode the variable before putting it in HTML.
# There's no need to encode the $text variable because that gets encoded internally. # There's no need to encode the $text variable because that gets encoded internally.
$upper = html_enc($upper); $upper = html_enc($upper);
my $html = qq(<div class="zci--uppercase"><span class="text--primary">$upper</span></div>); my $html = qq(<div class="zci--uppercase"><span class="text--primary">$upper</span></div>);
return $text, html => $html; return $text, html => $html;

View File

@ -17,15 +17,15 @@ primary_example_queries 'vim help', 'vim cheat sheet', 'vim commands';
secondary_example_queries 'vi quick reference', 'vi commands', 'vi guide'; secondary_example_queries 'vi quick reference', 'vi commands', 'vi guide';
triggers startend => ( triggers startend => (
'vi cheat sheet', 'vi cheat sheet',
'vi cheatsheet', 'vi cheatsheet',
'vi commands', 'vi commands',
'vi guide', 'vi guide',
'vi help', 'vi help',
'vi quick reference', 'vi quick reference',
'vi reference', 'vi reference',
'vim cheat sheet', 'vim cheat sheet',
'vim cheatsheet', 'vim cheatsheet',
'vim commands', 'vim commands',
'vim guide', 'vim guide',
'vim help', 'vim help',
@ -38,7 +38,7 @@ attribution github => ["kablamo", "Eric Johnson"],
web => ["http://kablamo.org", "Eric Johnson"]; web => ["http://kablamo.org", "Eric Johnson"];
handle remainder => sub { handle remainder => sub {
return return
heading => 'Vim Cheat Sheet', heading => 'Vim Cheat Sheet',
html => html_cheat_sheet(), html => html_cheat_sheet(),
answer => text_cheat_sheet(), answer => text_cheat_sheet(),

View File

@ -36,7 +36,7 @@ handle remainder => sub {
return unless $_ =~ qr/^($datestring_regex) (?:(?:and|to) )?($datestring_regex)/i; return unless $_ =~ qr/^($datestring_regex) (?:(?:and|to) )?($datestring_regex)/i;
my ($start, $end) = (parse_datestring_to_date($1), parse_datestring_to_date($2)); my ($start, $end) = (parse_datestring_to_date($1), parse_datestring_to_date($2));
return unless ($start && $end); return unless ($start && $end);
# Flip if the dates are the wrong way around # Flip if the dates are the wrong way around
($end, $start) = ($start, $end) if ( DateTime->compare($start, $end) == 1 ); ($end, $start) = ($start, $end) if ( DateTime->compare($start, $end) == 1 );
@ -60,16 +60,16 @@ sub delta_weekdays {
my $difference = $start->delta_days($end); my $difference = $start->delta_days($end);
$day_count = $difference->in_units('days') + 1; # always inclusive $day_count = $difference->in_units('days') + 1; # always inclusive
return 0 unless $day_count > 0 ; return 0 unless $day_count > 0 ;
$dow1 = $start->day_of_week(); $dow1 = $start->day_of_week();
$wholeweeks = int($day_count / 7); $wholeweeks = int($day_count / 7);
$result = $wholeweeks * 5; $result = $wholeweeks * 5;
$temp = $day_count - $wholeweeks * 7; $temp = $day_count - $wholeweeks * 7;
$dow2 = $dow1 - 1 + $temp; $dow2 = $dow1 - 1 + $temp;
$dow2 -= 7 if($dow2 > 7); $dow2 -= 7 if($dow2 > 7);
for(;;) { for(;;) {
@ -78,7 +78,7 @@ sub delta_weekdays {
$dow1 = $dow1 + 1; $dow1 = $dow1 + 1;
$dow1 = $dow1 - 7 if($dow1 > 7); $dow1 = $dow1 - 7 if($dow1 > 7);
} }
return $result; return $result;
} }

View File

@ -32,7 +32,7 @@ handle remainder => sub {
my ($start_date, $end_date) = parse_all_datestrings_to_date($1, $2); my ($start_date, $end_date) = parse_all_datestrings_to_date($1, $2);
return unless ($start_date && $end_date); return unless ($start_date && $end_date);
($start_date, $end_date) = ($end_date, $start_date) if (DateTime->compare($start_date, $end_date) == 1); ($start_date, $end_date) = ($end_date, $start_date) if (DateTime->compare($start_date, $end_date) == 1);
my $calendar = Date::Calendar->new($Profiles->{US}); my $calendar = Date::Calendar->new($Profiles->{US});

View File

@ -21,7 +21,7 @@ my @quotes = share('quotes.txt')->slurp;
handle query => sub { handle query => sub {
# Ensure rand is seeded for each process # Ensure rand is seeded for each process
srand(); srand();
return if $_ !~ m/quotes?/; return if $_ !~ m/quotes?/;
my $rand = int(rand(scalar(@quotes))); my $rand = int(rand(scalar(@quotes)));
my $quote = $quotes[$rand]; my $quote = $quotes[$rand];

View File

@ -398,7 +398,7 @@ sub parse_descriptive_datestring_to_date {
my $now = DateTime->now(); my $now = DateTime->now();
my $month = $+{'m'}; # Set in each alternative match. my $month = $+{'m'}; # Set in each alternative match.
if (my $day = $+{'d'}) { if (my $day = $+{'d'}) {
return parse_datestring_to_date("$day $month ".$now->year()); return parse_datestring_to_date("$day $month ".$now->year());
} }

View File

@ -38,8 +38,8 @@
</style> </style>
<div class="crontab-container"> <div class="crontab-container">
<div class="crontab-column"> <div class="crontab-column">
<p>Commands are executed by cron when the minute, hour, and month <p>Commands are executed by cron when the minute, hour, and month
fields match the current time, and at least one of the two day fields fields match the current time, and at least one of the two day fields
(day of month, or day of week) match the current time. A field may be (day of month, or day of week) match the current time. A field may be
an asterisk (<code>*</code>), which will always match.</p> an asterisk (<code>*</code>), which will always match.</p>
<table> <table>

View File

@ -1,8 +1,8 @@
# Commands are executed by cron when the minute, hour, and month of year # Commands are executed by cron when the minute, hour, and month of year
# fields match the current time, and at least one of the two day fields # fields match the current time, and at least one of the two day fields
# (day of month, or day of week) match the current time. A field may be # (day of month, or day of week) match the current time. A field may be
# an asterisk (*), which will always match. # an asterisk (*), which will always match.
# #
# Fields in order: # Fields in order:
# minute (0-59) # minute (0-59)
# hour (0-23) # hour (0-23)

View File

@ -1,6 +1,6 @@
parser.py generates currencies.txt for 'CurrencyIn.pm' module. parser.py generates currencies.txt for 'CurrencyIn.pm' module.
Currencies for each country are from: Currencies for each country are from:
http://en.wikipedia.org/wiki/List_of_circulating_currencies http://en.wikipedia.org/wiki/List_of_circulating_currencies
First run: 'fetch.sh' to fetch wikipedia page used by parser, First run: 'fetch.sh' to fetch wikipedia page used by parser,
@ -9,13 +9,13 @@ then run: 'parse.sh' or just 'python parse.py'
DETAILS: DETAILS:
Output is the file (currencies.txt) with list of countries and currencies with iso code in () Output is the file (currencies.txt) with list of countries and currencies with iso code in ()
For example: For example:
slovakia slovakia
Euro (EUR) Euro (EUR)
If there is more than one currency used by each country then each currency is separated by comma If there is more than one currency used by each country then each currency is separated by comma
For example: For example:
zimbabwe zimbabwe
Botswana pula (BWP),British pound (GBP) Botswana pula (BWP),British pound (GBP)
Country name is lowercased for better comparison with user input. But it gets capitalized in search results. Country name is lowercased for better comparison with user input. But it gets capitalized in search results.

View File

@ -1,7 +1,7 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Released under the GPL v2 license # Released under the GPL v2 license
# https://www.gnu.org/licenses/old-licenses/gpl-2.0.html # https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
import lxml.html import lxml.html
@ -44,10 +44,10 @@ for table in tables:
if len(cells) == 5: if len(cells) == 5:
currency = cells[0].text_content() currency = cells[0].text_content()
iso_code = cells[2].text_content() iso_code = cells[2].text_content()
currency = clear_text(currency) currency = clear_text(currency)
iso_code = iso_code if iso_code != "None" else "" iso_code = iso_code if iso_code != "None" else ""
if currency != "None" and currency != "": if currency != "None" and currency != "":
add_currency(country[1:], currency, iso_code, countries) add_currency(country[1:], currency, iso_code, countries)
@ -58,7 +58,7 @@ result = []
for country in sorted(countries): for country in sorted(countries):
description = "" description = ""
formated_record = [] formated_record = []
for record in countries[country]: for record in countries[country]:
iso_code = "" if record[1] == "" else (" (" + record[1] + ")") iso_code = "" if record[1] == "" else (" (" + record[1] + ")")
currency = record[0] currency = record[0]

View File

@ -61,7 +61,7 @@ Reading & use of other information media
029 029
No longer used, formerly Literary methods No longer used, formerly Literary methods
030 030
General [[encyclopedic]] works General [[encyclopedic]] works
031 031
Encyclopedias in American English Encyclopedias in American English
032 032
@ -225,7 +225,7 @@ Metaphysics
111 111
[[Ontology]] [[Ontology]]
112 112
No longer usedâformerly [[Methodology]] No longer usedâformerly [[Methodology]]
113 113
[[Cosmology]] ([[Philosophy of nature]]) [[Cosmology]] ([[Philosophy of nature]])
114 114
@ -303,7 +303,7 @@ Other philosophical systems
150 150
Psychology Psychology
151 151
No longer usedâformerly Intellect No longer usedâformerly Intellect
152 152
[[Perception]], [[Motion (physics)|movement]], [[emotion]]s, and [[Motivation|drive]]s [[Perception]], [[Motion (physics)|movement]], [[emotion]]s, and [[Motivation|drive]]s
153 153
@ -319,7 +319,7 @@ No longer usedâformerly [[Emotion]]s
158 158
[[Applied psychology]] [[Applied psychology]]
159 159
No longer usedâformerly Will No longer usedâformerly Will
160 160
Logic Logic
161 161
@ -327,9 +327,9 @@ Logic
162 162
[[Deductive reasoning|Deduction]] [[Deductive reasoning|Deduction]]
163 163
Not assigned or no longer used Not assigned or no longer used
164 164
Not assigned or no longer used Not assigned or no longer used
165 165
[[fallacy|Fallacies]] and sources of error [[fallacy|Fallacies]] and sources of error
166 166
@ -431,7 +431,7 @@ Sources
215 215
[[Relationship between religion and science|Science & religion]] [[Relationship between religion and science|Science & religion]]
216 216
No longer usedâformerly Evil No longer usedâformerly Evil
217 217
No longer usedâformerly Prayer No longer usedâformerly Prayer
218 218
@ -469,7 +469,7 @@ Spiritual beings
236 236
[[Christian eschatology|Eschatology]] [[Christian eschatology|Eschatology]]
237 237
No longer usedâformerly Future state No longer usedâformerly Future state
238 238
[[Creed]]s & [[catechism]]s [[Creed]]s & [[catechism]]s
239 239
@ -503,11 +503,11 @@ Pastoral office ([[Pastoral theology]])
255 255
[[Congregation (catholic)|Religious congregations]] & orders [[Congregation (catholic)|Religious congregations]] & orders
256 256
No longer usedâformerly Religious societies No longer usedâformerly Religious societies
257 257
No longer usedâformerly Parochial schools, libraries, etc. No longer usedâformerly Parochial schools, libraries, etc.
258 258
No longer usedâformerly Parochial medicine No longer usedâformerly Parochial medicine
259 259
Activities of the local church Activities of the local church
261 261
@ -561,7 +561,7 @@ Christian church in other areas
287 287
[[Methodist]] & related churches [[Methodist]] & related churches
288 288
No longer usedâformerly [[Unitarianism|Unitarian]] No longer usedâformerly [[Unitarianism|Unitarian]]
289 289
Other denominations & sects Other denominations & sects
291 291
@ -579,7 +579,7 @@ Classical ([[Ancient Greek religion|Greek]] & [[Religion in ancient Rome|Roman]]
297 297
[[Islam]], [[Bábism]] & [[Bahá'í Faith]] [[Islam]], [[Bábism]] & [[Bahá'í Faith]]
298 298
No longer usedâformerly [[Mormonism]] No longer usedâformerly [[Mormonism]]
299 299
Other religions Other religions
300 300
@ -721,9 +721,9 @@ School management; special education
375 375
[[Curriculum]]s [[Curriculum]]s
376 376
No longer usedâformerly Education of women No longer usedâformerly Education of women
377 377
No longer usedâformerly Ethical education No longer usedâformerly Ethical education
378 378
[[Higher education]] [[Higher education]]
379 379
@ -759,7 +759,7 @@ Etiquette ([[Manners]])
396 396
No longer usedâformerly Women's position and treatment No longer usedâformerly Women's position and treatment
397 397
No longer usedâformerly [[Outcast (person)|outcast]] studies No longer usedâformerly [[Outcast (person)|outcast]] studies
398 398
[[Folklore]] [[Folklore]]
399 399
@ -795,7 +795,7 @@ Geographical & persons treatment
415 415
Structural systems ([[Grammar]]) Structural systems ([[Grammar]])
416 416
No longer usedâformerly [[Prosody (linguistics)]] No longer usedâformerly [[Prosody (linguistics)]]
417 417
[[Dialectology]] & [[historical linguistics]] [[Dialectology]] & [[historical linguistics]]
418 418
@ -827,11 +827,11 @@ German etymology
433 433
German dictionaries German dictionaries
434 434
Not assigned or no longer used Not assigned or no longer used
435 435
[[German grammar]] [[German grammar]]
436 436
Not assigned or no longer used Not assigned or no longer used
437 437
[[German dialects|German language variations]] [[German dialects|German language variations]]
438 438
@ -845,11 +845,11 @@ French etymology
443 443
French dictionaries French dictionaries
444 444
Not assigned or no longer used Not assigned or no longer used
445 445
[[French grammar]] [[French grammar]]
446 446
Not assigned or no longer used Not assigned or no longer used
447 447
[[Dialects of French|French language variations]] [[Dialects of French|French language variations]]
448 448
@ -863,11 +863,11 @@ Italian etymology
453 453
Italian dictionaries Italian dictionaries
454 454
Not assigned or no longer used Not assigned or no longer used
455 455
[[Italian grammar]] [[Italian grammar]]
456 456
Not assigned or no longer used Not assigned or no longer used
457 457
[[Italian dialects|Italian language variations]] [[Italian dialects|Italian language variations]]
458 458
@ -881,11 +881,11 @@ Spanish etymology
463 463
Spanish dictionaries Spanish dictionaries
464 464
Not assigned or no longer used Not assigned or no longer used
465 465
[[Spanish grammar]] [[Spanish grammar]]
466 466
Not assigned or no longer used Not assigned or no longer used
467 467
[[Spanish dialects and varieties|Spanish language variations]] [[Spanish dialects and varieties|Spanish language variations]]
468 468
@ -899,11 +899,11 @@ Portuguese
473 473
Classical Latin dictionaries Classical Latin dictionaries
474 474
Not assigned or no longer used Not assigned or no longer used
475 475
Classical [[Latin grammar]] Classical [[Latin grammar]]
476 476
Not assigned or no longer used Not assigned or no longer used
477 477
[[old Latin|Old]], Postclassical, [[Vulgar Latin]] [[old Latin|Old]], Postclassical, [[Vulgar Latin]]
478 478
@ -917,11 +917,11 @@ Classical Greek etymology
483 483
Classical Greek dictionaries Classical Greek dictionaries
484 484
Not assigned or no longer used Not assigned or no longer used
485 485
Classical Greek grammar Classical Greek grammar
486 486
Not assigned or no longer used Not assigned or no longer used
487 487
Preclassical & postclassical Greek Preclassical & postclassical Greek
488 488
@ -955,7 +955,7 @@ Miscellany
503 503
Dictionaries & encyclopedias Dictionaries & encyclopedias
504 504
Not assigned or no longer used Not assigned or no longer used
505 505
Serial publications Serial publications
506 506
@ -979,7 +979,7 @@ General principles
516 516
[[Topic outline of geometry|Geometry]] [[Topic outline of geometry|Geometry]]
517 517
Not assigned or no longer used Not assigned or no longer used
518 518
[[Numerical analysis]] [[Numerical analysis]]
519 519
@ -991,7 +991,7 @@ Techniques, equipment, materials
523 523
Specific celestial bodies & phenomena Specific celestial bodies & phenomena
524 524
Not assigned or no longer used Not assigned or no longer used
525 525
[[Earth]] (Astronomical geography) [[Earth]] (Astronomical geography)
526 526
@ -1109,7 +1109,7 @@ Not assigned or no longer used
588 588
[[Bryophyte|Bryophyta]] [[Bryophyte|Bryophyta]]
589 589
Forestry Forestry
591 591
[[Outline of zoology|Zoology]] [[Outline of zoology|Zoology]]
592 592
@ -1177,7 +1177,7 @@ Incidence & prevention of disease
625 625
Engineering of [[railroad]]s, [[road]]s Engineering of [[railroad]]s, [[road]]s
626 626
Not assigned or no longer used Not assigned or no longer used
627 627
[[Hydraulic engineering]] [[Hydraulic engineering]]
628 628
@ -1227,11 +1227,11 @@ Processes of written communication
653 653
[[Shorthand]] [[Shorthand]]
654 654
Not assigned or no longer used Not assigned or no longer used
655 655
Not assigned or no longer used Not assigned or no longer used
656 656
Not assigned or no longer used Not assigned or no longer used
657 657
[[Accounting]] [[Accounting]]
658 658
@ -1291,7 +1291,7 @@ Clothing
688 688
Other final products & [[packaging]] Other final products & [[packaging]]
689 689
Not assigned or no longer used Not assigned or no longer used
691 691
Building [[material]]s Building [[material]]s
692 692
@ -1391,7 +1391,7 @@ Drawing & drawings
743 743
Drawing & drawings by subject Drawing & drawings by subject
744 744
Not assigned or no longer used Not assigned or no longer used
745 745
Decorative arts Decorative arts
746 746
@ -1413,7 +1413,7 @@ Techniques, equipment, forms
755 755
[[iconography|Religion & religious symbolism]] [[iconography|Religion & religious symbolism]]
756 756
Not assigned or no longer used Not assigned or no longer used
757 757
Human figures & their parts Human figures & their parts
758 758
@ -1423,7 +1423,7 @@ Geographical, [[History of painting|historical]], areas, persons treatment
761 761
Relief processes ([[Block printing]]) Relief processes ([[Block printing]])
762 762
Not assigned or no longer used Not assigned or no longer used
763 763
[[lithography|Lithographic]] (Planographic) processes [[lithography|Lithographic]] (Planographic) processes
764 764
@ -1435,7 +1435,7 @@ Metal [[engraving]]
767 767
[[Etching]] & [[drypoint]] [[Etching]] & [[drypoint]]
768 768
Not assigned or no longer used Not assigned or no longer used
769 769
Prints Prints
771 771
@ -1451,7 +1451,7 @@ Pigment processes of printing
776 776
[[Computer art]] [[Computer art]]
777 777
[[Cinematography]] and [[Videography]] <ref>{{cite web|title=WebDewey 2.0 installs DDC 23!|url=http://www.oclc.org/uk/en/news/announcements/2011/announcement39.htm|work=WebDewey 2.0|publisher=OCLC Online Computer Library Center, Inc.|accessdate=02/13/2012}}</ref>ref> [[Cinematography]] and [[Videography]] <ref>{{cite web|title=WebDewey 2.0 installs DDC 23!|url=http://www.oclc.org/uk/en/news/announcements/2011/announcement39.htm|work=WebDewey 2.0|publisher=OCLC Online Computer Library Center, Inc.|accessdate=02/13/2012}}</ref>ref>
778 778
[[:Category:Photography by genre|Fields & kinds of photography]] [[:Category:Photography by genre|Fields & kinds of photography]]
779 779
@ -1473,7 +1473,7 @@ Music for single voices; The [[human voice|voice]]
788 788
[[Wind instrument]]s (Aerophones) [[Wind instrument]]s (Aerophones)
789 789
Not assigned or no longer used Not assigned or no longer used
791 791
Public performances Public performances
792 792
@ -1501,7 +1501,7 @@ Miscellany
803 803
Dictionaries & encyclopedias Dictionaries & encyclopedias
804 804
Not assigned or no longer used Not assigned or no longer used
805 805
[[Literary magazine|Serial publications]] [[Literary magazine|Serial publications]]
806 806
@ -1529,7 +1529,7 @@ Satire & humor
818 818
Miscellaneous writings Miscellaneous writings
819 819
Not assigned or no longer used Not assigned or no longer used
821 821
[[English poetry]] [[English poetry]]
822 822
@ -1825,9 +1825,9 @@ General history of South America; [[History of Guyana|Guiana]]
989 989
General history of South America; [[history of Paraguay|Paraguay]] & [[History of Uruguay|Uruguay]] General history of South America; [[history of Paraguay|Paraguay]] & [[History of Uruguay|Uruguay]]
991 991
Not assigned or no longer used Not assigned or no longer used
992 992
Not assigned or no longer used Not assigned or no longer used
993 993
General history of other areas; [[History of New Zealand|New Zealand]] General history of other areas; [[History of New Zealand|New Zealand]]
994 994

View File

@ -2193,7 +2193,7 @@ of new full-width/kern/smush alternatives, but default output is NOT changed.
\___^___/ @ \___^___/ @
@ @
@@ @@
-0x0005 -0x0005
alpha = a, beta = b, gamma = g, delta = d, epsilon = e @ alpha = a, beta = b, gamma = g, delta = d, epsilon = e @
zeta = z, eta = h, theta = q, iota = i, lamda = l, mu = m@ zeta = z, eta = h, theta = q, iota = i, lamda = l, mu = m@
nu = n, xi = x, omicron = o, pi = p, rho = r, sigma = s @ nu = n, xi = x, omicron = o, pi = p, rho = r, sigma = s @

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -9,7 +9,7 @@ use File::Slurp qw(read_file write_file);
# open file # open file
open(FILE, "/usr/share/dict/words") or die("Unable to open file"); open(FILE, "/usr/share/dict/words") or die("Unable to open file");
# read file into an array # read file into an array
my %dict = (); my %dict = ();
@ -22,7 +22,7 @@ while (my $line = <FILE>) {
unless ($amt eq '\'s'){ unless ($amt eq '\'s'){
$lcline = lc($line); $lcline = lc($line);
## Spliting the string with no delimeter. ## Spliting the string with no delimeter.
$sorted_string = join("",sort(split("",$lcline))); $sorted_string = join("",sort(split("",$lcline)));
@ -35,7 +35,7 @@ while (my $line = <FILE>) {
} }
} }
# close file # close file
close(FILE); close(FILE);
my $json = encode_json \%dict; my $json = encode_json \%dict;

View File

@ -19,7 +19,7 @@
</td> </td>
</tr> </tr>
<tr class='record__row record__highlight'> <tr class='record__row record__highlight'>
<td class="record__cell__key"> <td class="record__cell__key">
<p>Test Networks (<a href="https://www.ietf.org/rfc/rfc5735.txt">rfc5735</a>):</p> <p>Test Networks (<a href="https://www.ietf.org/rfc/rfc5735.txt">rfc5735</a>):</p>
</td> </td>
<td class="record__cell__value"> <td class="record__cell__value">

View File

@ -6,13 +6,13 @@
border: 1px solid rgba(136, 136, 136, 0.478); border: 1px solid rgba(136, 136, 136, 0.478);
} }
.zci--answer table.sudoku tr:nth-of-type(3) td, .zci--answer table.sudoku tr:nth-of-type(3) td,
.zci--answer table.sudoku tr:nth-of-type(6) td .zci--answer table.sudoku tr:nth-of-type(6) td
{ {
border-bottom: 3px solid rgba(136, 136, 136, 0.478); border-bottom: 3px solid rgba(136, 136, 136, 0.478);
} }
.zci--answer table.sudoku td:nth-of-type(3), .zci--answer table.sudoku td:nth-of-type(3),
.zci--answer table.sudoku td:nth-of-type(6) .zci--answer table.sudoku td:nth-of-type(6)
{ {
border-right: 3px solid rgba(136, 136, 136, 0.478); border-right: 3px solid rgba(136, 136, 136, 0.478);

View File

@ -1,12 +1,12 @@
SYNOPSIS SYNOPSIS
fetch.sh fetch.sh
parser.pl parser.pl
DESCRIPTION DESCRIPTION
fetch.sh downloads the cheat sheet data from fetch.sh downloads the cheat sheet data from
https://github.com/rtorr/vim-cheat-sheet https://github.com/rtorr/vim-cheat-sheet
parser.pl parses the html retrieved by fetch.sh and generates parser.pl parses the html retrieved by fetch.sh and generates

View File

@ -1,101 +1,101 @@
Captain Zapp Brannigan: Oh, God, I'm pathetic. Sorry. Just go... You want the rest of the cham-paggin?<br>Leela: No, and it's pronounced "cham-pain".<br>Captain Zapp Brannigan: Oh, God, no! Captain Zapp Brannigan: Oh, God, I'm pathetic. Sorry. Just go... You want the rest of the cham-paggin?<br>Leela: No, and it's pronounced "cham-pain".<br>Captain Zapp Brannigan: Oh, God, no!
Captain Zapp Brannigan: You look like a woman who appreciates the finer things in life. Come over here and feel my velour bedspread. Captain Zapp Brannigan: You look like a woman who appreciates the finer things in life. Come over here and feel my velour bedspread.
Captain Zapp Brannigan: Cham-paggin?<br>Leela: I didn't realize you were such a "coin-asseur."<br>Captain Zapp Brannigan: Well, I have studied abroad... or two. Captain Zapp Brannigan: Cham-paggin?<br>Leela: I didn't realize you were such a "coin-asseur."<br>Captain Zapp Brannigan: Well, I have studied abroad... or two.
Captain Zapp Brannigan: Kif, I have made it with a woman. Inform the men. Captain Zapp Brannigan: Kif, I have made it with a woman. Inform the men.
Captain Zapp Brannigan: Brannigan's Law is like Brannigan's love, hard and fast. Captain Zapp Brannigan: Brannigan's Law is like Brannigan's love, hard and fast.
Captain Zapp Brannigan: Mmm... Welcome to my humble chamber or as I call it, "The Lovenasium". Captain Zapp Brannigan: Mmm... Welcome to my humble chamber or as I call it, "The Lovenasium".
Captain Zapp Brannigan: We have failed to uphold Brannigan's Law. However I did make it with a hot alien babe. And in the end, is that not what man has dreamt of since first he looked up at the stars? Captain Zapp Brannigan: We have failed to uphold Brannigan's Law. However I did make it with a hot alien babe. And in the end, is that not what man has dreamt of since first he looked up at the stars?
Captain Zapp Brannigan: Captain's journal. Stardate: uhhh...<br>Kif Kroker: April 13.<br>Captain Zapp Brannigan: April 13... point two. Captain Zapp Brannigan: Captain's journal. Stardate: uhhh...<br>Kif Kroker: April 13.<br>Captain Zapp Brannigan: April 13... point two.
Captain Zapp Brannigan: As my protege you should know that the only way to deal with a female adversary is to seduce her.<br>Captain Zapp Brannigan: This time we are sure she's a woman, right?<br>Kif Kroker: *Yes*. Captain Zapp Brannigan: As my protege you should know that the only way to deal with a female adversary is to seduce her.<br>Captain Zapp Brannigan: This time we are sure she's a woman, right?<br>Kif Kroker: *Yes*.
Captain Zapp Brannigan: In the game of chess you can never let your adversary see your pieces. Captain Zapp Brannigan: In the game of chess you can never let your adversary see your pieces.
Captain Zapp Brannigan: So, crawling back to the big Z like a bird on its belly. Delicious.<br>Leela: Birds don't crawl.<br>Captain Zapp Brannigan: They'd been known to. Captain Zapp Brannigan: So, crawling back to the big Z like a bird on its belly. Delicious.<br>Leela: Birds don't crawl.<br>Captain Zapp Brannigan: They'd been known to.
Captain Zapp Brannigan: [musing to himself after capturing Fry, Leela and Bender] Rock breaks scissors. But paper covers rock, and scissors cut paper! Kiff: we have a conundrum. Search them for paper... and bring me a rock. Captain Zapp Brannigan: [musing to himself after capturing Fry, Leela and Bender] Rock breaks scissors. But paper covers rock, and scissors cut paper! Kiff: we have a conundrum. Search them for paper... and bring me a rock.
Captain Zapp Brannigan: Captain's log. Stardate: 3000.6.<br>Kif Kroker: Who are you talking to?<br>Captain Zapp Brannigan: You, Kif. Aren't you writing this down? Captain Zapp Brannigan: Captain's log. Stardate: 3000.6.<br>Kif Kroker: Who are you talking to?<br>Captain Zapp Brannigan: You, Kif. Aren't you writing this down?
Captain Zapp Brannigan: Now you're officially my woman. Kudos! I can't say I don't envy you. Captain Zapp Brannigan: Now you're officially my woman. Kudos! I can't say I don't envy you.
Leela: You know Zapp, once I thought you were a big pompous buffoon. Then I realised that inside, you were just a pitiful child. But now I realise that outside that child is a big pompous buffoon!<br>Captain Zapp Brannigan: And which one rocked your world? Leela: You know Zapp, once I thought you were a big pompous buffoon. Then I realised that inside, you were just a pitiful child. But now I realise that outside that child is a big pompous buffoon!<br>Captain Zapp Brannigan: And which one rocked your world?
Captain Zapp Brannigan: You'll be negotiating with the balls mysterious leaders, the Brain Balls. They've got a lot of brains, and they've got a lot of chutzpah... Captain Zapp Brannigan: You'll be negotiating with the balls mysterious leaders, the Brain Balls. They've got a lot of brains, and they've got a lot of chutzpah...
Captain Zapp Brannigan: Oh god, I've never been so happy to be beaten up by a woman.<br>Leela: Let's do it again sometime. Captain Zapp Brannigan: Oh god, I've never been so happy to be beaten up by a woman.<br>Leela: Let's do it again sometime.
Captain Zapp Brannigan: Stop exploding, you cowards. Captain Zapp Brannigan: Stop exploding, you cowards.
Captain Zapp Brannigan: That young man fills me with hope. Plus some other emotions which are weird and deeply confusing. Captain Zapp Brannigan: That young man fills me with hope. Plus some other emotions which are weird and deeply confusing.
Soldier: Why is this godforsaken hellhole worth dying for?<br>Captain Zapp Brannigan: Don't ask me. You're the ones who are going to be dying. Soldier: Why is this godforsaken hellhole worth dying for?<br>Captain Zapp Brannigan: Don't ask me. You're the ones who are going to be dying.
Captain Zapp Brannigan: As you know, the key to victory is the element of surprise. Surprise! Captain Zapp Brannigan: As you know, the key to victory is the element of surprise. Surprise!
Captain Zapp Brannigan: Men, you're lucky men. Soon, you'll all be fighting for your planet. many of you will be dying for your planet. A few of you will be put through a fine mesh screen for your planet. They will be the luckiest of all. Captain Zapp Brannigan: Men, you're lucky men. Soon, you'll all be fighting for your planet. many of you will be dying for your planet. A few of you will be put through a fine mesh screen for your planet. They will be the luckiest of all.
Captain Zapp Brannigan: I'm de-promoting you, soldier. Kiff, what's the most humiliating job there is?<br>Kif Kroker: Being your assistant.<br>Captain Zapp Brannigan: Wrong. Being *your* assistant. Captain Zapp Brannigan: I'm de-promoting you, soldier. Kiff, what's the most humiliating job there is?<br>Kif Kroker: Being your assistant.<br>Captain Zapp Brannigan: Wrong. Being *your* assistant.
Leela: You know, Zapp, someone ought to teach you a lesson.<br>Captain Zapp Brannigan: If it's a lesson in love, watch out. I suffer from a very sexy learning disability. What did I call it, Kiff?<br>Kif Kroker: Ugh... sexlexia. Leela: You know, Zapp, someone ought to teach you a lesson.<br>Captain Zapp Brannigan: If it's a lesson in love, watch out. I suffer from a very sexy learning disability. What did I call it, Kiff?<br>Kif Kroker: Ugh... sexlexia.
Richard Nixon's Head: So anyway, we open the panda crate, and wouldn't you know it, the damn thing was dead. Upchucked its bamboo. True story.<br>Captain Zapp Brannigan: Uh-huh.Uh-huh. That's whatever you were talking about for ya. Richard Nixon's Head: So anyway, we open the panda crate, and wouldn't you know it, the damn thing was dead. Upchucked its bamboo. True story.<br>Captain Zapp Brannigan: Uh-huh.Uh-huh. That's whatever you were talking about for ya.
Captain Zapp Brannigan: Private Lemon is the finest soldier I've seen since my mirror got grease on it. Captain Zapp Brannigan: Private Lemon is the finest soldier I've seen since my mirror got grease on it.
Fry: Uh, just so we'll know, who's the enemy?<br>Captain Zapp Brannigan: A valid question! We know nothing about them, their language, their history or what they look like. But we can assume this. They stand for everything we don't stand for. Also they told me you guys look like dorks.<br>Bender: They look like dorks! Fry: Uh, just so we'll know, who's the enemy?<br>Captain Zapp Brannigan: A valid question! We know nothing about them, their language, their history or what they look like. But we can assume this. They stand for everything we don't stand for. Also they told me you guys look like dorks.<br>Bender: They look like dorks!
Captain Zapp Brannigan: Dammit, Kif! Where's the little umbrella? That's what makes it as scotch on the rocks. Captain Zapp Brannigan: Dammit, Kif! Where's the little umbrella? That's what makes it as scotch on the rocks.
Captain Zapp Brannigan: [as Kif scrubs his back] A little lower, Kif. Lower. Lower. Lower. A lot lower. Too low! Lower. Captain Zapp Brannigan: [as Kif scrubs his back] A little lower, Kif. Lower. Lower. Lower. A lot lower. Too low! Lower.
Captain Zapp Brannigan: We need rest. The spirit is willing, but the flesh is spongy and bruised. Captain Zapp Brannigan: We need rest. The spirit is willing, but the flesh is spongy and bruised.
Captain Zapp Brannigan: I don't often say this, but you three are the most beautiful gigantic ladies I've ever laid eyes upon. Captain Zapp Brannigan: I don't often say this, but you three are the most beautiful gigantic ladies I've ever laid eyes upon.
Captain Zapp Brannigan: [piloting a floating restaurant] Ah, she's built like a steakhouse but she handles like a bistro. Captain Zapp Brannigan: [piloting a floating restaurant] Ah, she's built like a steakhouse but she handles like a bistro.
Leela: [Leela, Amy, Zapp and Kiff have just crashlanded on some planet] What planet is this, anyway?<br>Captain Zapp Brannigan: I don't know. This entire sector is uncharted.<br>Kif Kroker: It is not uncharted, You lost the chart! Leela: [Leela, Amy, Zapp and Kiff have just crashlanded on some planet] What planet is this, anyway?<br>Captain Zapp Brannigan: I don't know. This entire sector is uncharted.<br>Kif Kroker: It is not uncharted, You lost the chart!
Captain Zapp Brannigan: [crashing into a planet] You win again, gravity! Captain Zapp Brannigan: [crashing into a planet] You win again, gravity!
Captain Zapp Brannigan: Well, this promises to be one disturbingly erotic date.<br>Leela: Half date.<br>Captain Zapp Brannigan: Waiter, a bottle of your finest wine.<br>Leela: Half bottle.<br>Captain Zapp Brannigan: And some oysters on the half shell.<br>Leela: Quarter shell. Captain Zapp Brannigan: Well, this promises to be one disturbingly erotic date.<br>Leela: Half date.<br>Captain Zapp Brannigan: Waiter, a bottle of your finest wine.<br>Leela: Half bottle.<br>Captain Zapp Brannigan: And some oysters on the half shell.<br>Leela: Quarter shell.
Leela: What is this planet?<br>Captain Zapp Brannigan: I don't know. This whole area is uncharted.<br>Kif Kroker: It's not uncharted. You lost the chart. Leela: What is this planet?<br>Captain Zapp Brannigan: I don't know. This whole area is uncharted.<br>Kif Kroker: It's not uncharted. You lost the chart.
Captain Zapp Brannigan: Kif old friend - let's rap. Captain Zapp Brannigan: Kif old friend - let's rap.
Captain Zapp Brannigan: You know, I find the most erotic part of a woman is the boobies. Captain Zapp Brannigan: You know, I find the most erotic part of a woman is the boobies.
Captain Zapp Brannigan: Since this is an emergency, all robots will now have their patriotism circuits activated.<br>Bender: It is every robot's duty to give his life for the good of humanity...<br>Bender: Aw, crap! Captain Zapp Brannigan: Since this is an emergency, all robots will now have their patriotism circuits activated.<br>Bender: It is every robot's duty to give his life for the good of humanity...<br>Bender: Aw, crap!
Captain Zapp Brannigan: If we hit that bullseye, the rest of the dominoes should fall like a house of cards. Checkmate.<br>Captain Zapp Brannigan: Now, like all great plans, my strategy is so simple an idiot could have devised it. On my command all ships will line up and file directly into the alien death cannons, clogging them with wreckage.<br>Fry: W-Wouldn't it make more sense to send the robots in first a - ?<br>Bender: Sir, I volunteer for a suicide mission.<br>Bender: Cut it out!<br>Captain Zapp Brannigan: You're a brave robot, son. But when I'm in command every mission's a suicide mission. Captain Zapp Brannigan: If we hit that bullseye, the rest of the dominoes should fall like a house of cards. Checkmate.<br>Captain Zapp Brannigan: Now, like all great plans, my strategy is so simple an idiot could have devised it. On my command all ships will line up and file directly into the alien death cannons, clogging them with wreckage.<br>Fry: W-Wouldn't it make more sense to send the robots in first a - ?<br>Bender: Sir, I volunteer for a suicide mission.<br>Bender: Cut it out!<br>Captain Zapp Brannigan: You're a brave robot, son. But when I'm in command every mission's a suicide mission.
Lrrr: Surely you know McNeal. She is an unmarried human female struggling to succeed in a human male's world.<br>Captain Zapp Brannigan: Maybe that's just her excuse for being incompetent. Lrrr: Surely you know McNeal. She is an unmarried human female struggling to succeed in a human male's world.<br>Captain Zapp Brannigan: Maybe that's just her excuse for being incompetent.
Captain Zapp Brannigan: Our mission is clear: destroy all alien lifeforms.<br>Kif Kroker: Umm, not me sir...<br>Captain Zapp Brannigan: Right. Nobody destroy Kif. Unless you have to. Captain Zapp Brannigan: Our mission is clear: destroy all alien lifeforms.<br>Kif Kroker: Umm, not me sir...<br>Captain Zapp Brannigan: Right. Nobody destroy Kif. Unless you have to.
Captain Zapp Brannigan: Stop exploding, you cowards! Captain Zapp Brannigan: Stop exploding, you cowards!
Captain Zapp Brannigan: Leela, perhaps before we head into battle you'd like to make love to me, in case one of us doesn't come back.<br>Leela: Maybe we should wait 'til afterwards, in case neither of us comes back.<br>Captain Zapp Brannigan: [misunderstanding] Here's hoping. Captain Zapp Brannigan: Leela, perhaps before we head into battle you'd like to make love to me, in case one of us doesn't come back.<br>Leela: Maybe we should wait 'til afterwards, in case neither of us comes back.<br>Captain Zapp Brannigan: [misunderstanding] Here's hoping.
Captain Zapp Brannigan: [huge spaceship appears] What the hell is that thing?<br>Kif Kroker: It appears to be the mothership.<br>Captain Zapp Brannigan: Then what did we just blow up?<br>Kif Kroker: [looks on map] The Hubble Telescope. Captain Zapp Brannigan: [huge spaceship appears] What the hell is that thing?<br>Kif Kroker: It appears to be the mothership.<br>Captain Zapp Brannigan: Then what did we just blow up?<br>Kif Kroker: [looks on map] The Hubble Telescope.
Captain Zapp Brannigan: The key to victory is discipline, and that means a well-made bed. You will practice until you can make your bed in your sleep.<br>Fry: You mean while I'm sleeping on it?<br>Captain Zapp Brannigan: You won't have time for sleeping, soldier, not with all the bed making you'll be doing. Captain Zapp Brannigan: The key to victory is discipline, and that means a well-made bed. You will practice until you can make your bed in your sleep.<br>Fry: You mean while I'm sleeping on it?<br>Captain Zapp Brannigan: You won't have time for sleeping, soldier, not with all the bed making you'll be doing.
Captain Zapp Brannigan: Maybe that's just her excuse for being incompetent Captain Zapp Brannigan: Maybe that's just her excuse for being incompetent
Lt. Kif Kroker: [as asteroids are flying by the bridge] Do you remember that "course correction" you made, sir?<br>Captain Zapp Brannigan: [meaning it] No. Lt. Kif Kroker: [as asteroids are flying by the bridge] Do you remember that "course correction" you made, sir?<br>Captain Zapp Brannigan: [meaning it] No.
Captain Zapp Brannigan: Kiff, I'm feeling the "captain's itch".<br>Lt. Kif Kroker: I'll get the powder, sir. Captain Zapp Brannigan: Kiff, I'm feeling the "captain's itch".<br>Lt. Kif Kroker: I'll get the powder, sir.
Captain Zapp Brannigan: But as a gentleman, I must warn you, if you so much as glance at another woman, I'll be on Leela like a fly on a pile of very seductive manure. Captain Zapp Brannigan: But as a gentleman, I must warn you, if you so much as glance at another woman, I'll be on Leela like a fly on a pile of very seductive manure.
Kif Kroker: Captain, may I have a word with you?<br>Captain Zapp Brannigan: No.<br>Kif Kroker: It's an emergency, sir.<br>Captain Zapp Brannigan: Come back when it's a catastrophe.<br>Captain Zapp Brannigan: Oh, very well. Kif Kroker: Captain, may I have a word with you?<br>Captain Zapp Brannigan: No.<br>Kif Kroker: It's an emergency, sir.<br>Captain Zapp Brannigan: Come back when it's a catastrophe.<br>Captain Zapp Brannigan: Oh, very well.
Captain Zapp Brannigan: Don't blame yourself, Kif. We were doomed from the start. I guess all that remains now is for the captain to go down with the ship.<br>Lt. Kif Kroker: That's surprisingly noble of you, sir.<br>Captain Zapp Brannigan: No, it's noble of you, Kif. As of now, you're in command. Congratulations, Captain.<br>[Zapp runs off] Captain Zapp Brannigan: Don't blame yourself, Kif. We were doomed from the start. I guess all that remains now is for the captain to go down with the ship.<br>Lt. Kif Kroker: That's surprisingly noble of you, sir.<br>Captain Zapp Brannigan: No, it's noble of you, Kif. As of now, you're in command. Congratulations, Captain.<br>[Zapp runs off]
Lt. Kif Kroker: [Captain Zapp Brannigan wants to change the flight course] This is a pleasure cruise. Our path is decided by the travel agency.<br>Captain Zapp Brannigan: That's for schoolgirls. Now here's a course with some chest hair. [Draws a meandering line on the chart]<br>Lt. Kif Kroker: But that leads us straight through a comet field.<br>Captain Zapp Brannigan: Ah, yes. Comets, the icebergs of the sky. By jackknifing off one after another at breakneck speed, we can create a gravity boost, or something. Lt. Kif Kroker: [Captain Zapp Brannigan wants to change the flight course] This is a pleasure cruise. Our path is decided by the travel agency.<br>Captain Zapp Brannigan: That's for schoolgirls. Now here's a course with some chest hair. [Draws a meandering line on the chart]<br>Lt. Kif Kroker: But that leads us straight through a comet field.<br>Captain Zapp Brannigan: Ah, yes. Comets, the icebergs of the sky. By jackknifing off one after another at breakneck speed, we can create a gravity boost, or something.
Captain Zapp Brannigan: We'll just set a new course for that empty region over there, near that blackish, holeish thing. Captain Zapp Brannigan: We'll just set a new course for that empty region over there, near that blackish, holeish thing.
Captain Zapp Brannigan: She's a beautiful ship. Shapely, seductive. I'm gonna fly her brains out. Captain Zapp Brannigan: She's a beautiful ship. Shapely, seductive. I'm gonna fly her brains out.
Captain Zapp Brannigan: Kif, I'm feeling the Captain's Itch.<br>Kif Kroker: I'll get the powder, sir. Captain Zapp Brannigan: Kif, I'm feeling the Captain's Itch.<br>Kif Kroker: I'll get the powder, sir.
Captain Zapp Brannigan: Leela, you may be a formidable do-er of the nasty, but I'm forced to relieve you of your post. Captain Zapp Brannigan: Leela, you may be a formidable do-er of the nasty, but I'm forced to relieve you of your post.
Captain Zapp Brannigan: You know, boys, a good captain needs abilities like boldness, daring and a good velour uniform, and I'm not convinced Leela has ANY of those things. Captain Zapp Brannigan: You know, boys, a good captain needs abilities like boldness, daring and a good velour uniform, and I'm not convinced Leela has ANY of those things.
Captain Zapp Brannigan: Here's to us poor schmoes, working for the man. Even if he is a hot, sexy female man. Captain Zapp Brannigan: Here's to us poor schmoes, working for the man. Even if he is a hot, sexy female man.
Captain Zapp Brannigan: One day, a man has everything. Then the next day, he blows up a billion dollar space station. And then the next day, he has nothing. Makes you think, huh, Kipp?<br>Kif Kroker: No, it doesn't. Captain Zapp Brannigan: One day, a man has everything. Then the next day, he blows up a billion dollar space station. And then the next day, he has nothing. Makes you think, huh, Kipp?<br>Kif Kroker: No, it doesn't.
Captain Zapp Brannigan: It was almost the perfect crime, but you forgot the one thing: rock crushes scissors.<br>[Suddenly thoughtful]<br>Captain Zapp Brannigan: But paper covers rock. And scissors cuts paper. Kif, we have a conundrum. Search them for paper. And bring me a rock. Captain Zapp Brannigan: It was almost the perfect crime, but you forgot the one thing: rock crushes scissors.<br>[Suddenly thoughtful]<br>Captain Zapp Brannigan: But paper covers rock. And scissors cuts paper. Kif, we have a conundrum. Search them for paper. And bring me a rock.
Captain Zapp Brannigan: One day, a man has everything. Then the next day, he blows up a billion dollar space station. And then the next day, he has nothing. Makes you think, huh, Kif?<br>Kif Kroker: No, it doesn't. Captain Zapp Brannigan: One day, a man has everything. Then the next day, he blows up a billion dollar space station. And then the next day, he has nothing. Makes you think, huh, Kif?<br>Kif Kroker: No, it doesn't.
Captain Zapp Brannigan: I surrender and volunteer for treason! Captain Zapp Brannigan: I surrender and volunteer for treason!
Captain Zapp Brannigan: President Nixon. What the hell. Captain Zapp Brannigan: President Nixon. What the hell.
Captain Zapp Brannigan: My God! We're defenseless, like fish in a barrel.<br>Richard Nixon's Head: Options?<br>Zapp Brannigan: My instinct is to hide in this barrel, like the wily fish. Captain Zapp Brannigan: My God! We're defenseless, like fish in a barrel.<br>Richard Nixon's Head: Options?<br>Zapp Brannigan: My instinct is to hide in this barrel, like the wily fish.
Captain Zapp Brannigan: Magnify that death sphere.<br>[Screen zooms in on a pixelated death sphere]<br>Zapp Brannigan: Why is it still blurry?<br>Kif Kroker: That's all the resolution we have. Making it bigger doesn't make it clearer.<br>Zapp Brannigan: It does on CSI Miami. Captain Zapp Brannigan: Magnify that death sphere.<br>[Screen zooms in on a pixelated death sphere]<br>Zapp Brannigan: Why is it still blurry?<br>Kif Kroker: That's all the resolution we have. Making it bigger doesn't make it clearer.<br>Zapp Brannigan: It does on CSI Miami.
Captain Zapp Brannigan: Captain's log: We have lost control of the ship. Adddendum: Whoooaaaa! Captain Zapp Brannigan: Captain's log: We have lost control of the ship. Adddendum: Whoooaaaa!
Turanga Leela: Come, Adam, and taste of my forbidden fruit.<br>Captain Zapp Brannigan: Thee will be done. Turanga Leela: Come, Adam, and taste of my forbidden fruit.<br>Captain Zapp Brannigan: Thee will be done.
Captain Zapp Brannigan: [surprises Leela in bed] How about I help you finish that dream you were having about me?<br>Leela: Okay. I was just at this part. Yaaa! [punches Zapp in the face]<br>Captain Zapp Brannigan: Uh, let's try that a little lower and a lot softer. Captain Zapp Brannigan: [surprises Leela in bed] How about I help you finish that dream you were having about me?<br>Leela: Okay. I was just at this part. Yaaa! [punches Zapp in the face]<br>Captain Zapp Brannigan: Uh, let's try that a little lower and a lot softer.
Captain Zapp Brannigan: [interrupting Kif's videophone call] Lieutenant, some things came off me and clogged up the drain and... Oh, ho, what's this?<br>[zooms in on Leela, reading a book]<br>Captain Zapp Brannigan: Well, well, well. Do my eyes believe me, or is that my bosomy swan, Leela?<br>Leela: Say again? You're breaking up.<br>[throws book at videophone] Captain Zapp Brannigan: [interrupting Kif's videophone call] Lieutenant, some things came off me and clogged up the drain and... Oh, ho, what's this?<br>[zooms in on Leela, reading a book]<br>Captain Zapp Brannigan: Well, well, well. Do my eyes believe me, or is that my bosomy swan, Leela?<br>Leela: Say again? You're breaking up.<br>[throws book at videophone]
Attila the Hun: Stop! Don't shoot fire stick in space canoe! Cause explosive decompression!<br>Captain Zapp Brannigan: Spare me your space age technobabble, Attila the Hun. Attila the Hun: Stop! Don't shoot fire stick in space canoe! Cause explosive decompression!<br>Captain Zapp Brannigan: Spare me your space age technobabble, Attila the Hun.
Captain Zapp Brannigan: Leela! How could you? Our love has had to endure your constant hatred, and now this?<br>[whining]<br>Captain Zapp Brannigan: Stop testing our love! Captain Zapp Brannigan: Leela! How could you? Our love has had to endure your constant hatred, and now this?<br>[whining]<br>Captain Zapp Brannigan: Stop testing our love!
Captain Zapp Brannigan: Kif, I'm sensing a very sensual disturbance in the force. Prepare for ship-to-ship intimacy. Captain Zapp Brannigan: Kif, I'm sensing a very sensual disturbance in the force. Prepare for ship-to-ship intimacy.
Captain Zapp Brannigan: I am the man with no name, Zapp Brannigan at your service. Captain Zapp Brannigan: I am the man with no name, Zapp Brannigan at your service.
Captain Zapp Brannigan: Don't be such a chicken, Kif. Teenagers smoke, and they seem pretty on-the-ball. Captain Zapp Brannigan: Don't be such a chicken, Kif. Teenagers smoke, and they seem pretty on-the-ball.
Captain Zapp Brannigan: Chief, my people are a people of law, and the law is no backsies. Captain Zapp Brannigan: Chief, my people are a people of law, and the law is no backsies.
Captain Zapp Brannigan: I am the man with no name, Zapp Brannigan! Captain Zapp Brannigan: I am the man with no name, Zapp Brannigan!
Captain Zapp Brannigan: Say, these would go great with some guacamol.<br>Lrrr: Stop eating our young! And it's pronounced guacamole! Captain Zapp Brannigan: Say, these would go great with some guacamol.<br>Lrrr: Stop eating our young! And it's pronounced guacamole!
Captain Zapp Brannigan: The Omicronians have decided not to eat all the humans.<br>Lrrr: I filled up with nuts at the negociations. Captain Zapp Brannigan: The Omicronians have decided not to eat all the humans.<br>Lrrr: I filled up with nuts at the negociations.
Captain Zapp Brannigan: [Free Waterfall Jr. has given away that the orangutan has taken Leela's place] Why'd you open your bonghole, you smelly hippie? You'd sacrifice a beautiful woman to save a moderately attractive monkey? You must have smoked some bad granola!<br>Lrrr: [Puts on a pair of glasses] The one called "Smelly Hippie" is right, this is a monkey!<br>Nd-nd: [Eats orangutan] Yes definitely a monkey!<br>Lrrr: Where's the real female?<br>Captain Zapp Brannigan: I'll never tell!<br>Lrrr: [Points raygun at his face] Where's the real female!<br>Captain Zapp Brannigan: [Nervously] I'll get her for you Captain Zapp Brannigan: [Free Waterfall Jr. has given away that the orangutan has taken Leela's place] Why'd you open your bonghole, you smelly hippie? You'd sacrifice a beautiful woman to save a moderately attractive monkey? You must have smoked some bad granola!<br>Lrrr: [Puts on a pair of glasses] The one called "Smelly Hippie" is right, this is a monkey!<br>Nd-nd: [Eats orangutan] Yes definitely a monkey!<br>Lrrr: Where's the real female?<br>Captain Zapp Brannigan: I'll never tell!<br>Lrrr: [Points raygun at his face] Where's the real female!<br>Captain Zapp Brannigan: [Nervously] I'll get her for you
Captain Zapp Brannigan: So, may I have the pleasure?<br>Turanga Leela: What little there is to be had. Captain Zapp Brannigan: So, may I have the pleasure?<br>Turanga Leela: What little there is to be had.
Mom: Hey, Captain Zapp. How much is that oversized placemat actually worth?<br>Zapp Brannigan: Exactly ten million dollars.<br>Mom: Now that's walking around money! Mom: Hey, Captain Zapp. How much is that oversized placemat actually worth?<br>Zapp Brannigan: Exactly ten million dollars.<br>Mom: Now that's walking around money!
Captain Zapp Brannigan: The Spiderians, though weak and gilrly in combat, are masters of the textile arts. Taste like king crab, by the way. The lazy bugs actually wove this tapestry celebrating my victory as I was killing them. Captain Zapp Brannigan: The Spiderians, though weak and gilrly in combat, are masters of the textile arts. Taste like king crab, by the way. The lazy bugs actually wove this tapestry celebrating my victory as I was killing them.
Captain Zapp Brannigan: Do you understand the charges?<br>Kif Kroker: One beep for yes, two beeps for no.<br>[Fry beeps once]<br>Captain Zapp Brannigan: Yes, so noted. Do you plead guilty?<br>[Fry beeps twice]<br>Captain Zapp Brannigan: Double yes. Guilty. Captain Zapp Brannigan: Do you understand the charges?<br>Kif Kroker: One beep for yes, two beeps for no.<br>[Fry beeps once]<br>Captain Zapp Brannigan: Yes, so noted. Do you plead guilty?<br>[Fry beeps twice]<br>Captain Zapp Brannigan: Double yes. Guilty.
Captain Zapp Brannigan: The court will now hear some very sensual testimony from this court's ex-lover, Turanga Leela. Captain Zapp Brannigan: The court will now hear some very sensual testimony from this court's ex-lover, Turanga Leela.
George Takei: You see, the show was banned after the Star Trek wars.<br>Captain Zapp Brannigan: You mean the mass migration of Star Wars fans?<br>Nichelle Nichols: No, that was the Star Wars trek. George Takei: You see, the show was banned after the Star Trek wars.<br>Captain Zapp Brannigan: You mean the mass migration of Star Wars fans?<br>Nichelle Nichols: No, that was the Star Wars trek.
Captain Zapp Brannigan: Happy Freedom Day, ladies! Come on, show me something. Anything. Seriously, I'd take an armpit. Captain Zapp Brannigan: Happy Freedom Day, ladies! Come on, show me something. Anything. Seriously, I'd take an armpit.
Captain Zapp Brannigan: You can't be too careful with these codes. Rumor has it a double agent is aboard this very ship.<br>[Stares at Kif]<br>Captain Zapp Brannigan: I'm watching you. You, ensign. What's your name?<br>Hugh Man: [Clearly a Decapodian in disguise] Hugh Man, sir.<br>Captain Zapp Brannigan: Hugh Man? Now that's a name you can trust. Run down to the central battle computer and enter these codes. Chop, chop!<br>[Gives the codes to "Hugh", who scuttles out of the bridge]<br>Kif Kroker: Um, sir, there's something about that ensign that's...<br>Captain Zapp Brannigan: You're damn right there is. That strapping young lad is gunning for your job, and he just might get it.<br>["Hugh" is seen out the window on a shuttle flying to the Decapodian ship] Captain Zapp Brannigan: You can't be too careful with these codes. Rumor has it a double agent is aboard this very ship.<br>[Stares at Kif]<br>Captain Zapp Brannigan: I'm watching you. You, ensign. What's your name?<br>Hugh Man: [Clearly a Decapodian in disguise] Hugh Man, sir.<br>Captain Zapp Brannigan: Hugh Man? Now that's a name you can trust. Run down to the central battle computer and enter these codes. Chop, chop!<br>[Gives the codes to "Hugh", who scuttles out of the bridge]<br>Kif Kroker: Um, sir, there's something about that ensign that's...<br>Captain Zapp Brannigan: You're damn right there is. That strapping young lad is gunning for your job, and he just might get it.<br>["Hugh" is seen out the window on a shuttle flying to the Decapodian ship]
[a "herd" of Lucy Liu robots are destroying New New York]<br>Captain Zapp Brannigan: That's a wave of destruction that's easy on the eyes! [a "herd" of Lucy Liu robots are destroying New New York]<br>Captain Zapp Brannigan: That's a wave of destruction that's easy on the eyes!
[the city is being attacked by Lucy Liu robots]<br>Captain Zapp Brannigan: Now there's a wave of destruction that's easy on the eyes. [the city is being attacked by Lucy Liu robots]<br>Captain Zapp Brannigan: Now there's a wave of destruction that's easy on the eyes.
Captain Zapp Brannigan: I got your distress call and came here as soon as I wanted to. Captain Zapp Brannigan: I got your distress call and came here as soon as I wanted to.
Captain Zapp Brannigan: [to woman Fry] Well, hello from the neck down. Captain Zapp Brannigan: [to woman Fry] Well, hello from the neck down.
Unattractive Giant Monster: I'll destroy you all! I won't stop until your whole planet is as ugly as you perceive me to be!<br>Captain Zapp Brannigan: That will take a very long time. Unattractive Giant Monster: I'll destroy you all! I won't stop until your whole planet is as ugly as you perceive me to be!<br>Captain Zapp Brannigan: That will take a very long time.
Captain Zapp Brannigan: Hey, freakshow! Your face has been declared a weapon of mass disgusting!<br>Kif Kroker: [laughing] Timeless. Captain Zapp Brannigan: Hey, freakshow! Your face has been declared a weapon of mass disgusting!<br>Kif Kroker: [laughing] Timeless.
Captain Zapp Brannigan: Ladies, you're under arrest. Prepare to be boarded again and again. Captain Zapp Brannigan: Ladies, you're under arrest. Prepare to be boarded again and again.
Captain Zapp Brannigan: Bender here's identified the femdido commander as my ex-lover Turanga Leela, whom I once made love at.<br>President Richard Nixon: And he's willing to fink her out for a few simoleons?<br>Bender: It's not about the money, Nixon, though I'd like much more. It's 'cause Leela's a threat. A threat to my reputation~ She's committed 30 felonies in 12 star systems. If no one stops her, she'll break my record for longest rap sheet.<br>President Richard Nixon: That's a despicable motive, Bender, and I respect it.<br>Bender: Gracias. Captain Zapp Brannigan: Bender here's identified the femdido commander as my ex-lover Turanga Leela, whom I once made love at.<br>President Richard Nixon: And he's willing to fink her out for a few simoleons?<br>Bender: It's not about the money, Nixon, though I'd like much more. It's 'cause Leela's a threat. A threat to my reputation~ She's committed 30 felonies in 12 star systems. If no one stops her, she'll break my record for longest rap sheet.<br>President Richard Nixon: That's a despicable motive, Bender, and I respect it.<br>Bender: Gracias.
Captain Zapp Brannigan: We fight this battle not for ourselves, but for our children, and our children's children, which is why I'm forming a children's brigade. Captain Zapp Brannigan: We fight this battle not for ourselves, but for our children, and our children's children, which is why I'm forming a children's brigade.
Captain Zapp Brannigan: Great leader, I offer you a sacrifice.<br>[Holds up Kif]<br>Zapp Brannigan: How about this?<br>[Lrrr takes off one of Kif's legs]<br>Kif Kroker: Hey!<br>Lrrr: [Eats leg] He'll do. Captain Zapp Brannigan: Great leader, I offer you a sacrifice.<br>[Holds up Kif]<br>Zapp Brannigan: How about this?<br>[Lrrr takes off one of Kif's legs]<br>Kif Kroker: Hey!<br>Lrrr: [Eats leg] He'll do.
Captain Zapp Brannigan: [singing] There it is, Miss Universe... There it is, looking weird... Captain Zapp Brannigan: [singing] There it is, Miss Universe... There it is, looking weird...
Captain Zapp Brannigan: Hell of a thing sending another universe to certain doom. Lots of fun, though. Makes a man feel big. Captain Zapp Brannigan: Hell of a thing sending another universe to certain doom. Lots of fun, though. Makes a man feel big.
Captain Zapp Brannigan: Fire all weapons and set a transmission frequency for my victory yodel. Captain Zapp Brannigan: Fire all weapons and set a transmission frequency for my victory yodel.

View File

@ -298,7 +298,7 @@ subtest 'Dates' => sub {
} }
restore_time(); restore_time();
}; };
subtest 'Valid mixture of formatted and descriptive dates' => sub { subtest 'Valid mixture of formatted and descriptive dates' => sub {
set_fixed_time('2000-01-01T00:00:00Z'); set_fixed_time('2000-01-01T00:00:00Z');
my %mixed_dates_to_test = ( my %mixed_dates_to_test = (
@ -320,13 +320,13 @@ subtest 'Dates' => sub {
'next january' => 978307200, 'next january' => 978307200,
'december' => 975628800, 'december' => 975628800,
); );
foreach my $test_mixed_date (sort keys %mixed_dates_to_test) { foreach my $test_mixed_date (sort keys %mixed_dates_to_test) {
my $parsed_date_object = RoleTester::parse_datestring_to_date($test_mixed_date); my $parsed_date_object = RoleTester::parse_datestring_to_date($test_mixed_date);
isa_ok($parsed_date_object, 'DateTime', $test_mixed_date); isa_ok($parsed_date_object, 'DateTime', $test_mixed_date);
is($parsed_date_object->epoch, $mixed_dates_to_test{$test_mixed_date}, ' ... represents the correct time.'); is($parsed_date_object->epoch, $mixed_dates_to_test{$test_mixed_date}, ' ... represents the correct time.');
} }
restore_time(); restore_time();
} }
}; };

View File

@ -21,7 +21,7 @@ ddg_goodie_test(
'10 in base 3' => test_zci('10 in base 3 is 101'), '10 in base 3' => test_zci('10 in base 3 is 101'),
'18442240474082181119 to hex' => test_zci('18442240474082181119 in base 16 is FFEFFFFFFFFFFFFF'), '18442240474082181119 to hex' => test_zci('18442240474082181119 in base 16 is FFEFFFFFFFFFFFFF'),
'999999999999999999999999 to hex' => test_zci('999999999999999999999999 in base 16 is D3C21BCECCEDA0FFFFFF') '999999999999999999999999 to hex' => test_zci('999999999999999999999999 in base 16 is D3C21BCECCEDA0FFFFFF')
); );
done_testing; done_testing;

View File

@ -37,12 +37,12 @@ ddg_goodie_test(
heading => '[[ /tmp/hello -nt /etc/test ]] (Bash)', heading => '[[ /tmp/hello -nt /etc/test ]] (Bash)',
), ),
'bash [ -z hello ]' => test_zci( 'bash [ -z hello ]' => test_zci(
qr/.+ true if the length of 'hello' is zero./, qr/.+ true if the length of 'hello' is zero./,
html => qr/.+/, html => qr/.+/,
heading => '[ -z hello ] (Bash)', heading => '[ -z hello ] (Bash)',
), ),
'bash if [[ "abc" -lt "cba" ]]' => test_zci( 'bash if [[ "abc" -lt "cba" ]]' => test_zci(
qr/.+ true if "abc" is numerically less than "cba"./, qr/.+ true if "abc" is numerically less than "cba"./,
html => qr/.+/, html => qr/.+/,
heading => '[[ &quot;abc&quot; -lt &quot;cba&quot; ]] (Bash)', heading => '[[ &quot;abc&quot; -lt &quot;cba&quot; ]] (Bash)',
), ),

View File

@ -17,72 +17,72 @@ ddg_goodie_test(
html => "<div>Result: <b>1</b></div>", html => "<div>Result: <b>1</b></div>",
heading => "Binary Logic" heading => "Binary Logic"
), ),
'4 ⊕ 5' => test_zci('1', '4 ⊕ 5' => test_zci('1',
html => "<div>Result: <b>1</b></div>", html => "<div>Result: <b>1</b></div>",
heading => "Binary Logic" heading => "Binary Logic"
), ),
'9489 xor 394 xor 9349 xor 39 xor 29 xor 4967 xor 3985' => test_zci('7378', '9489 xor 394 xor 9349 xor 39 xor 29 xor 4967 xor 3985' => test_zci('7378',
html => "<div>Result: <b>7378</b></div>", html => "<div>Result: <b>7378</b></div>",
heading => "Binary Logic" heading => "Binary Logic"
), ),
'10 and 12' => test_zci('8', '10 and 12' => test_zci('8',
html => "<div>Result: <b>8</b></div>", html => "<div>Result: <b>8</b></div>",
heading => "Binary Logic" heading => "Binary Logic"
), ),
'10 ∧ 12' => test_zci('8', '10 ∧ 12' => test_zci('8',
html => "<div>Result: <b>8</b></div>", html => "<div>Result: <b>8</b></div>",
heading => "Binary Logic" heading => "Binary Logic"
), ),
'52 or 100' => test_zci('116', '52 or 100' => test_zci('116',
html => "<div>Result: <b>116</b></div>", html => "<div>Result: <b>116</b></div>",
heading => "Binary Logic" heading => "Binary Logic"
), ),
'52 100' => test_zci('116', '52 100' => test_zci('116',
html => "<div>Result: <b>116</b></div>", html => "<div>Result: <b>116</b></div>",
heading => "Binary Logic" heading => "Binary Logic"
), ),
'23 and (30 or 128)' => test_zci('22', '23 and (30 or 128)' => test_zci('22',
html => "<div>Result: <b>22</b></div>", html => "<div>Result: <b>22</b></div>",
heading => "Binary Logic" heading => "Binary Logic"
), ),
'23 ∧ (30 128)' => test_zci('22', '23 ∧ (30 128)' => test_zci('22',
html => "<div>Result: <b>22</b></div>", html => "<div>Result: <b>22</b></div>",
heading => "Binary Logic" heading => "Binary Logic"
), ),
'0x999 xor 0x589' => test_zci('3088', '0x999 xor 0x589' => test_zci('3088',
html => "<div>Result: <b>3088</b></div>", html => "<div>Result: <b>3088</b></div>",
heading => "Binary Logic" heading => "Binary Logic"
), ),
'0x999 ⊕ 0x589' => test_zci('3088', '0x999 ⊕ 0x589' => test_zci('3088',
html => "<div>Result: <b>3088</b></div>", html => "<div>Result: <b>3088</b></div>",
heading => "Binary Logic" heading => "Binary Logic"
), ),
'not 1' => test_zci('18446744073709551614', 'not 1' => test_zci('18446744073709551614',
html => "<div>Result: <b>18446744073709551614</b></div>", html => "<div>Result: <b>18446744073709551614</b></div>",
heading => "Binary Logic" heading => "Binary Logic"
), ),
'¬1' => test_zci('18446744073709551614', '¬1' => test_zci('18446744073709551614',
html => "<div>Result: <b>18446744073709551614</b></div>", html => "<div>Result: <b>18446744073709551614</b></div>",
heading => "Binary Logic" heading => "Binary Logic"
), ),
'3 and 2' => test_zci('2', '3 and 2' => test_zci('2',
html => "<div>Result: <b>2</b></div>", html => "<div>Result: <b>2</b></div>",
heading => "Binary Logic" heading => "Binary Logic"
), ),
'1 or 1234' => test_zci('1235', '1 or 1234' => test_zci('1235',
html => "<div>Result: <b>1235</b></div>", html => "<div>Result: <b>1235</b></div>",
heading => "Binary Logic" heading => "Binary Logic"
), ),
'34 or 100' => test_zci('102', '34 or 100' => test_zci('102',
html => "<div>Result: <b>102</b></div>", html => "<div>Result: <b>102</b></div>",
heading => "Binary Logic" heading => "Binary Logic"
), ),
'10 and (30 or 128)' => test_zci('10', '10 and (30 or 128)' => test_zci('10',
html => "<div>Result: <b>10</b></div>", html => "<div>Result: <b>10</b></div>",
heading => "Binary Logic" heading => "Binary Logic"
), ),
'0x01 or not 0X100' => test_zci('18446744073709551359', '0x01 or not 0X100' => test_zci('18446744073709551359',
html => "<div>Result: <b>18446744073709551359</b></div>", html => "<div>Result: <b>18446744073709551359</b></div>",
heading => "Binary Logic" heading => "Binary Logic"
), ),
'0x01 or 0x02' => test_zci('3', '0x01 or 0x02' => test_zci('3',

View File

@ -19,62 +19,62 @@ ddg_goodie_test(
'calendar next november' => test_zci(qr/\nS M T W T F S November [0-9]{4}\n.+/, html => qr#<table class="calendar".+</table>#), 'calendar next november' => test_zci(qr/\nS M T W T F S November [0-9]{4}\n.+/, html => qr#<table class="calendar".+</table>#),
'calendar november 2009' => test_zci(" 'calendar november 2009' => test_zci("
S M T W T F S November 2009 S M T W T F S November 2009
1 2 3 4 5 6 7 1 2 3 4 5 6 7
8 9 10 11 12 13 14 8 9 10 11 12 13 14
15 16 17 18 19 20 21 15 16 17 18 19 20 21
22 23 24 25 26 27 28 22 23 24 25 26 27 28
29 30 29 30
", html => qr#<table class="calendar"><tr><th class="calendar__header" colspan="7"><b>November 2009</b></th></tr><tr><th>S</th><th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th></tr><tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr><tr><td>8</td><td>9</td><td>10</td><td>11</td><td>12</td><td>13</td><td>14</td></tr><tr><td>15</td><td>16</td><td>17</td><td>18</td><td>19</td><td>20</td><td>21</td></tr><tr><td>22</td><td>23</td><td>24</td><td>25</td><td>26</td><td>27</td><td>28</td></tr><tr><td>29</td><td>30</td></tr></table>#), ", html => qr#<table class="calendar"><tr><th class="calendar__header" colspan="7"><b>November 2009</b></th></tr><tr><th>S</th><th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th></tr><tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr><tr><td>8</td><td>9</td><td>10</td><td>11</td><td>12</td><td>13</td><td>14</td></tr><tr><td>15</td><td>16</td><td>17</td><td>18</td><td>19</td><td>20</td><td>21</td></tr><tr><td>22</td><td>23</td><td>24</td><td>25</td><td>26</td><td>27</td><td>28</td></tr><tr><td>29</td><td>30</td></tr></table>#),
'calendar nov 2009' => test_zci(" 'calendar nov 2009' => test_zci("
S M T W T F S November 2009 S M T W T F S November 2009
1 2 3 4 5 6 7 1 2 3 4 5 6 7
8 9 10 11 12 13 14 8 9 10 11 12 13 14
15 16 17 18 19 20 21 15 16 17 18 19 20 21
22 23 24 25 26 27 28 22 23 24 25 26 27 28
29 30 29 30
", html => qr#<table class="calendar"><tr><th class="calendar__header" colspan="7"><b>November 2009</b></th></tr><tr><th>S</th><th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th></tr><tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr><tr><td>8</td><td>9</td><td>10</td><td>11</td><td>12</td><td>13</td><td>14</td></tr><tr><td>15</td><td>16</td><td>17</td><td>18</td><td>19</td><td>20</td><td>21</td></tr><tr><td>22</td><td>23</td><td>24</td><td>25</td><td>26</td><td>27</td><td>28</td></tr><tr><td>29</td><td>30</td></tr></table>#), ", html => qr#<table class="calendar"><tr><th class="calendar__header" colspan="7"><b>November 2009</b></th></tr><tr><th>S</th><th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th></tr><tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr><tr><td>8</td><td>9</td><td>10</td><td>11</td><td>12</td><td>13</td><td>14</td></tr><tr><td>15</td><td>16</td><td>17</td><td>18</td><td>19</td><td>20</td><td>21</td></tr><tr><td>22</td><td>23</td><td>24</td><td>25</td><td>26</td><td>27</td><td>28</td></tr><tr><td>29</td><td>30</td></tr></table>#),
'calendar 29 nov 2015' => test_zci(" 'calendar 29 nov 2015' => test_zci("
S M T W T F S November 2015 S M T W T F S November 2015
1 2 3 4 5 6 7 1 2 3 4 5 6 7
8 9 10 11 12 13 14 8 9 10 11 12 13 14
15 16 17 18 19 20 21 15 16 17 18 19 20 21
22 23 24 25 26 27 28 22 23 24 25 26 27 28
|29| 30 |29| 30
", html => qr#<table class="calendar"><tr><th class="calendar__header" colspan="7"><b>November 2015</b></th></tr><tr><th>S</th><th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th></tr><tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr><tr><td>8</td><td>9</td><td>10</td><td>11</td><td>12</td><td>13</td><td>14</td></tr><tr><td>15</td><td>16</td><td>17</td><td>18</td><td>19</td><td>20</td><td>21</td></tr><tr><td>22</td><td>23</td><td>24</td><td>25</td><td>26</td><td>27</td><td>28</td></tr><tr><td><span class="calendar__today circle">29</span></td><td>30</td></tr></table>#), ", html => qr#<table class="calendar"><tr><th class="calendar__header" colspan="7"><b>November 2015</b></th></tr><tr><th>S</th><th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th></tr><tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr><tr><td>8</td><td>9</td><td>10</td><td>11</td><td>12</td><td>13</td><td>14</td></tr><tr><td>15</td><td>16</td><td>17</td><td>18</td><td>19</td><td>20</td><td>21</td></tr><tr><td>22</td><td>23</td><td>24</td><td>25</td><td>26</td><td>27</td><td>28</td></tr><tr><td><span class="calendar__today circle">29</span></td><td>30</td></tr></table>#),
'calendar 29.11.2015' => test_zci(" 'calendar 29.11.2015' => test_zci("
S M T W T F S November 2015 S M T W T F S November 2015
1 2 3 4 5 6 7 1 2 3 4 5 6 7
8 9 10 11 12 13 14 8 9 10 11 12 13 14
15 16 17 18 19 20 21 15 16 17 18 19 20 21
22 23 24 25 26 27 28 22 23 24 25 26 27 28
|29| 30 |29| 30
", html => qr#<table class="calendar"><tr><th class="calendar__header" colspan="7"><b>November 2015</b></th></tr><tr><th>S</th><th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th></tr><tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr><tr><td>8</td><td>9</td><td>10</td><td>11</td><td>12</td><td>13</td><td>14</td></tr><tr><td>15</td><td>16</td><td>17</td><td>18</td><td>19</td><td>20</td><td>21</td></tr><tr><td>22</td><td>23</td><td>24</td><td>25</td><td>26</td><td>27</td><td>28</td></tr><tr><td><span class="calendar__today circle">29</span></td><td>30</td></tr></table>#), ", html => qr#<table class="calendar"><tr><th class="calendar__header" colspan="7"><b>November 2015</b></th></tr><tr><th>S</th><th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th></tr><tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr><tr><td>8</td><td>9</td><td>10</td><td>11</td><td>12</td><td>13</td><td>14</td></tr><tr><td>15</td><td>16</td><td>17</td><td>18</td><td>19</td><td>20</td><td>21</td></tr><tr><td>22</td><td>23</td><td>24</td><td>25</td><td>26</td><td>27</td><td>28</td></tr><tr><td><span class="calendar__today circle">29</span></td><td>30</td></tr></table>#),
'cal 1980-11-29' => test_zci(" 'cal 1980-11-29' => test_zci("
S M T W T F S November 1980 S M T W T F S November 1980
1 1
2 3 4 5 6 7 8 2 3 4 5 6 7 8
9 10 11 12 13 14 15 9 10 11 12 13 14 15
16 17 18 19 20 21 22 16 17 18 19 20 21 22
23 24 25 26 27 28 |29| 23 24 25 26 27 28 |29|
30 30
", html => qr#<table class="calendar"><tr><th class="calendar__header" colspan="7"><b>November 1980</b></th></tr><tr><th>S</th><th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>1</td></tr><tr><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td></tr><tr><td>9</td><td>10</td><td>11</td><td>12</td><td>13</td><td>14</td><td>15</td></tr><tr><td>16</td><td>17</td><td>18</td><td>19</td><td>20</td><td>21</td><td>22</td></tr><tr><td>23</td><td>24</td><td>25</td><td>26</td><td>27</td><td>28</td><td><span class="calendar__today circle">29</span></td></tr><tr><td>30</td></tr></table>#), ", html => qr#<table class="calendar"><tr><th class="calendar__header" colspan="7"><b>November 1980</b></th></tr><tr><th>S</th><th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>1</td></tr><tr><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td></tr><tr><td>9</td><td>10</td><td>11</td><td>12</td><td>13</td><td>14</td><td>15</td></tr><tr><td>16</td><td>17</td><td>18</td><td>19</td><td>20</td><td>21</td><td>22</td></tr><tr><td>23</td><td>24</td><td>25</td><td>26</td><td>27</td><td>28</td><td><span class="calendar__today circle">29</span></td></tr><tr><td>30</td></tr></table>#),
'calendar for november 2009' => test_zci(" 'calendar for november 2009' => test_zci("
S M T W T F S November 2009 S M T W T F S November 2009
1 2 3 4 5 6 7 1 2 3 4 5 6 7
8 9 10 11 12 13 14 8 9 10 11 12 13 14
15 16 17 18 19 20 21 15 16 17 18 19 20 21
22 23 24 25 26 27 28 22 23 24 25 26 27 28
29 30 29 30
", html => qr#<table class="calendar"><tr><th class="calendar__header" colspan="7"><b>November 2009</b></th></tr><tr><th>S</th><th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th></tr><tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr><tr><td>8</td><td>9</td><td>10</td><td>11</td><td>12</td><td>13</td><td>14</td></tr><tr><td>15</td><td>16</td><td>17</td><td>18</td><td>19</td><td>20</td><td>21</td></tr><tr><td>22</td><td>23</td><td>24</td><td>25</td><td>26</td><td>27</td><td>28</td></tr><tr><td>29</td><td>30</td></tr></table>#), ", html => qr#<table class="calendar"><tr><th class="calendar__header" colspan="7"><b>November 2009</b></th></tr><tr><th>S</th><th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th></tr><tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr><tr><td>8</td><td>9</td><td>10</td><td>11</td><td>12</td><td>13</td><td>14</td></tr><tr><td>15</td><td>16</td><td>17</td><td>18</td><td>19</td><td>20</td><td>21</td></tr><tr><td>22</td><td>23</td><td>24</td><td>25</td><td>26</td><td>27</td><td>28</td></tr><tr><td>29</td><td>30</td></tr></table>#),
'next november on a calendar' => test_zci(qr/\nS M T W T F S November [0-9]{4}\n.+/, html => qr#<table class="calendar".+</table>#), 'next november on a calendar' => test_zci(qr/\nS M T W T F S November [0-9]{4}\n.+/, html => qr#<table class="calendar".+</table>#),
'calendar for november' => test_zci(qr/\nS M T W T F S November [0-9]{4}\n.+/, html => qr#<table class="calendar".+</table>#), 'calendar for november' => test_zci(qr/\nS M T W T F S November [0-9]{4}\n.+/, html => qr#<table class="calendar".+</table>#),
'calendar of november 2009' => test_zci(" 'calendar of november 2009' => test_zci("
S M T W T F S November 2009 S M T W T F S November 2009
1 2 3 4 5 6 7 1 2 3 4 5 6 7
8 9 10 11 12 13 14 8 9 10 11 12 13 14
15 16 17 18 19 20 21 15 16 17 18 19 20 21
22 23 24 25 26 27 28 22 23 24 25 26 27 28
29 30 29 30
", html => qr#<table class="calendar"><tr><th class="calendar__header" colspan="7"><b>November 2009</b></th></tr><tr><th>S</th><th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th></tr><tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr><tr><td>8</td><td>9</td><td>10</td><td>11</td><td>12</td><td>13</td><td>14</td></tr><tr><td>15</td><td>16</td><td>17</td><td>18</td><td>19</td><td>20</td><td>21</td></tr><tr><td>22</td><td>23</td><td>24</td><td>25</td><td>26</td><td>27</td><td>28</td></tr><tr><td>29</td><td>30</td></tr></table>#), ", html => qr#<table class="calendar"><tr><th class="calendar__header" colspan="7"><b>November 2009</b></th></tr><tr><th>S</th><th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th></tr><tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr><tr><td>8</td><td>9</td><td>10</td><td>11</td><td>12</td><td>13</td><td>14</td></tr><tr><td>15</td><td>16</td><td>17</td><td>18</td><td>19</td><td>20</td><td>21</td></tr><tr><td>22</td><td>23</td><td>24</td><td>25</td><td>26</td><td>27</td><td>28</td></tr><tr><td>29</td><td>30</td></tr></table>#),
'22/8/2003 to the hijri calendar' => undef, '22/8/2003 to the hijri calendar' => undef,
); );

View File

@ -12,7 +12,7 @@ ddg_goodie_test(
[qw( [qw(
DDG::Goodie::Chess960 DDG::Goodie::Chess960
)], )],
map { map {
$_ => test_zci(qr/^Position \d{1,3}: $_ => test_zci(qr/^Position \d{1,3}:
White: ([BKNQRP] ?){1,8} White: ([BKNQRP] ?){1,8}
([BKNQRP] ?){0,8} ([BKNQRP] ?){0,8}

View File

@ -38,7 +38,7 @@ ddg_goodie_test(
#Should not trigger for impossible latitudes and longitudes #Should not trigger for impossible latitudes and longitudes
'95º 4\' N as decimal' => undef, '95º 4\' N as decimal' => undef,
'convert 293.11 degrees to dms' => undef, 'convert 293.11 degrees to dms' => undef,
#Should not trigger for impossible combinations of sign and #Should not trigger for impossible combinations of sign and
# cardinal direction # cardinal direction
'-71º 12\' 51" S as a decimal latitude' => undef, '-71º 12\' 51" S as a decimal latitude' => undef,

View File

@ -17,14 +17,14 @@ ddg_goodie_test(
html => qq(This is a 128 bit <a href="http://en.wikipedia.org/wiki/MD5">MD5</a> cryptographic hash.), html => qq(This is a 128 bit <a href="http://en.wikipedia.org/wiki/MD5">MD5</a> cryptographic hash.),
answer_type => "crypthashcheck" answer_type => "crypthashcheck"
), ),
'hash ecaceaca62d6c47190ed6c6f94a298f28a46450fda0bd1ec8fc64bc4a7a8cd436791a35f3c4e339b7ae480c1b751f1c1' => test_zci( 'hash ecaceaca62d6c47190ed6c6f94a298f28a46450fda0bd1ec8fc64bc4a7a8cd436791a35f3c4e339b7ae480c1b751f1c1' => test_zci(
qq(This is a 384 bit SHA-2/SHA-3 cryptographic hash.), qq(This is a 384 bit SHA-2/SHA-3 cryptographic hash.),
html => qq(This is a 384 bit <a href="http://en.wikipedia.org/wiki/SHA-2">SHA-2</a>/<a href="http://en.wikipedia.org/wiki/SHA-3">SHA-3</a> cryptographic hash.), html => qq(This is a 384 bit <a href="http://en.wikipedia.org/wiki/SHA-2">SHA-2</a>/<a href="http://en.wikipedia.org/wiki/SHA-3">SHA-3</a> cryptographic hash.),
answer_type => "crypthashcheck" answer_type => "crypthashcheck"
), ),
'hash b1d7eb51d4372c505446abca04835a101275e498' => test_zci( 'hash b1d7eb51d4372c505446abca04835a101275e498' => test_zci(
qq(This is a 160 bit SHA-1 cryptographic hash.), qq(This is a 160 bit SHA-1 cryptographic hash.),
html => qq(This is a 160 bit <a href="http://en.wikipedia.org/wiki/SHA-1">SHA-1</a> cryptographic hash.), html => qq(This is a 160 bit <a href="http://en.wikipedia.org/wiki/SHA-1">SHA-1</a> cryptographic hash.),
answer_type => "crypthashcheck" answer_type => "crypthashcheck"
), ),
'hash 6286e0a5cbc030f7b2d105f594ae0afb9105c92175c6b07ff454734c23cd0bddfed77639fe59b68a70b8c78af27657f611cbe89c27f7a47b978fa9449808c19f' => test_zci( 'hash 6286e0a5cbc030f7b2d105f594ae0afb9105c92175c6b07ff454734c23cd0bddfed77639fe59b68a70b8c78af27657f611cbe89c27f7a47b978fa9449808c19f' => test_zci(
@ -38,15 +38,15 @@ ddg_goodie_test(
answer_type => "crypthashcheck" answer_type => "crypthashcheck"
), ),
'hash 624d420035fc9471f6e16766b7132dd6bb34ea62' => test_zci( 'hash 624d420035fc9471f6e16766b7132dd6bb34ea62' => test_zci(
'This is a 160 bit SHA-1 cryptographic hash.', 'This is a 160 bit SHA-1 cryptographic hash.',
html => 'This is a 160 bit <a href="http://en.wikipedia.org/wiki/SHA-1">SHA-1</a> cryptographic hash.' html => 'This is a 160 bit <a href="http://en.wikipedia.org/wiki/SHA-1">SHA-1</a> cryptographic hash.'
), ),
'hash 1f9b59a2390bb77d2c446837d6aeab067f01b05732735f47099047cd7d3e9f85' => test_zci( 'hash 1f9b59a2390bb77d2c446837d6aeab067f01b05732735f47099047cd7d3e9f85' => test_zci(
'This is a 256 bit SHA-2/SHA-3 cryptographic hash.', 'This is a 256 bit SHA-2/SHA-3 cryptographic hash.',
html => 'This is a 256 bit <a href="http://en.wikipedia.org/wiki/SHA-2">SHA-2</a>/<a href="http://en.wikipedia.org/wiki/SHA-3">SHA-3</a> cryptographic hash.' html => 'This is a 256 bit <a href="http://en.wikipedia.org/wiki/SHA-2">SHA-2</a>/<a href="http://en.wikipedia.org/wiki/SHA-3">SHA-3</a> cryptographic hash.'
), ),
); );
done_testing; done_testing;

View File

@ -22,19 +22,19 @@ ddg_goodie_test(
# queries with too many chars should not trigger the IA # queries with too many chars should not trigger the IA
'cusip 0123456789' => undef, 'cusip 0123456789' => undef,
# white spaces should not be counted as chars # white spaces should not be counted as chars
'cusip 6789' => undef, 'cusip 6789' => undef,
'cusip 1234 ' => undef, 'cusip 1234 ' => undef,
'cusip 1234 6789' => undef, 'cusip 1234 6789' => undef,
# queries with nonalphanumeric chars that are not '*', '#', or '@' # queries with nonalphanumeric chars that are not '*', '#', or '@'
# should not trigger the IA # should not trigger the IA
'cusip _12345678' => undef, 'cusip _12345678' => undef,
'cusip 01234567+' => undef, 'cusip 01234567+' => undef,
# multiple IDs are not currently checked # multiple IDs are not currently checked
'cusip 037833100 037833100' => undef, 'cusip 037833100 037833100' => undef,
'cusip 037833100 12345' => undef, 'cusip 037833100 12345' => undef,
'cusip 12345 037833100' => undef, 'cusip 12345 037833100' => undef,
'cusip 01234 56789' => undef, 'cusip 01234 56789' => undef,
@ -63,7 +63,7 @@ ddg_goodie_test(
'cusip 03783310A' => test_zci("03783310A is not a properly formatted CUSIP number.", html => qr/.*/), 'cusip 03783310A' => test_zci("03783310A is not a properly formatted CUSIP number.", html => qr/.*/),
'cusip 03783310A ' => test_zci("03783310A is not a properly formatted CUSIP number.", html => qr/.*/), 'cusip 03783310A ' => test_zci("03783310A is not a properly formatted CUSIP number.", html => qr/.*/),
'cusip 03783310A ' => test_zci("03783310A is not a properly formatted CUSIP number.", html => qr/.*/), 'cusip 03783310A ' => test_zci("03783310A is not a properly formatted CUSIP number.", html => qr/.*/),
# check CUSIP IDs with capital letters (these are for GOOG and Blackberry) # check CUSIP IDs with capital letters (these are for GOOG and Blackberry)
'cusip 38259P706' => test_zci("38259P706 is a properly formatted CUSIP number.", html => qr/.*/), 'cusip 38259P706' => test_zci("38259P706 is a properly formatted CUSIP number.", html => qr/.*/),
'cusip 38259P508' => test_zci("38259P508 is a properly formatted CUSIP number.", html => qr/.*/), 'cusip 38259P508' => test_zci("38259P508 is a properly formatted CUSIP number.", html => qr/.*/),
@ -72,8 +72,8 @@ ddg_goodie_test(
# check the same CUSIP IDs with lower case letters # check the same CUSIP IDs with lower case letters
'cusip 38259p706' => test_zci("38259P706 is a properly formatted CUSIP number.", html => qr/.*/), 'cusip 38259p706' => test_zci("38259P706 is a properly formatted CUSIP number.", html => qr/.*/),
'cusip 38259p508' => test_zci("38259P508 is a properly formatted CUSIP number.", html => qr/.*/), 'cusip 38259p508' => test_zci("38259P508 is a properly formatted CUSIP number.", html => qr/.*/),
'cusip 09228f103' => test_zci("09228F103 is a properly formatted CUSIP number.", html => qr/.*/), 'cusip 09228f103' => test_zci("09228F103 is a properly formatted CUSIP number.", html => qr/.*/),
# check CUSIP IDs with '*', '#', and '@' # check CUSIP IDs with '*', '#', and '@'
# these CUSIP ID check digits were calculated by hand # these CUSIP ID check digits were calculated by hand
# if possible, these tests should be replaced with verified CUSIP IDs # if possible, these tests should be replaced with verified CUSIP IDs
@ -82,9 +82,9 @@ ddg_goodie_test(
'cusip 0378331#0' => test_zci("0378331#0 is not a properly formatted CUSIP number.", html => qr/.*/), 'cusip 0378331#0' => test_zci("0378331#0 is not a properly formatted CUSIP number.", html => qr/.*/),
'cusip 0378331#7' => test_zci("0378331#7 is a properly formatted CUSIP number.", html => qr/.*/), 'cusip 0378331#7' => test_zci("0378331#7 is a properly formatted CUSIP number.", html => qr/.*/),
'cusip 037833@00' => test_zci("037833\@00 is not a properly formatted CUSIP number.", html => qr/.*/), 'cusip 037833@00' => test_zci("037833\@00 is not a properly formatted CUSIP number.", html => qr/.*/),
'cusip 037833@01' => test_zci("037833\@01 is a properly formatted CUSIP number.", html => qr/.*/), 'cusip 037833@01' => test_zci("037833\@01 is a properly formatted CUSIP number.", html => qr/.*/),
# CUSIP IDs ending in '*', '#', and '@' should not break the IA # CUSIP IDs ending in '*', '#', and '@' should not break the IA
# even though they are always invalid IDs # even though they are always invalid IDs
'cusip 03783310*' => test_zci("03783310* is not a properly formatted CUSIP number.", html => qr/.*/), 'cusip 03783310*' => test_zci("03783310* is not a properly formatted CUSIP number.", html => qr/.*/),
'cusip 03783310#' => test_zci("03783310# is not a properly formatted CUSIP number.", html => qr/.*/), 'cusip 03783310#' => test_zci("03783310# is not a properly formatted CUSIP number.", html => qr/.*/),

View File

@ -21,7 +21,7 @@ ddg_goodie_test(
html => qq(Track this shipment at <a href='http://www.dhl-usa.com/content/us/en/express/tracking.shtml?brand=DHL&AWB=1234567891'>DHL</a>.) html => qq(Track this shipment at <a href='http://www.dhl-usa.com/content/us/en/express/tracking.shtml?brand=DHL&AWB=1234567891'>DHL</a>.)
), ),
'DHL 123456789' => test_zci( 'DHL 123456789' => test_zci(
'123456789', '123456789',
heading => 'DHL Shipment Tracking', heading => 'DHL Shipment Tracking',
html => "Track this shipment at <a href='http://www.dhl-usa.com/content/us/en/express/tracking.shtml?brand=DHL&AWB=123456789'>DHL</a>.", html => "Track this shipment at <a href='http://www.dhl-usa.com/content/us/en/express/tracking.shtml?brand=DHL&AWB=123456789'>DHL</a>.",
), ),

View File

@ -15,7 +15,7 @@ ddg_goodie_test(
'days between 01/01/2000 01/01/2001' => test_zci('There are 366 days between 01 Jan 2000 and 01 Jan 2001.'), 'days between 01/01/2000 01/01/2001' => test_zci('There are 366 days between 01 Jan 2000 and 01 Jan 2001.'),
'days between 1/1/2000 and 1/1/2001 inclusive' => test_zci('There are 367 days between 01 Jan 2000 and 01 Jan 2001, inclusive.'), 'days between 1/1/2000 and 1/1/2001 inclusive' => test_zci('There are 367 days between 01 Jan 2000 and 01 Jan 2001, inclusive.'),
'daysbetween 03/4/2005 and 11/8/2020' => test_zci('There are 5728 days between 04 Mar 2005 and 08 Nov 2020.'), 'daysbetween 03/4/2005 and 11/8/2020' => test_zci('There are 5728 days between 04 Mar 2005 and 08 Nov 2020.'),
'days_between 3/14/2005 and 1/2/2003' => test_zci('There are 802 days between 02 Jan 2003 and 14 Mar 2005.'), 'days_between 3/14/2005 and 1/2/2003' => test_zci('There are 802 days between 02 Jan 2003 and 14 Mar 2005.'),
'days between 01/31/2000 01/31/2001' => test_zci('There are 366 days between 31 Jan 2000 and 31 Jan 2001.'), 'days between 01/31/2000 01/31/2001' => test_zci('There are 366 days between 31 Jan 2000 and 31 Jan 2001.'),
'days between 01/31/2000 01/31/2001 inclusive' => test_zci('There are 367 days between 31 Jan 2000 and 31 Jan 2001, inclusive.'), 'days between 01/31/2000 01/31/2001 inclusive' => test_zci('There are 367 days between 31 Jan 2000 and 31 Jan 2001, inclusive.'),
'days between January 31st, 2000 and 31-Jan-2001 inclusive' => test_zci('There are 367 days between 31 Jan 2000 and 31 Jan 2001, inclusive.'), 'days between January 31st, 2000 and 31-Jan-2001 inclusive' => test_zci('There are 367 days between 31 Jan 2000 and 31 Jan 2001, inclusive.'),

View File

@ -13,19 +13,19 @@ ddg_goodie_test(
'DDG::Goodie::Dessert' 'DDG::Goodie::Dessert'
], ],
'desserts beginning with a' => test_zci( 'desserts beginning with a' => test_zci(
qr/(.*?) is a dessert that begins with 'a'\.$/, qr/(.*?) is a dessert that begins with 'a'\.$/,
html => qr/(.*?) is a dessert that begins with 'a'\.$/ html => qr/(.*?) is a dessert that begins with 'a'\.$/
), ),
'desserts beginning with A' => test_zci( 'desserts beginning with A' => test_zci(
qr/(.*?) is a dessert that begins with 'A'\.$/, qr/(.*?) is a dessert that begins with 'A'\.$/,
html => qr/(.*?) is a dessert that begins with 'A'\.$/ html => qr/(.*?) is a dessert that begins with 'A'\.$/
), ),
'dessert start with a' => test_zci( 'dessert start with a' => test_zci(
qr/(.*?) is a dessert that begins with 'a'\.$/, qr/(.*?) is a dessert that begins with 'a'\.$/,
html => qr/(.*?) is a dessert that begins with 'a'\.$/ html => qr/(.*?) is a dessert that begins with 'a'\.$/
), ),
'desserts starting with a' => test_zci( 'desserts starting with a' => test_zci(
qr/(.*?) is a dessert that begins with 'a'\.$/, qr/(.*?) is a dessert that begins with 'a'\.$/,
html => qr/(.*?) is a dessert that begins with 'a'\.$/ html => qr/(.*?) is a dessert that begins with 'a'\.$/
), ),
'dessert starts with a' => test_zci( 'dessert starts with a' => test_zci(
@ -41,11 +41,11 @@ ddg_goodie_test(
html => qr/(.*?) is a dessert that begins with 'a'\.$/ html => qr/(.*?) is a dessert that begins with 'a'\.$/
), ),
'a dessert that starts with the letter a' => test_zci( 'a dessert that starts with the letter a' => test_zci(
qr/(.*?) is a dessert that begins with 'a'\.$/, qr/(.*?) is a dessert that begins with 'a'\.$/,
html => qr/(.*?) is a dessert that begins with 'a'\.$/ html => qr/(.*?) is a dessert that begins with 'a'\.$/
), ),
'dessert that begins with the letter z' => test_zci( 'dessert that begins with the letter z' => test_zci(
qr/(.*?) is a dessert that begins with 'z'\.$/, qr/(.*?) is a dessert that begins with 'z'\.$/,
html => qr/(.*?) is a dessert that begins with 'z'\.$/ html => qr/(.*?) is a dessert that begins with 'z'\.$/
), ),
); );

Some files were not shown because too many files have changed in this diff Show More