commit
7cbb3dcec9
3
dist.ini
3
dist.ini
|
@ -84,6 +84,7 @@ LWP::Simple = 0
|
|||
Business::CUSIP = 1.03
|
||||
|
||||
[Prereqs / TestRequires]
|
||||
Test::EOL = 0
|
||||
Test::MockTime = 0
|
||||
Test::More = 0.98
|
||||
Test::Most = 0
|
||||
|
@ -114,7 +115,7 @@ version_regexp = ^(.+)$
|
|||
[PodSyntaxTests]
|
||||
[GithubMeta]
|
||||
[Repository]
|
||||
[EOLTests]
|
||||
[Test::EOL]
|
||||
trailing_whitespace = 0
|
||||
[@Git]
|
||||
tag_format = %v
|
||||
|
|
|
@ -30,7 +30,7 @@ handle remainder => sub {
|
|||
my $query = $_;
|
||||
|
||||
# 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);
|
||||
|
||||
|
@ -48,7 +48,7 @@ handle remainder => sub {
|
|||
return $choices[$index]." (random)";
|
||||
};
|
||||
|
||||
# The query must look like
|
||||
# The query must look like
|
||||
# '<choice> or <choice> or <choice>'
|
||||
#
|
||||
# Note this method also prevents choices from being > 1 word long as this
|
||||
|
|
|
@ -34,7 +34,7 @@ my %eras = (
|
|||
handle query_parts => sub {
|
||||
# Ignore single word queries
|
||||
return unless scalar(@_) > 1;
|
||||
|
||||
|
||||
if ($_ =~ /^(.*\b)(meiji|taisho|taishou|showa|shouwa|heisei|juche|minguo)\s+(\d*[1-9]\d*)(\b.*)$/i) {
|
||||
my $era_name = ucfirst($2);
|
||||
my $era_year = $3;
|
||||
|
@ -42,18 +42,18 @@ handle query_parts => sub {
|
|||
my $result = $1.$year.$4;
|
||||
my $wiki = 'https://en.wikipedia.org/wiki/';
|
||||
my $answer;
|
||||
|
||||
|
||||
if ($result =~ /^[0-9]{4}$/) {
|
||||
$answer = "$era_name $era_year is equivalent to $year in the Gregorian Calendar";
|
||||
} else {
|
||||
$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>';
|
||||
|
||||
|
||||
return $answer, html => $answer_html;
|
||||
};
|
||||
|
||||
|
||||
return ;
|
||||
};
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ zci answer_type => "ascii_conversion";
|
|||
zci is_cached => 1;
|
||||
|
||||
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;
|
||||
};
|
||||
|
|
|
@ -23,7 +23,7 @@ handle remainder => sub {
|
|||
if ($_) {
|
||||
my $char;
|
||||
my $result;
|
||||
|
||||
|
||||
while (/(.)/g) {
|
||||
if ($1 =~ /([a-z])/) {
|
||||
# Substitute lowercase characters
|
||||
|
@ -36,7 +36,7 @@ handle remainder => sub {
|
|||
else { $char = $1; }
|
||||
$result .= $char;
|
||||
}
|
||||
|
||||
|
||||
return "Atbash: $result";
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -52,7 +52,7 @@ handle remainder => sub {
|
|||
@nums = sort { $a <=> $b } @nums;
|
||||
my $med;
|
||||
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
|
||||
$med = ($nums[$len/2] + $nums[$len/2-1])/2;
|
||||
} else {
|
||||
|
|
|
@ -37,7 +37,7 @@ handle remainder => sub {
|
|||
$str = decode( "UTF-8", $str );
|
||||
chomp $str;
|
||||
|
||||
return "Base64 decoded: $str";
|
||||
return "Base64 decoded: $str";
|
||||
}
|
||||
else {
|
||||
$str = encode_base64( encode( "UTF-8", $str ) );
|
||||
|
|
|
@ -78,22 +78,22 @@ handle remainder => sub {
|
|||
|
||||
return unless ($op && $right_arg);
|
||||
return unless $if_description{$op};
|
||||
|
||||
|
||||
my $text_output = $if_description{$op};
|
||||
$text_output =~ s/^true/false/ if $not;
|
||||
|
||||
|
||||
my $html_output = html_enc($text_output);
|
||||
my $html_right_arg = html_enc($right_arg);
|
||||
|
||||
|
||||
if ($left_arg) {
|
||||
my $html_left_arg = html_enc($left_arg);
|
||||
$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;
|
||||
$html_output =~ s/ARG2/<pre>$html_right_arg<\/pre>/g;
|
||||
|
||||
|
||||
my $intro = "The Bash expression <pre>" . html_enc($_) . "</pre> results to";
|
||||
return "$intro $text_output.", html => "$intro $html_output.", heading => html_enc($_) . " (Bash)";
|
||||
};
|
||||
|
|
|
@ -13,7 +13,7 @@ triggers query_raw => qr/not\s+.*/;
|
|||
triggers query_raw => qr/¬.*/;
|
||||
|
||||
zci is_cached => 1;
|
||||
zci answer_type => "binary_logic";
|
||||
zci answer_type => "binary_logic";
|
||||
|
||||
attribution
|
||||
github => ['https://github.com/MithrandirAgain', 'MithrandirAgain'],
|
||||
|
@ -21,8 +21,8 @@ attribution
|
|||
twitter => ['https://twitter.com/Prypjat', 'Bjoern Paschen'];
|
||||
|
||||
primary_example_queries '4 xor 5', '3 and 2', '1 or 1234';
|
||||
secondary_example_queries
|
||||
'9489 xor 394 xor 9349 xor 39 xor 29 xor 4967 xor 3985',
|
||||
secondary_example_queries
|
||||
'9489 xor 394 xor 9349 xor 39 xor 29 xor 4967 xor 3985',
|
||||
'10 and 12',
|
||||
'34 or 100',
|
||||
'10 and (30 or 128)',
|
||||
|
@ -46,7 +46,7 @@ Term ::=
|
|||
| Term 'and' Term action => do_and
|
||||
| Term 'or' Term action => do_or
|
||||
|
||||
Number ::=
|
||||
Number ::=
|
||||
HexNumber action => hex_number
|
||||
| HexNumberCaps action => hex_number
|
||||
| BinaryNumber action => binary_number
|
||||
|
@ -104,7 +104,7 @@ handle query_raw => sub {
|
|||
|
||||
my $input = $_;
|
||||
|
||||
# Substitute the unicode characters. The parser does not seem to
|
||||
# Substitute the unicode characters. The parser does not seem to
|
||||
# like unicode.
|
||||
$input =~ s/⊕/ xor /;
|
||||
$input =~ s/∧/ and /;
|
||||
|
|
|
@ -16,7 +16,7 @@ topics 'special_interest', 'entertainment';
|
|||
category 'random';
|
||||
attribution github => [ 'https://github.com/austinheimark', 'austin_heimark' ];
|
||||
|
||||
my %birthstones = (
|
||||
my %birthstones = (
|
||||
"january" => "Garnet",
|
||||
"february" => "Amethyst",
|
||||
"march" => "Aquamarine",
|
||||
|
|
|
@ -6,7 +6,7 @@ use DDG::Goodie;
|
|||
use strict;
|
||||
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 type', 'blood compatibility', 'compatibility', 'blood donor compatibility';
|
||||
|
||||
|
@ -43,7 +43,7 @@ handle remainder => sub {
|
|||
my @criticalResults = ();
|
||||
|
||||
return unless defined $typeMap{$type};
|
||||
|
||||
|
||||
# ideally same Rh
|
||||
foreach our $donorType (split(",", $typeMap{$type})) {
|
||||
push(@idealResults, $donorType . $rh);
|
||||
|
@ -55,20 +55,20 @@ handle remainder => sub {
|
|||
|
||||
my $output = '';
|
||||
my $html = "<table class='blooddonor'>";
|
||||
|
||||
|
||||
my $idealStr = join(' or ', @idealResults);
|
||||
my $criticalStr = join(' or ', @criticalResults);
|
||||
|
||||
|
||||
$output .= "Ideal donor: " . uc($_) . "\n";
|
||||
$output .= "Other donors: " . $idealStr . "\n";
|
||||
$html .= table_data("Ideal donor:", uc($_));
|
||||
$html .= table_data("Other donors:", $idealStr);
|
||||
|
||||
|
||||
if($rh eq '+') {
|
||||
$output .= "Only if no Rh(+) found: " . $criticalStr . "\n";
|
||||
$html .= table_data("<i>Only if</i> no Rh(+) found:", $criticalStr);
|
||||
}
|
||||
|
||||
|
||||
$html .= '</table>';
|
||||
return $output, html => $html, heading => "Donors for blood type ".uc($_);
|
||||
}
|
||||
|
|
|
@ -21,21 +21,21 @@ zci answer_type => 'root';
|
|||
handle query => sub {
|
||||
# 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;
|
||||
|
||||
|
||||
# Common phrases that won't be caught by str2nbr()
|
||||
my %function = (
|
||||
'square' => 2,
|
||||
'cubed' => 3,
|
||||
'cube' => 3,
|
||||
);
|
||||
|
||||
|
||||
# Seperate the exponent and base courtesy of the above regex
|
||||
my $exp = $1;
|
||||
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) {
|
||||
$exp = $function{$'} ? $function{$'} * -1 : str2nbr($') * -1;
|
||||
$exp = $function{$'} ? $function{$'} * -1 : str2nbr($') * -1;
|
||||
}
|
||||
else {
|
||||
$exp = $function{$exp} ? $function{$exp} : str2nbr($exp);
|
||||
|
@ -49,17 +49,17 @@ handle query => sub {
|
|||
# 1. Negative base and even exponent (imaginary numbers)
|
||||
# 2. Negative base and odd exponenet
|
||||
# 3. Positive base
|
||||
|
||||
|
||||
if ($base =~ m/negative\s|minus\s|\A-/i && $exp % 2 == 0) {
|
||||
|
||||
|
||||
# Figure out what number the base is
|
||||
$base = $';
|
||||
$base = str2nbr($base) if $base =~ /[^0-9]/;
|
||||
|
||||
|
||||
# Solve using the absolute value of the base
|
||||
$base = abs($base);
|
||||
my $calc = $base ** (1/$exp);
|
||||
|
||||
|
||||
# If the result is a whole number (n), the answer is n*i
|
||||
if (($calc - int($calc)) == 0) {
|
||||
return $calc . 'i', html => "<sup>$exp</sup>√-$base = $calc<em>i</em>";
|
||||
|
@ -69,12 +69,12 @@ handle query => sub {
|
|||
my $count = int($calc);
|
||||
|
||||
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)
|
||||
my $newBase = $base / ($count ** $exp);
|
||||
|
||||
if ( ($newBase - int($newBase)) == 0) {
|
||||
return "The $exp-root of -$base is $count * i * the $exp-root of $newBase.", html=> "<sup>$exp</sup>√-$base = $count<em>i</em>⋅<sup>$exp</sup>√$newBase";
|
||||
return "The $exp-root of -$base is $count * i * the $exp-root of $newBase.", html=> "<sup>$exp</sup>√-$base = $count<em>i</em>⋅<sup>$exp</sup>√$newBase";
|
||||
}
|
||||
|
||||
$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>√-$base = <em>i</em>⋅<sup>$exp</sup>√$base";
|
||||
}
|
||||
elsif ($base =~ m/negative\s|minus\s|\A-/i && $exp % 2 != 0) {
|
||||
|
||||
|
||||
# Solve normally
|
||||
$base = $';
|
||||
$base = str2nbr($base) if $base =~ m/[^0-9]/;
|
||||
$base =~ s/[^0-9\.]//g;
|
||||
if ($base ne '') {
|
||||
|
||||
|
||||
my $calc = $base ** (1/$exp) * -1;
|
||||
|
||||
|
||||
# Try and simplify the radical
|
||||
my $count = int(abs($calc));
|
||||
|
||||
|
||||
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.
|
||||
my $newBase = $base / ($count ** $exp);
|
||||
|
||||
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>√-$base = <a href="javascript:;" onclick="document.x.q.value='$calc';document.x.q.focus();">$calc</a> (-$count⋅<sup>$exp</sup>√$newBase)|;
|
||||
return "The $exp-root of -$base is $calc (-$count times the $exp-root of $newBase).", html=> qq|<sup>$exp</sup>√-$base = <a href="javascript:;" onclick="document.x.q.value='$calc';document.x.q.focus();">$calc</a> (-$count⋅<sup>$exp</sup>√$newBase)|;
|
||||
}
|
||||
|
||||
$count--;
|
||||
|
@ -112,23 +112,23 @@ handle query => sub {
|
|||
}
|
||||
}
|
||||
elsif ($exp =~ m/[0-9]+/) {
|
||||
|
||||
|
||||
# Solve normally
|
||||
$base = str2nbr($base) if $base =~ m/[^0-9]/;
|
||||
$base =~ s/[^0-9\.]//g;
|
||||
if ($base ne '') {
|
||||
my $calc = $base ** (1/$exp);
|
||||
|
||||
|
||||
# Try and simplify the radical
|
||||
my $count = int($calc);
|
||||
|
||||
|
||||
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.
|
||||
my $newBase = $base / ($count ** $exp);
|
||||
|
||||
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>√$base = <a href="javascript:;" onclick="document.x.q.value='$calc';document.x.q.focus();">$calc</a> ($count⋅<sup>$exp</sup>√$newBase)|;
|
||||
return "The $exp-root of $base is $calc ($count times the $exp-root of $newBase).", html=> qq|<sup>$exp</sup>√$base = <a href="javascript:;" onclick="document.x.q.value='$calc';document.x.q.focus();">$calc</a> ($count⋅<sup>$exp</sup>√$newBase)|;
|
||||
}
|
||||
|
||||
$count--;
|
||||
|
@ -138,7 +138,7 @@ handle query => sub {
|
|||
}
|
||||
}
|
||||
|
||||
return;
|
||||
return;
|
||||
};
|
||||
|
||||
1;
|
||||
|
|
|
@ -40,7 +40,7 @@ triggers query_nowhitespace => qr<
|
|||
(?: [0-9 \. ,]* )
|
||||
(?: gross | dozen | pi | e | c | squared | score |)
|
||||
|
||||
[\( \) x X * % + / \^ 0-9 \. , \$ -]* =?
|
||||
[\( \) x X * % + / \^ 0-9 \. , \$ -]* =?
|
||||
|
||||
$
|
||||
>xi;
|
||||
|
|
|
@ -10,11 +10,11 @@ zci answer_type => 'calendar';
|
|||
zci is_cached => 0;
|
||||
|
||||
primary_example_queries "calendar";
|
||||
secondary_example_queries "calendar november",
|
||||
"calendar next november",
|
||||
"calendar november 2015",
|
||||
"cal 29 nov 1980",
|
||||
"cal 29.11.1980",
|
||||
secondary_example_queries "calendar november",
|
||||
"calendar next november",
|
||||
"calendar november 2015",
|
||||
"cal 29 nov 1980",
|
||||
"cal 29.11.1980",
|
||||
"cal 1980-11-29";
|
||||
|
||||
description "Print calendar of current / given month and highlight (to)day";
|
||||
|
@ -70,7 +70,7 @@ handle remainder => sub {
|
|||
sub format_result {
|
||||
my $args = shift;
|
||||
my ($firstDay, $first_day_num, $lastDay, $highlightDay) = @{$args}{qw(first_day first_day_num last_day highlight)};
|
||||
|
||||
|
||||
# Print heading
|
||||
my $rText = "\n";
|
||||
my $rHtml = '<table class="calendar"><tr><th class="calendar__header" colspan="7"><b>';
|
||||
|
|
|
@ -73,7 +73,7 @@ Locale::Country::add_country_alias('United States' => 'America');
|
|||
# Easter eggs
|
||||
Locale::Country::add_country_alias('Russian Federation' => 'Kremlin');
|
||||
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');
|
||||
|
||||
handle remainder => sub {
|
||||
|
|
|
@ -60,9 +60,9 @@ handle query_nowhitespace_nodash => sub {
|
|||
my $length = scalar(@chars);
|
||||
my $char_count = 0;
|
||||
my $sum = 0;
|
||||
|
||||
|
||||
foreach my $char (@chars) {
|
||||
$char_count++;
|
||||
$char_count++;
|
||||
|
||||
next if $char_count < 3;
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ handle query => sub {
|
|||
|
||||
my $query = $_;
|
||||
my $pos = undef;
|
||||
return unless ($query =~ /\bchess960\b/i &&
|
||||
return unless ($query =~ /\bchess960\b/i &&
|
||||
($query =~ /\brandom\b/i || (($pos) = $query =~ /\b(\d+)\b/))) ;
|
||||
|
||||
|
||||
|
|
|
@ -28,9 +28,9 @@ handle query_lc => sub {
|
|||
elsif ($_ =~ /^(?:flip|toss) (\d{0,2}) coins?$/) {
|
||||
$flips = $1;
|
||||
}
|
||||
|
||||
|
||||
return unless ($flips);
|
||||
|
||||
|
||||
my @output;
|
||||
my @ht = ("heads", "tails");
|
||||
|
||||
|
|
|
@ -100,15 +100,15 @@ handle query_lc => sub {
|
|||
# fix precision and rounding:
|
||||
my $precision = 3;
|
||||
my $nearest = '.' . ('0' x ($precision-1)) . '1';
|
||||
|
||||
|
||||
my $styler = number_style_for($factor);
|
||||
return unless $styler;
|
||||
|
||||
my $result = $c->convert( {
|
||||
'factor' => $styler->for_computation($factor),
|
||||
'from_unit' => $matches[0],
|
||||
'to_unit' => $matches[1],
|
||||
'precision' => $precision,
|
||||
my $result = $c->convert( {
|
||||
'factor' => $styler->for_computation($factor),
|
||||
'from_unit' => $matches[0],
|
||||
'to_unit' => $matches[1],
|
||||
'precision' => $precision,
|
||||
} );
|
||||
|
||||
return if !$result->{'result'};
|
||||
|
@ -116,16 +116,16 @@ handle query_lc => sub {
|
|||
my $f_result;
|
||||
|
||||
# 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) {
|
||||
# rounding error
|
||||
$result = $c->convert( {
|
||||
'factor' => $styler->for_computation($factor),
|
||||
'from_unit' => $matches[0],
|
||||
'to_unit' => $matches[1],
|
||||
'precision' => $precision,
|
||||
$result = $c->convert( {
|
||||
'factor' => $styler->for_computation($factor),
|
||||
'from_unit' => $matches[0],
|
||||
'to_unit' => $matches[1],
|
||||
'precision' => $precision,
|
||||
} );
|
||||
}
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ handle query_nowhitespace => sub {
|
|||
#If the degrees are expressed in decimal...
|
||||
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
|
||||
return if $toFormat && ! $toFormat eq 'DMS';
|
||||
$toFormat = 'DMS';
|
||||
|
@ -166,7 +166,7 @@ handle query_nowhitespace => sub {
|
|||
# minutes/seconds given)
|
||||
} 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
|
||||
return if $toFormat && ! $toFormat eq 'decimal';
|
||||
$toFormat = 'decimal';
|
||||
|
|
|
@ -17,16 +17,16 @@ topics "computing", "geek", "programming", "sysadmin";
|
|||
primary_example_queries 'crontab help', 'crontab cheat sheet', 'crontab example';
|
||||
|
||||
triggers startend => (
|
||||
'cron cheat sheet',
|
||||
'cron cheatsheet',
|
||||
'cron cheat sheet',
|
||||
'cron cheatsheet',
|
||||
'cron guide',
|
||||
'cron help',
|
||||
'cron quick reference',
|
||||
'cron reference',
|
||||
'cron example',
|
||||
'cron examples',
|
||||
'crontab cheat sheet',
|
||||
'crontab cheatsheet',
|
||||
'crontab cheat sheet',
|
||||
'crontab cheatsheet',
|
||||
'crontab guide',
|
||||
'crontab help',
|
||||
'crontab quick reference',
|
||||
|
@ -38,7 +38,7 @@ triggers startend => (
|
|||
attribution github => ["nkorth", "Nathan Korth"];
|
||||
|
||||
handle remainder => sub {
|
||||
return
|
||||
return
|
||||
heading => 'Cron Cheat Sheet',
|
||||
html => html_cheat_sheet(),
|
||||
answer => text_cheat_sheet(),
|
||||
|
|
|
@ -25,57 +25,57 @@ topics 'cryptography';
|
|||
|
||||
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 {
|
||||
my ($md5) = /^[0-9a-f]{32}$/i;
|
||||
if ($md5){
|
||||
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;
|
||||
|
||||
return $text, html => $html;
|
||||
my $html = sprintf qq(This is a 128 bit <a href="%s">MD5</a> cryptographic hash.),MD5HERF;
|
||||
|
||||
return $text, html => $html;
|
||||
}
|
||||
|
||||
my ($sha1) = /^[0-9a-f]{40}$/i;
|
||||
if ($sha1){
|
||||
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;
|
||||
|
||||
return $text, html => $html;
|
||||
my $html = sprintf qq(This is a 160 bit <a href="%s">SHA-1</a> cryptographic hash.),SHA1HREF;
|
||||
|
||||
return $text, html => $html;
|
||||
}
|
||||
|
||||
|
||||
my ($sha224) = /^[0-9a-f]{56}$/i;
|
||||
if ($sha224){
|
||||
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;
|
||||
|
||||
return $text, html => $html;
|
||||
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;
|
||||
}
|
||||
|
||||
my ($sha256) = /^[0-9a-f]{64}$/i;
|
||||
if ($sha256){
|
||||
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;
|
||||
|
||||
return $text, html => $html;
|
||||
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;
|
||||
}
|
||||
|
||||
my ($sha384) = /^[0-9a-f]{96}$/i;
|
||||
if ($sha384){
|
||||
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;
|
||||
|
||||
return $text, html => $html;
|
||||
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;
|
||||
}
|
||||
|
||||
my ($sha512) = /^[0-9a-f]{128}$/i;
|
||||
if ($sha512){
|
||||
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;
|
||||
|
||||
return $text, html => $html;
|
||||
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;
|
||||
return;
|
||||
};
|
||||
|
||||
1;
|
||||
|
|
|
@ -3,7 +3,7 @@ package DDG::Goodie::CurrencyIn;
|
|||
|
||||
# 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...
|
||||
# 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...
|
||||
|
||||
# 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...
|
||||
# ...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;
|
||||
$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
|
||||
|
@ -58,17 +58,17 @@ handle remainder => sub {
|
|||
return if $@ || !$loc;
|
||||
$country = lc($loc->country);
|
||||
}
|
||||
|
||||
|
||||
if (exists $countries{$country."\n"}){
|
||||
my $string_currency = $countries{$country."\n"}; # Load currencies as string (one line from .txt)
|
||||
my @currencies = split(',', $string_currency); # Split currencies into array
|
||||
|
||||
|
||||
my $count = $#currencies + 1; # Get number of currencies
|
||||
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";
|
||||
|
||||
|
||||
# Append result with all currencies
|
||||
for (@currencies) {
|
||||
chomp;
|
||||
|
@ -78,9 +78,9 @@ handle remainder => sub {
|
|||
chomp $result;
|
||||
my $html = $result;
|
||||
$html =~ s|\n|<br/>|g;
|
||||
|
||||
|
||||
return $result, html=>$html;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
|
@ -18,24 +18,24 @@ triggers startend => "cusip", "check cusip", "cusip check";
|
|||
|
||||
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;
|
||||
|
||||
handle remainder => sub {
|
||||
|
||||
# strip beginning and end whitespace from remainder
|
||||
# strip beginning and end whitespace from remainder
|
||||
s/^\s+|\s+$//g;
|
||||
|
||||
|
||||
# capitalize all letters in the CUSIP
|
||||
$_ = 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 #
|
||||
return if not m/^[A-Z0-9\*\@\#]{$CUSIPLENGTH}$/;
|
||||
|
||||
my $cusip = Business::CUSIP->new($_);
|
||||
my ($output, $htmlOutput);
|
||||
|
||||
|
||||
if ($cusip->is_valid) {
|
||||
$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>";
|
||||
|
|
|
@ -42,13 +42,13 @@ handle query_lc => sub {
|
|||
my $number = $action eq '-' ? 0 - $input_number : $input_number;
|
||||
|
||||
$unit =~ s/s$//g;
|
||||
|
||||
|
||||
my ($years, $months, $days, $weeks) = (0, 0, 0, 0);
|
||||
$years = $number if $unit eq "year";
|
||||
$months = $number if $unit eq "month";
|
||||
$days = $number if $unit eq "day";
|
||||
$days = 7*$number if $unit eq "week";
|
||||
|
||||
|
||||
my $dur = DateTime::Duration->new(
|
||||
years => $years,
|
||||
months => $months,
|
||||
|
|
|
@ -22,12 +22,12 @@ my $datestring_regex = datestring_regex();
|
|||
|
||||
handle remainder => sub {
|
||||
return unless $_ =~ qr/^($datestring_regex) (?:(?:and|to) )?($datestring_regex)(?:[,]? inclusive)?$/i;
|
||||
|
||||
|
||||
my ($date1, $date2) = parse_all_datestrings_to_date($1, $2);
|
||||
return unless ($date1 && $date2);
|
||||
|
||||
|
||||
($date1, $date2) = ($date2, $date1) if ( DateTime->compare($date1, $date2) == 1 );
|
||||
|
||||
|
||||
my $difference = $date1->delta_days($date2);
|
||||
my $daysBetween = abs($difference->in_units('days'));
|
||||
my $inclusive = '';
|
||||
|
|
|
@ -69,7 +69,7 @@ my %desserts = (
|
|||
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'],
|
||||
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'],
|
||||
);
|
||||
|
||||
|
|
|
@ -57,8 +57,8 @@ handle remainder => sub {
|
|||
return if lc($word) eq 'system'; # don't respond to "dewey decimal system"
|
||||
my @results = grep(/$word/i, keys %types);
|
||||
return unless @results;
|
||||
if (@results > 1) {
|
||||
$out_html .= "<tr>".line($types{$_})."</tr>" for @results;
|
||||
if (@results > 1) {
|
||||
$out_html .= "<tr>".line($types{$_})."</tr>" for @results;
|
||||
$multi = 1;
|
||||
} else {
|
||||
my $num = $types{$results[0]};
|
||||
|
@ -71,7 +71,7 @@ handle remainder => sub {
|
|||
else {
|
||||
$_ = sprintf "%03d", $_;
|
||||
|
||||
unless ($multi) {
|
||||
unless ($multi) {
|
||||
$out .= single_format $_, lc((get_info($_) or return));
|
||||
$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">$1<\/a>/g;
|
||||
$out =~ s/\[\[.+?\|(.+?)\]\]/$1/g;
|
||||
|
|
|
@ -29,7 +29,7 @@ my %utf8_dice = (
|
|||
6 => "\x{2685}",
|
||||
);
|
||||
|
||||
# roll_dice generate pseudo random roll
|
||||
# roll_dice generate pseudo random roll
|
||||
# param $_[0] number of faces
|
||||
# return roll
|
||||
sub roll_die {
|
||||
|
@ -79,11 +79,11 @@ handle remainder_lc => sub {
|
|||
my @values = split(' and ', $_);
|
||||
my $values = @values; # size of @values;
|
||||
my $out = '';
|
||||
my $html = '';
|
||||
my $html = '';
|
||||
my $heading = "Random Dice Roll";
|
||||
my $total; # total of all dice rolls
|
||||
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'
|
||||
my @output;
|
||||
my $sum = 0;
|
||||
|
@ -99,7 +99,7 @@ handle remainder_lc => sub {
|
|||
$html .= '<span class="zci--dice-die">' . join(' ', @output).'</span>'
|
||||
.'<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'
|
||||
# 'w' is the German form of 'd'
|
||||
my (@rolls, $output);
|
||||
|
@ -148,7 +148,7 @@ handle remainder_lc => sub {
|
|||
$out .= 'Total: ' . $total;
|
||||
$html .= 'Total: ' . $total;
|
||||
}
|
||||
$out =~ s/<br\/>$//g; # remove trailing newline
|
||||
$out =~ s/<br\/>$//g; # remove trailing newline
|
||||
if($out eq ''){
|
||||
return; # nothing to return
|
||||
}else{
|
||||
|
|
|
@ -39,7 +39,7 @@ handle remainder => sub {
|
|||
);
|
||||
|
||||
# Danger: address returns possible modified string!
|
||||
my $result = $email_valid->address($address);
|
||||
my $result = $email_valid->address($address);
|
||||
|
||||
if (!$result) {
|
||||
my $message = '';
|
||||
|
|
|
@ -19,7 +19,7 @@ category 'calculations';
|
|||
attribution github => [ 'https://github.com/austinheimark', 'austin_heimark' ];
|
||||
|
||||
handle remainder => sub {
|
||||
return unless /^\d+$/;
|
||||
return unless /^\d+$/;
|
||||
my @factors = divisors($_);
|
||||
return "Factors of $_: @factors";
|
||||
};
|
||||
|
|
|
@ -33,7 +33,7 @@ triggers query_nowhitespace_nodash => qr/
|
|||
|
||||
# Fedex package tracking.
|
||||
#
|
||||
# For detailed specification:
|
||||
# For detailed specification:
|
||||
# http://images.fedex.com/us/solutions/ppe/FedEx_Ground_Label_Layout_Specification.pdf
|
||||
#
|
||||
# For brief description see:
|
||||
|
|
|
@ -31,13 +31,13 @@ handle remainder => sub {
|
|||
{
|
||||
if ($_ =~ /[a-z]/)
|
||||
{
|
||||
if ($collect =~ /all|letters|characters|chars/) { ++$freq{$_}; }
|
||||
if ($collect =~ /all|letters|characters|chars/) { ++$freq{$_}; }
|
||||
else { ++$freq{$_} if $_ eq $collect; }
|
||||
|
||||
++$count;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
my @out;
|
||||
foreach my $key (keys %freq)
|
||||
{
|
||||
|
|
|
@ -58,7 +58,7 @@ my $color_ranges =
|
|||
];
|
||||
|
||||
# reference: https://en.wikipedia.org/wiki/Musical_acoustics
|
||||
#Ranges for common instruments
|
||||
#Ranges for common instruments
|
||||
my $instrument_ranges =
|
||||
[
|
||||
[ "87", "1046", "human voice" ],
|
||||
|
@ -86,19 +86,19 @@ my $instrument_ranges =
|
|||
];
|
||||
|
||||
# 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." ],
|
||||
];
|
||||
|
||||
# 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. "],
|
||||
];
|
||||
|
||||
# Reference:
|
||||
my $gamma_ranges =
|
||||
# Reference:
|
||||
my $gamma_ranges =
|
||||
[
|
||||
[ 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 $hz_abbrev;
|
||||
my $freq_formatted;
|
||||
|
||||
|
||||
if($freq =~ m/^(.+?)\s(?:hz|hertz)$/i) {
|
||||
$freq_hz = $1;
|
||||
} elsif($freq =~ m/^(.+?)\s(?:khz|kilohertz)$/i) {
|
||||
|
@ -127,7 +127,7 @@ handle query => sub {
|
|||
#unexpected case
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if($freq_hz >= TRILLION){
|
||||
$hz_abbrev = "THz";
|
||||
$freq_formatted = $freq_hz / TRILLION;
|
||||
|
@ -144,9 +144,9 @@ handle query => sub {
|
|||
$hz_abbrev = "Hz";
|
||||
$freq_formatted = $freq_hz;
|
||||
}
|
||||
|
||||
|
||||
$freq = $freq_formatted . " " . $hz_abbrev;
|
||||
|
||||
|
||||
return prepare_result($freq, $freq_hz);
|
||||
};
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ package DDG::Goodie::GenerateMAC;
|
|||
|
||||
use DDG::Goodie;
|
||||
|
||||
triggers startend => "generate mac addr",
|
||||
"generate mac address",
|
||||
triggers startend => "generate mac addr",
|
||||
"generate mac address",
|
||||
"random mac addr",
|
||||
"random mac address",
|
||||
"mac address generator",
|
||||
|
|
|
@ -29,7 +29,7 @@ triggers startend => (
|
|||
attribution github => ["elebow", "Eddie Lebow"];
|
||||
|
||||
handle remainder => sub {
|
||||
return
|
||||
return
|
||||
heading => "GIMP Shortcut Cheat Sheet",
|
||||
html => html_cheat_sheet(),
|
||||
answer => text_cheat_sheet(),
|
||||
|
|
|
@ -22,7 +22,7 @@ attribution twitter => 'crazedpsyc',
|
|||
handle remainder => sub {
|
||||
my $input = $_;
|
||||
my $golden_ratio = (1 + sqrt(5)) / 2;
|
||||
my $result = 0;
|
||||
my $result = 0;
|
||||
|
||||
if ($input =~ /^(?:(?:(\?)\s*:\s*(\d+(?:\.\d+)?))|(?:(\d+(?:\.\d+)?)\s*:\s*(\?)))$/) {
|
||||
if ($1 && $1 eq "?") {
|
||||
|
@ -30,10 +30,10 @@ handle remainder => sub {
|
|||
$result = $2 / $golden_ratio;
|
||||
return "Golden ratio: $result : $2";
|
||||
} elsif ($4 && $4 eq "?") {
|
||||
# x : ?
|
||||
$result = $3 * $golden_ratio;
|
||||
# x : ?
|
||||
$result = $3 * $golden_ratio;
|
||||
return "Golden ratio: $3 : $result";
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
};
|
||||
|
|
|
@ -20,14 +20,14 @@ handle remainder => sub {
|
|||
sub gcf {
|
||||
my ($x, $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 $link = qq(More at <a href="https://en.wikipedia.org/wiki/Greatest_common_factor">Wikipedia</a>.);
|
||||
|
||||
|
||||
return $result, 'html' => "$result $link" if $result;
|
||||
return;
|
||||
return;
|
||||
};
|
||||
|
||||
1;
|
||||
|
|
|
@ -1,65 +1,65 @@
|
|||
package DDG::Goodie::HTMLEntitiesDecode;
|
||||
# ABSTRACT: Decode HTML Entities.
|
||||
# HTML Entity Encoding has been moved to a separate module
|
||||
|
||||
use DDG::Goodie;
|
||||
use HTML::Entities 'decode_entities';
|
||||
use Unicode::UCD 'charinfo';
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
zci answer_type => 'html_entity';
|
||||
zci is_cached => 1;
|
||||
triggers any => 'html', 'entity', 'htmldecode', 'decodehtml', 'htmlentity';
|
||||
primary_example_queries 'html decode !', 'html decode &';
|
||||
secondary_example_queries 'html entity !' , '#36 decode html', 'what is the decoded html entity of $';
|
||||
description 'Decode HTML entities';
|
||||
name 'HTMLEntitiesDecode';
|
||||
code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/HTMLEntitiesDecode.pm';
|
||||
category 'computing_tools';
|
||||
topics 'programming';
|
||||
attribution twitter => 'crazedpsyc',
|
||||
cpan => 'CRZEDPSYC' ,
|
||||
twitter => ['https://twitter.com/nshanmugham', 'Nishanth Shanmugham'],
|
||||
web => ['http://nishanths.github.io', 'Nishanth Shanmugham'],
|
||||
github => ['https://github.com/nishanths', 'Nishanth Shanmugham'];
|
||||
|
||||
handle remainder => sub {
|
||||
$_ =~ s/^\s+|\s+$//g; # remove front and back whitespace
|
||||
$_ =~ s/(\bwhat\s*is\s*(the)?)//ig; # remove "what is the" (optional: the)
|
||||
$_ =~ s/\b(the|for|of|is|entity|decode|decoded|code|character)\b//ig; # remove filler words
|
||||
$_ =~ s/^\s+|\s+$//g; # remove front and back whitespace that existed in between that may show up after removing the filler words
|
||||
$_ =~ s/\s*\?$//g; # remove ending question mark
|
||||
return unless ((/^(&?#(?:[0-9]+(?!_))+;?)$/) || (/^(&(?:[a-zA-Z]+(?!_))+;?)$/) || (/^(&?#[xX](?:[0-9A-Fa-f]+(?!_))+;?)$/)); # decimal (') || text with no underscores (¢) || hex (')
|
||||
# "&" optional for all
|
||||
# ";" optional except in text type
|
||||
# "?" optional: question-like queries
|
||||
|
||||
# Standardize the query so it works well with library decoding functions
|
||||
my $entity = $1;
|
||||
$entity =~ s/^&?/&/; # append '&' at the front
|
||||
$entity =~ s/;?$/;/; # append ';' at the back
|
||||
|
||||
# Attempt to decode, exit if unsuccessful
|
||||
my $decoded = decode_entities($entity); # decode_entities() returns the input if unsuccesful
|
||||
my $decimal = ord($decoded);
|
||||
my $hex = sprintf("%04x", $decimal);
|
||||
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
|
||||
my $info = charinfo($decimal); # charinfo() returns undef if input is not a "real" character
|
||||
return unless (defined $info); # another safety net
|
||||
if ($$info{name} eq '<control>') {
|
||||
$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)";
|
||||
} elsif(substr($$info{category},0,1) eq 'C') {
|
||||
$decoded = "Special character (no visual representation)";
|
||||
$entity = "<a href='https://en.wikipedia.org/wiki/Special_characters'>Special character (no visual representation)";
|
||||
}
|
||||
|
||||
# Make answer
|
||||
return "Decoded HTML Entity: $decoded, Decimal: $decimal, Hexadecimal: $hex",
|
||||
html => qq(<div class="zci--htmlentitiesdecode"><div class="large"><span class="text--secondary">Decoded HTML Entity: </span><span class="text--primary">$entity</span></div><div class="small"><span class="text--secondary">Decimal: <span class="text--primary">$decimal</span>, Hexadecimal: <span class="text--primary">$hex</span></div></div></div>);
|
||||
};
|
||||
|
||||
1;
|
||||
package DDG::Goodie::HTMLEntitiesDecode;
|
||||
# ABSTRACT: Decode HTML Entities.
|
||||
# HTML Entity Encoding has been moved to a separate module
|
||||
|
||||
use DDG::Goodie;
|
||||
use HTML::Entities 'decode_entities';
|
||||
use Unicode::UCD 'charinfo';
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
zci answer_type => 'html_entity';
|
||||
zci is_cached => 1;
|
||||
triggers any => 'html', 'entity', 'htmldecode', 'decodehtml', 'htmlentity';
|
||||
primary_example_queries 'html decode !', 'html decode &';
|
||||
secondary_example_queries 'html entity !' , '#36 decode html', 'what is the decoded html entity of $';
|
||||
description 'Decode HTML entities';
|
||||
name 'HTMLEntitiesDecode';
|
||||
code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/HTMLEntitiesDecode.pm';
|
||||
category 'computing_tools';
|
||||
topics 'programming';
|
||||
attribution twitter => 'crazedpsyc',
|
||||
cpan => 'CRZEDPSYC' ,
|
||||
twitter => ['https://twitter.com/nshanmugham', 'Nishanth Shanmugham'],
|
||||
web => ['http://nishanths.github.io', 'Nishanth Shanmugham'],
|
||||
github => ['https://github.com/nishanths', 'Nishanth Shanmugham'];
|
||||
|
||||
handle remainder => sub {
|
||||
$_ =~ s/^\s+|\s+$//g; # remove front and back whitespace
|
||||
$_ =~ s/(\bwhat\s*is\s*(the)?)//ig; # remove "what is the" (optional: the)
|
||||
$_ =~ s/\b(the|for|of|is|entity|decode|decoded|code|character)\b//ig; # remove filler words
|
||||
$_ =~ s/^\s+|\s+$//g; # remove front and back whitespace that existed in between that may show up after removing the filler words
|
||||
$_ =~ s/\s*\?$//g; # remove ending question mark
|
||||
return unless ((/^(&?#(?:[0-9]+(?!_))+;?)$/) || (/^(&(?:[a-zA-Z]+(?!_))+;?)$/) || (/^(&?#[xX](?:[0-9A-Fa-f]+(?!_))+;?)$/)); # decimal (') || text with no underscores (¢) || hex (')
|
||||
# "&" optional for all
|
||||
# ";" optional except in text type
|
||||
# "?" optional: question-like queries
|
||||
|
||||
# Standardize the query so it works well with library decoding functions
|
||||
my $entity = $1;
|
||||
$entity =~ s/^&?/&/; # append '&' at the front
|
||||
$entity =~ s/;?$/;/; # append ';' at the back
|
||||
|
||||
# Attempt to decode, exit if unsuccessful
|
||||
my $decoded = decode_entities($entity); # decode_entities() returns the input if unsuccesful
|
||||
my $decimal = ord($decoded);
|
||||
my $hex = sprintf("%04x", $decimal);
|
||||
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
|
||||
my $info = charinfo($decimal); # charinfo() returns undef if input is not a "real" character
|
||||
return unless (defined $info); # another safety net
|
||||
if ($$info{name} eq '<control>') {
|
||||
$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)";
|
||||
} elsif(substr($$info{category},0,1) eq 'C') {
|
||||
$decoded = "Special character (no visual representation)";
|
||||
$entity = "<a href='https://en.wikipedia.org/wiki/Special_characters'>Special character (no visual representation)";
|
||||
}
|
||||
|
||||
# Make answer
|
||||
return "Decoded HTML Entity: $decoded, Decimal: $decimal, Hexadecimal: $hex",
|
||||
html => qq(<div class="zci--htmlentitiesdecode"><div class="large"><span class="text--secondary">Decoded HTML Entity: </span><span class="text--primary">$entity</span></div><div class="small"><span class="text--secondary">Decimal: <span class="text--primary">$decimal</span>, Hexadecimal: <span class="text--primary">$hex</span></div></div></div>);
|
||||
};
|
||||
|
||||
1;
|
||||
|
|
|
@ -1,319 +1,319 @@
|
|||
package DDG::Goodie::HTMLEntitiesEncode;
|
||||
# ABSTRACT: Displays the HTML entity code for the query name.
|
||||
|
||||
use DDG::Goodie;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
# '&' and ';' not included in the hash value -- they are added in make_text() and make_html()
|
||||
my %codes = (
|
||||
# Punctuation
|
||||
'en dash' => [['En dash', 'ndash']],
|
||||
'em dash' => [['Em dash', 'mdash']],
|
||||
'hyphen' => [['Hyphen', '#8208']],
|
||||
'soft hyphen' => [['Soft hyphen', '#173']],
|
||||
|
||||
'inverted question mark' => [['Inverted question mark', 'iquest']],
|
||||
'inverted exclamation' => [['Inverted exclamation', 'iexcl']],
|
||||
'inverted exclamation point' => [['Inverted exclamation', 'iexcl']],
|
||||
'inverted exclamation mark' => [['Inverted exclamation', 'iexcl']],
|
||||
'backward semicolon' => [['Backward semicolon','#8271']],
|
||||
|
||||
'quotation mark' => [['Double quotation mark', 'quot']],
|
||||
'double quote' => [['Double quotation mark', 'quot']],
|
||||
'left double quote' => [['Left double curly quote','ldquo']],
|
||||
'left double curly quote' => [['Left double curly quote','ldquo']],
|
||||
'right double quote' => [['Right double curly quote','rdquo']],
|
||||
'right double curly quote' => [['Right double curly quote','rdquo']],
|
||||
'double curly quote' => [['Left double curly quote','ldquo'],['Right double curly quote','rdquo']],
|
||||
|
||||
'apostrophe' => [['Apostrophe','#39']],
|
||||
'single quote' => [['Single quote','#39']],
|
||||
'left single quote' => [['Left single curly quote','lsquo']],
|
||||
'left single curly quote' => [['Left single curly quote','lsquo']],
|
||||
'right single quote' => [['Right single curly quote','rsquo']],
|
||||
'right single curly quote' => [['Right single curly quote','rsquo']],
|
||||
'single curly quote' => [['Left single curly quote','lsquo'],['Right single curly quote','rsquo']],
|
||||
|
||||
'angle quote' => [['Single left pointing angle quote', 'lsaquo'],['Single right pointing angle quote', 'rsaquo'],['Double left pointing angle quote','laquo'],['Double right pointing angle quote','raquo']],
|
||||
'angle bracket' => [['Single left pointing angle quote', 'lsaquo'],['Single right pointing angle quote', 'rsaquo'],['Double left pointing angle quote','laquo'],['Double right pointing angle quote','raquo']],
|
||||
'guillemets' => [['Single left pointing angle quote', 'lsaquo'],['Single right pointing angle quote', 'rsaquo'],['Double left pointing angle quote','laquo'],['Double right pointing angle quote','raquo']],
|
||||
|
||||
'left angle quote' => [['Single left pointing angle quote', 'lsaquo'],['Double left pointing angle quote','laquo']],
|
||||
'left angle bracket' => [['Single left pointing angle quote', 'lsaquo'],['Double left pointing angle quote','laquo']],
|
||||
'right angle quote' => [['Single right pointing angle quote', 'rsaquo'],['Double right pointing angle quote','raquo']],
|
||||
'right angle bracket' => [['Single right pointing angle quote', 'rsaquo'],['Double right pointing angle quote','raquo']],
|
||||
|
||||
'space' => [['Non-breaking space','nbsp']],
|
||||
'invisible comma' => [['Invisible comma','#8291']],
|
||||
|
||||
# Symbols
|
||||
'ampersand' => [['Ampersand','amp']],
|
||||
'copyright' => [['Copyright', '#169']],
|
||||
'recording copyright' => [['Recording copyright','#8471']],
|
||||
'registered' => [['Registered trademark', '#174']],
|
||||
'registered trademark' => [['Registered', '#174']],
|
||||
'trademark' => [['Trademark','#8482']],
|
||||
'rx' => [['Prescription sign','#8478']],
|
||||
'prescription' => [['Prescription sign','#8478']],
|
||||
'numero' => [['Numero sign', '#8470']],
|
||||
'hash' => [['Number sign','#35']], # same as number sign (below)
|
||||
'number' => [['Number sign','#35']], # same as hash (above)
|
||||
'forward slash' => [['Forward slash','#47']],
|
||||
'slash' => [['Forward slash','#47']],
|
||||
'backslash' => [['Backslash','#92']],
|
||||
'back slash' => [['Backslash','#92']],
|
||||
'hat' => [['Hat', '#94']], # x-post with caret
|
||||
'broken vertical bar' => [['Broken vertical bar','brvbar']],
|
||||
'pipe' => [['Pipe', '#8214']],
|
||||
'pipes' => [['Pipe', '#8214']],
|
||||
'dagger' => [['Dagger','dagger']],
|
||||
'bullet' => [['Bullet','#8226']],
|
||||
|
||||
# Special/misc.
|
||||
'macron' => [['Macron', '#175']],
|
||||
'diaeresis' => [['Diaeresis','#168']],
|
||||
'female' => [['Female sign', '#9792']],
|
||||
'male' => [['Male sign','#9794']],
|
||||
'phone' => [['Phone sign','#9742']],
|
||||
'checkmark' => [['Checkmark','#10003']],
|
||||
'cross' => [['Cross (straight)', '#10799'],['Cross (slanted)','#10007']],
|
||||
'caret' => [['Caret','#8257'],['Hat', '#94']],
|
||||
|
||||
# Arrows
|
||||
'up arrow' => [['Up arrow','#8593']],
|
||||
'down arrow' => [['Down arrow','#8595']],
|
||||
'left arrow' => [['Left arrow','#8592']],
|
||||
'right arrow' => [['Right arrow', '#8594']],
|
||||
'up down arrow' => [['Up-down arrow', '#8597']],
|
||||
'left right arrow' => [['Left-right arrow', '#8596']],
|
||||
'double sided arrow' => [['Up-down arrow', '#8597'],['Left-right arrow', '#8596']],
|
||||
'two sided arrow' => [['Up-down arrow', '#8597'],['Left-right arrow', '#8596']],
|
||||
|
||||
# Currency
|
||||
'cent' => [['Cent','cent']],
|
||||
'dollar' => [['Dollar','#36']],
|
||||
'us dollar' => [['Dollar','#36']],
|
||||
'peso' => [['Peso','#36']],
|
||||
'yen' => [['Yen', 'yen']],
|
||||
'japanese yen' => [['Yen', 'yen']],
|
||||
'euro' => [['Euro','euro']],
|
||||
'currency' => [['Currency sign','curren']],
|
||||
'british pound' => [['British Pound Sterling','pound']],
|
||||
'british pound sterling' => [['British Pound Sterling','pound']],
|
||||
'pound' => [['British Pound Sterling','pound'],['Number sign','#35']], # x-post with number sign, hash
|
||||
|
||||
# Math
|
||||
'divide' => [['Divide','#247']],
|
||||
'division' => [['Divide','#247']],
|
||||
'greater than' => [['Greater than','gt']],
|
||||
'less than' => [['Less than','lt']],
|
||||
'greater than or equal to' => [['Greater than or equal to','#8805']],
|
||||
'less than or equal to' => [['Less than or equal to','#8804']],
|
||||
'nested greater than' => [['Nested greater than','#8811']],
|
||||
'nested less than' => [['Nested less than','#8810']],
|
||||
'plus minus' => [['Plus/minus','#177']],
|
||||
'plus/minus' => [['Plus/minus','#177']],
|
||||
'+-' => => [['Plus/minus','#177']],
|
||||
'percent' => [['Percent sign','#37']],
|
||||
'percentage' => [['Percent sign','#37']],
|
||||
'per mil' => [['Per mil','permil']],
|
||||
'per mille' => [['Per mil','permil']],
|
||||
'per ten thousand' => [['Per ten thousand','#8241']],
|
||||
'degree' => [['Degree sign','#176']],
|
||||
'perpendicular' => [['Perpendicular', '#8869']],
|
||||
'parallel' => [['Parallel', '#8741']],
|
||||
'non parallel' => [['Non parallel', '#8742']],
|
||||
'integral' => [['Integral','#8747']],
|
||||
'double integral' => [['Double integral','#8748']],
|
||||
'triple integral' => [['Triple integral','#8749']],
|
||||
'path integral' => [['Path integral','#8750']], # same as path integral (below)
|
||||
'contour integral' => [['Contour integral','#8750']], # same as contour integral (above)
|
||||
'therefore' => [['Therefore (mathematics)','#8756']],
|
||||
'infinity' => [['Infinity','infin']],
|
||||
'radical' => [['Radical sign','#8730']],
|
||||
'square root' => [['Square root','#8730']],
|
||||
'not equal' => [['Not equal','#8800']],
|
||||
'equivalent' => [['Equivalent','#8801']], # same entity as congruent (below)
|
||||
'congruent' => [['Congruent','#8801']], # same entity as equivalent (above)
|
||||
'not equivalent' => [['Not equivalent','#8802']],
|
||||
'not congruent' => [['Not congruent','#8802']],
|
||||
'sum' => [['Summation (mathematics)','#8721']],
|
||||
'summation' => [['Summation (mathematics)','#8721']],
|
||||
'pi' => [['Pi','#960']],
|
||||
'reals' => [['Reals (mathematics)','#8477']],
|
||||
'complexes' => [['Complexes','#8450']],
|
||||
'imaginary' => [['Imaginary (mathematics)','#8520']],
|
||||
|
||||
# Scientific
|
||||
'micro' => [['Micro', '#181']],
|
||||
'ohm' => [['Ohm','#8486']],
|
||||
'mho' => [['Mho','#8487']],
|
||||
|
||||
# Typography
|
||||
'middle dot' => [['Middle dot', 'middot']],
|
||||
'pilcrow' => [['Pilcrow', '#182']],
|
||||
'paragraph' => [['Paragraph sign', '#182']],
|
||||
'section' => [['Section', '#167']],
|
||||
'section s' => [['Section', '#167']],
|
||||
'ellipsis' => [['Horizontal ellipsis','#8230']],
|
||||
'horizontal ellipsis' => [['Horizontal ellipsis','#8230']],
|
||||
|
||||
# Accents -- also see the hash %accented_chars
|
||||
'grave' => [['Grave accent','#96']],
|
||||
'grave accent' => [['Grave accent','#96']],
|
||||
'acute' => [['Acute accent','#180']],
|
||||
'acute accent' => [['Acute accent','#180']],
|
||||
|
||||
# Greek
|
||||
'alpha' => [['Alpha capital','Alpha'],['Alpha small','alpha']],
|
||||
'beta' => [['Beta capital','Beta'],['Beta small','beta']],
|
||||
'gamma' => [['Gamma capital','Gamma'],['Gamma small','gamma']],
|
||||
'phi' => [['Phi capital','Phi'],['Phi small','phi']],
|
||||
'omega' => [['Omega capital','Omega'],['Omega small','omega']],
|
||||
'kappa' => [['Kappa capital','Kappa'],['Kappa small','kappa']],
|
||||
'delta' => [['Delta capital','Delta'],['Delta small','delta']], # also displays a HTML Color Codes Goodie answer - Issue #490
|
||||
|
||||
# Shapes
|
||||
'trapezium' => [['Trapezium', '#9186']],
|
||||
'parallelogram' => [['Parallelogram', '#9649']],
|
||||
'spade' => [['Spade (suit)','#9824']],
|
||||
'club' => [['Club (suit)','#9827']],
|
||||
'heart' => [['Heart (suit)','#9829']],
|
||||
'diamond' => [['Diamond (suit)','#9830']],
|
||||
);
|
||||
|
||||
my %accented_chars = (
|
||||
'agrave' => [['a-grave','agrave']],
|
||||
'Agrave' => [['A-grave','Agrave']],
|
||||
'egrave' => [['e-grave','egrave']],
|
||||
'Egrave' => [['E-grave','Egrave']],
|
||||
'igrave' => [['i-grave','igrave']],
|
||||
'Igrave' => [['I-grave','Igrave']],
|
||||
'ograve' => [['o-grave','ograve']],
|
||||
'Ograve' => [['O-grave','Ograve']],
|
||||
'ugrave' => [['u-grave','ugrave']],
|
||||
'Ugrave' => [['U-grave','Ugrave']],
|
||||
|
||||
'aacute' => [['a-acute','aacute']],
|
||||
'Aacute' => [['A-acute','Aacute']],
|
||||
'eacute' => [['e-acute','eacute']],
|
||||
'Eacute' => [['E-acute','Eacute']],
|
||||
'iacute' => [['i-acute','iacute']],
|
||||
'Iacute' => [['I-acute','Iacute']],
|
||||
'oacute' => [['o-acute','oacute']],
|
||||
'Oacute' => [['O-acute','Oacute']],
|
||||
'uacute' => [['u-acute','uacute']],
|
||||
'Uacute' => [['U-acute','Uacute']],
|
||||
);
|
||||
|
||||
sub make_text {
|
||||
# Returns a text string of the form: "Encoded HTML Entity: <<entity>>"
|
||||
my $text = "";
|
||||
foreach my $i (0 .. scalar(@{$_[0]}) - 1) {
|
||||
$text = $i ? ("$text" . "\n" . "Encoded HTML Entity: &$_[0][$i][1];") : ("$text" . "Encoded HTML Entity: &$_[0][$i][1];"); # No \n in the first line of the answer
|
||||
}
|
||||
return $text;
|
||||
};
|
||||
|
||||
sub make_html {
|
||||
# Returns a html formatted string with css class names (no inline styles)
|
||||
my $html;
|
||||
if (scalar(@{$_[0]}) == 1) { # single line answer
|
||||
$html = qq(<div class="zci--htmlentitiesencode"><span class="text--secondary">Encoded HTML Entity (&$_[0][0][1];): </span><span class="text--primary">&<span>$_[0][0][1]</span>;</span></div>) ; # link in the same line for single line answers
|
||||
} else {
|
||||
$html = qq(<div class="zci--htmlentitiesencode">);
|
||||
foreach my $i (0 .. scalar(@{$_[0]}) - 1) { # multiple line answer
|
||||
$html = $html . qq(<div><span class="text--secondary">$_[0][$i][0] (&$_[0][$i][1];): </span><span class="text--primary">&<span>$_[0][$i][1]</span>;</span></div>);
|
||||
}
|
||||
$html = $html . "</div>";
|
||||
}
|
||||
return $html;
|
||||
};
|
||||
|
||||
triggers any => 'html', 'entity', 'htmlencode','encodehtml','htmlescape','escapehtml', 'htmlentity';
|
||||
|
||||
primary_example_queries 'html em dash', 'html entity A-acute', 'html escape &';
|
||||
secondary_example_queries 'html code em-dash', 'html entity for E grave', '$ sign htmlentity', 'pound sign html encode', 'html character code for trademark symbol',
|
||||
'what is the html entity for greater than sign', 'how to encode an apostrophe in html';
|
||||
|
||||
name 'HTMLEntitiesEncode';
|
||||
description 'Displays the HTML entity code for the query name';
|
||||
category 'cheat_sheets';
|
||||
topics 'programming', 'web_design';
|
||||
code_url 'https://github.com/duckduckgo/zeroclickinfo-spice/blob/master/lib/DDG/Goodie/HTMLEntitiesEncode.pm';
|
||||
zci answer_type => 'html_entity';
|
||||
zci is_cached => 1;
|
||||
|
||||
attribution web => ["http://nishanths.github.io", "Nishanth Shanmugham"],
|
||||
github => ["https://github.com/nishanths", "Nishanth Shanmugham"],
|
||||
twitter => ["https://twitter.com/nshanmugham", "Nishanth Shanmugham"],
|
||||
twitter => 'crazedpsyc',
|
||||
cpan => 'CRZEDPSYC' ;
|
||||
|
||||
handle remainder => sub {
|
||||
# General query cleanup
|
||||
$_ =~ s/^\s+|\s+$//g; # remove front and back whitespace
|
||||
$_ =~ s/(\bwhat\s*is\s*(the)?)//ig; # remove "what is the" (optional: the)
|
||||
$_ =~ s/(\bhow\s*do\s*(i|you|we))//ig; # remove "how do i|you|we"
|
||||
$_ =~ s/(\bhow\s*to)//ig; # remove "how to"
|
||||
$_ =~ s/\b(an|the|for|of|in|is|sign|symbol|character|code|encode|encoded|entity|escape|put|embed|get|insert|display|my|(a(?![\s\-*](grave|acute))))\b//ig; # remove filler words (the word boundary anchors ensure 'for' is not removed from "formula")
|
||||
$_ =~ s/^\s+|\s+$//g; # remove front and back whitespace that existed in between that may now show up after removing the words above
|
||||
|
||||
# Hash-specific query cleanup for better hits
|
||||
my $hashes_query = $_;
|
||||
$hashes_query =~ s/\-+/ /g; # change '-' to ' '
|
||||
$hashes_query =~ s/"|'//g; # remove double and single quotes
|
||||
$hashes_query =~ s/\s*\?$//g; # remove ending question mark
|
||||
# Hashes lookup
|
||||
if ($hashes_query) {
|
||||
my $key;
|
||||
my $value;
|
||||
# Query is for accented character
|
||||
if ($hashes_query =~ /^([a-zA-Z])\s*(grave|acute)$/i) {
|
||||
$hashes_query = $1 . lc $2; # $1's capitalization matters for accented characters lookup, lc $2 allows for more freedom in queries
|
||||
$key = $hashes_query;
|
||||
$value = $accented_chars{$key};
|
||||
# Not an accented character -- lookup the $codes hash instead
|
||||
} else {
|
||||
$key = lc $hashes_query;
|
||||
$value = $codes{$key};
|
||||
}
|
||||
# Try again after substitutions if there is no hit
|
||||
unless (defined $value) {
|
||||
$key =~ s/brackets/bracket/g;
|
||||
$key =~ s/quotes/quote/g;
|
||||
$value = $codes{$key};
|
||||
}
|
||||
# Make final answer
|
||||
if (defined $value) {
|
||||
my $text = make_text($value);
|
||||
my $html = make_html($value);
|
||||
return $text, html => $html;
|
||||
}
|
||||
}
|
||||
|
||||
# Query maybe a single typed-in character to encode
|
||||
# No hits above if we got this far, use html_enc()
|
||||
if ( (/^(?:")(?<char>.)(?:")\s*\??$/) # a (captured) single character within double quotes
|
||||
|| (/^(?:'')(?<char>.)(?:'')\s*\??$/) # or within single quotes
|
||||
|| (/^(?<char>.)\s*\??$/)) { # or stand-alone
|
||||
my $entity = html_enc($+{char});
|
||||
if ($entity eq $+{char}) { # html_enc() was unsuccessful and returned the input itself
|
||||
$entity = ord($+{char}); # get the decimal
|
||||
$entity = '#' . $entity; # dress it up like a decimal
|
||||
}
|
||||
# Remove '&' and ';' from the output of html_enc(), these will be added in html
|
||||
$entity =~ s/^&//g;
|
||||
$entity =~ s/;$//g;
|
||||
# Make final answer
|
||||
my $answer = [[$_, $entity]];
|
||||
my $text = make_text($answer);
|
||||
my $html = make_html($answer);
|
||||
return $text, html => $html;
|
||||
}
|
||||
|
||||
return;
|
||||
};
|
||||
|
||||
1;
|
||||
package DDG::Goodie::HTMLEntitiesEncode;
|
||||
# ABSTRACT: Displays the HTML entity code for the query name.
|
||||
|
||||
use DDG::Goodie;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
# '&' and ';' not included in the hash value -- they are added in make_text() and make_html()
|
||||
my %codes = (
|
||||
# Punctuation
|
||||
'en dash' => [['En dash', 'ndash']],
|
||||
'em dash' => [['Em dash', 'mdash']],
|
||||
'hyphen' => [['Hyphen', '#8208']],
|
||||
'soft hyphen' => [['Soft hyphen', '#173']],
|
||||
|
||||
'inverted question mark' => [['Inverted question mark', 'iquest']],
|
||||
'inverted exclamation' => [['Inverted exclamation', 'iexcl']],
|
||||
'inverted exclamation point' => [['Inverted exclamation', 'iexcl']],
|
||||
'inverted exclamation mark' => [['Inverted exclamation', 'iexcl']],
|
||||
'backward semicolon' => [['Backward semicolon','#8271']],
|
||||
|
||||
'quotation mark' => [['Double quotation mark', 'quot']],
|
||||
'double quote' => [['Double quotation mark', 'quot']],
|
||||
'left double quote' => [['Left double curly quote','ldquo']],
|
||||
'left double curly quote' => [['Left double curly quote','ldquo']],
|
||||
'right double quote' => [['Right double curly quote','rdquo']],
|
||||
'right double curly quote' => [['Right double curly quote','rdquo']],
|
||||
'double curly quote' => [['Left double curly quote','ldquo'],['Right double curly quote','rdquo']],
|
||||
|
||||
'apostrophe' => [['Apostrophe','#39']],
|
||||
'single quote' => [['Single quote','#39']],
|
||||
'left single quote' => [['Left single curly quote','lsquo']],
|
||||
'left single curly quote' => [['Left single curly quote','lsquo']],
|
||||
'right single quote' => [['Right single curly quote','rsquo']],
|
||||
'right single curly quote' => [['Right single curly quote','rsquo']],
|
||||
'single curly quote' => [['Left single curly quote','lsquo'],['Right single curly quote','rsquo']],
|
||||
|
||||
'angle quote' => [['Single left pointing angle quote', 'lsaquo'],['Single right pointing angle quote', 'rsaquo'],['Double left pointing angle quote','laquo'],['Double right pointing angle quote','raquo']],
|
||||
'angle bracket' => [['Single left pointing angle quote', 'lsaquo'],['Single right pointing angle quote', 'rsaquo'],['Double left pointing angle quote','laquo'],['Double right pointing angle quote','raquo']],
|
||||
'guillemets' => [['Single left pointing angle quote', 'lsaquo'],['Single right pointing angle quote', 'rsaquo'],['Double left pointing angle quote','laquo'],['Double right pointing angle quote','raquo']],
|
||||
|
||||
'left angle quote' => [['Single left pointing angle quote', 'lsaquo'],['Double left pointing angle quote','laquo']],
|
||||
'left angle bracket' => [['Single left pointing angle quote', 'lsaquo'],['Double left pointing angle quote','laquo']],
|
||||
'right angle quote' => [['Single right pointing angle quote', 'rsaquo'],['Double right pointing angle quote','raquo']],
|
||||
'right angle bracket' => [['Single right pointing angle quote', 'rsaquo'],['Double right pointing angle quote','raquo']],
|
||||
|
||||
'space' => [['Non-breaking space','nbsp']],
|
||||
'invisible comma' => [['Invisible comma','#8291']],
|
||||
|
||||
# Symbols
|
||||
'ampersand' => [['Ampersand','amp']],
|
||||
'copyright' => [['Copyright', '#169']],
|
||||
'recording copyright' => [['Recording copyright','#8471']],
|
||||
'registered' => [['Registered trademark', '#174']],
|
||||
'registered trademark' => [['Registered', '#174']],
|
||||
'trademark' => [['Trademark','#8482']],
|
||||
'rx' => [['Prescription sign','#8478']],
|
||||
'prescription' => [['Prescription sign','#8478']],
|
||||
'numero' => [['Numero sign', '#8470']],
|
||||
'hash' => [['Number sign','#35']], # same as number sign (below)
|
||||
'number' => [['Number sign','#35']], # same as hash (above)
|
||||
'forward slash' => [['Forward slash','#47']],
|
||||
'slash' => [['Forward slash','#47']],
|
||||
'backslash' => [['Backslash','#92']],
|
||||
'back slash' => [['Backslash','#92']],
|
||||
'hat' => [['Hat', '#94']], # x-post with caret
|
||||
'broken vertical bar' => [['Broken vertical bar','brvbar']],
|
||||
'pipe' => [['Pipe', '#8214']],
|
||||
'pipes' => [['Pipe', '#8214']],
|
||||
'dagger' => [['Dagger','dagger']],
|
||||
'bullet' => [['Bullet','#8226']],
|
||||
|
||||
# Special/misc.
|
||||
'macron' => [['Macron', '#175']],
|
||||
'diaeresis' => [['Diaeresis','#168']],
|
||||
'female' => [['Female sign', '#9792']],
|
||||
'male' => [['Male sign','#9794']],
|
||||
'phone' => [['Phone sign','#9742']],
|
||||
'checkmark' => [['Checkmark','#10003']],
|
||||
'cross' => [['Cross (straight)', '#10799'],['Cross (slanted)','#10007']],
|
||||
'caret' => [['Caret','#8257'],['Hat', '#94']],
|
||||
|
||||
# Arrows
|
||||
'up arrow' => [['Up arrow','#8593']],
|
||||
'down arrow' => [['Down arrow','#8595']],
|
||||
'left arrow' => [['Left arrow','#8592']],
|
||||
'right arrow' => [['Right arrow', '#8594']],
|
||||
'up down arrow' => [['Up-down arrow', '#8597']],
|
||||
'left right arrow' => [['Left-right arrow', '#8596']],
|
||||
'double sided arrow' => [['Up-down arrow', '#8597'],['Left-right arrow', '#8596']],
|
||||
'two sided arrow' => [['Up-down arrow', '#8597'],['Left-right arrow', '#8596']],
|
||||
|
||||
# Currency
|
||||
'cent' => [['Cent','cent']],
|
||||
'dollar' => [['Dollar','#36']],
|
||||
'us dollar' => [['Dollar','#36']],
|
||||
'peso' => [['Peso','#36']],
|
||||
'yen' => [['Yen', 'yen']],
|
||||
'japanese yen' => [['Yen', 'yen']],
|
||||
'euro' => [['Euro','euro']],
|
||||
'currency' => [['Currency sign','curren']],
|
||||
'british pound' => [['British Pound Sterling','pound']],
|
||||
'british pound sterling' => [['British Pound Sterling','pound']],
|
||||
'pound' => [['British Pound Sterling','pound'],['Number sign','#35']], # x-post with number sign, hash
|
||||
|
||||
# Math
|
||||
'divide' => [['Divide','#247']],
|
||||
'division' => [['Divide','#247']],
|
||||
'greater than' => [['Greater than','gt']],
|
||||
'less than' => [['Less than','lt']],
|
||||
'greater than or equal to' => [['Greater than or equal to','#8805']],
|
||||
'less than or equal to' => [['Less than or equal to','#8804']],
|
||||
'nested greater than' => [['Nested greater than','#8811']],
|
||||
'nested less than' => [['Nested less than','#8810']],
|
||||
'plus minus' => [['Plus/minus','#177']],
|
||||
'plus/minus' => [['Plus/minus','#177']],
|
||||
'+-' => => [['Plus/minus','#177']],
|
||||
'percent' => [['Percent sign','#37']],
|
||||
'percentage' => [['Percent sign','#37']],
|
||||
'per mil' => [['Per mil','permil']],
|
||||
'per mille' => [['Per mil','permil']],
|
||||
'per ten thousand' => [['Per ten thousand','#8241']],
|
||||
'degree' => [['Degree sign','#176']],
|
||||
'perpendicular' => [['Perpendicular', '#8869']],
|
||||
'parallel' => [['Parallel', '#8741']],
|
||||
'non parallel' => [['Non parallel', '#8742']],
|
||||
'integral' => [['Integral','#8747']],
|
||||
'double integral' => [['Double integral','#8748']],
|
||||
'triple integral' => [['Triple integral','#8749']],
|
||||
'path integral' => [['Path integral','#8750']], # same as path integral (below)
|
||||
'contour integral' => [['Contour integral','#8750']], # same as contour integral (above)
|
||||
'therefore' => [['Therefore (mathematics)','#8756']],
|
||||
'infinity' => [['Infinity','infin']],
|
||||
'radical' => [['Radical sign','#8730']],
|
||||
'square root' => [['Square root','#8730']],
|
||||
'not equal' => [['Not equal','#8800']],
|
||||
'equivalent' => [['Equivalent','#8801']], # same entity as congruent (below)
|
||||
'congruent' => [['Congruent','#8801']], # same entity as equivalent (above)
|
||||
'not equivalent' => [['Not equivalent','#8802']],
|
||||
'not congruent' => [['Not congruent','#8802']],
|
||||
'sum' => [['Summation (mathematics)','#8721']],
|
||||
'summation' => [['Summation (mathematics)','#8721']],
|
||||
'pi' => [['Pi','#960']],
|
||||
'reals' => [['Reals (mathematics)','#8477']],
|
||||
'complexes' => [['Complexes','#8450']],
|
||||
'imaginary' => [['Imaginary (mathematics)','#8520']],
|
||||
|
||||
# Scientific
|
||||
'micro' => [['Micro', '#181']],
|
||||
'ohm' => [['Ohm','#8486']],
|
||||
'mho' => [['Mho','#8487']],
|
||||
|
||||
# Typography
|
||||
'middle dot' => [['Middle dot', 'middot']],
|
||||
'pilcrow' => [['Pilcrow', '#182']],
|
||||
'paragraph' => [['Paragraph sign', '#182']],
|
||||
'section' => [['Section', '#167']],
|
||||
'section s' => [['Section', '#167']],
|
||||
'ellipsis' => [['Horizontal ellipsis','#8230']],
|
||||
'horizontal ellipsis' => [['Horizontal ellipsis','#8230']],
|
||||
|
||||
# Accents -- also see the hash %accented_chars
|
||||
'grave' => [['Grave accent','#96']],
|
||||
'grave accent' => [['Grave accent','#96']],
|
||||
'acute' => [['Acute accent','#180']],
|
||||
'acute accent' => [['Acute accent','#180']],
|
||||
|
||||
# Greek
|
||||
'alpha' => [['Alpha capital','Alpha'],['Alpha small','alpha']],
|
||||
'beta' => [['Beta capital','Beta'],['Beta small','beta']],
|
||||
'gamma' => [['Gamma capital','Gamma'],['Gamma small','gamma']],
|
||||
'phi' => [['Phi capital','Phi'],['Phi small','phi']],
|
||||
'omega' => [['Omega capital','Omega'],['Omega small','omega']],
|
||||
'kappa' => [['Kappa capital','Kappa'],['Kappa small','kappa']],
|
||||
'delta' => [['Delta capital','Delta'],['Delta small','delta']], # also displays a HTML Color Codes Goodie answer - Issue #490
|
||||
|
||||
# Shapes
|
||||
'trapezium' => [['Trapezium', '#9186']],
|
||||
'parallelogram' => [['Parallelogram', '#9649']],
|
||||
'spade' => [['Spade (suit)','#9824']],
|
||||
'club' => [['Club (suit)','#9827']],
|
||||
'heart' => [['Heart (suit)','#9829']],
|
||||
'diamond' => [['Diamond (suit)','#9830']],
|
||||
);
|
||||
|
||||
my %accented_chars = (
|
||||
'agrave' => [['a-grave','agrave']],
|
||||
'Agrave' => [['A-grave','Agrave']],
|
||||
'egrave' => [['e-grave','egrave']],
|
||||
'Egrave' => [['E-grave','Egrave']],
|
||||
'igrave' => [['i-grave','igrave']],
|
||||
'Igrave' => [['I-grave','Igrave']],
|
||||
'ograve' => [['o-grave','ograve']],
|
||||
'Ograve' => [['O-grave','Ograve']],
|
||||
'ugrave' => [['u-grave','ugrave']],
|
||||
'Ugrave' => [['U-grave','Ugrave']],
|
||||
|
||||
'aacute' => [['a-acute','aacute']],
|
||||
'Aacute' => [['A-acute','Aacute']],
|
||||
'eacute' => [['e-acute','eacute']],
|
||||
'Eacute' => [['E-acute','Eacute']],
|
||||
'iacute' => [['i-acute','iacute']],
|
||||
'Iacute' => [['I-acute','Iacute']],
|
||||
'oacute' => [['o-acute','oacute']],
|
||||
'Oacute' => [['O-acute','Oacute']],
|
||||
'uacute' => [['u-acute','uacute']],
|
||||
'Uacute' => [['U-acute','Uacute']],
|
||||
);
|
||||
|
||||
sub make_text {
|
||||
# Returns a text string of the form: "Encoded HTML Entity: <<entity>>"
|
||||
my $text = "";
|
||||
foreach my $i (0 .. scalar(@{$_[0]}) - 1) {
|
||||
$text = $i ? ("$text" . "\n" . "Encoded HTML Entity: &$_[0][$i][1];") : ("$text" . "Encoded HTML Entity: &$_[0][$i][1];"); # No \n in the first line of the answer
|
||||
}
|
||||
return $text;
|
||||
};
|
||||
|
||||
sub make_html {
|
||||
# Returns a html formatted string with css class names (no inline styles)
|
||||
my $html;
|
||||
if (scalar(@{$_[0]}) == 1) { # single line answer
|
||||
$html = qq(<div class="zci--htmlentitiesencode"><span class="text--secondary">Encoded HTML Entity (&$_[0][0][1];): </span><span class="text--primary">&<span>$_[0][0][1]</span>;</span></div>) ; # link in the same line for single line answers
|
||||
} else {
|
||||
$html = qq(<div class="zci--htmlentitiesencode">);
|
||||
foreach my $i (0 .. scalar(@{$_[0]}) - 1) { # multiple line answer
|
||||
$html = $html . qq(<div><span class="text--secondary">$_[0][$i][0] (&$_[0][$i][1];): </span><span class="text--primary">&<span>$_[0][$i][1]</span>;</span></div>);
|
||||
}
|
||||
$html = $html . "</div>";
|
||||
}
|
||||
return $html;
|
||||
};
|
||||
|
||||
triggers any => 'html', 'entity', 'htmlencode','encodehtml','htmlescape','escapehtml', 'htmlentity';
|
||||
|
||||
primary_example_queries 'html em dash', 'html entity A-acute', 'html escape &';
|
||||
secondary_example_queries 'html code em-dash', 'html entity for E grave', '$ sign htmlentity', 'pound sign html encode', 'html character code for trademark symbol',
|
||||
'what is the html entity for greater than sign', 'how to encode an apostrophe in html';
|
||||
|
||||
name 'HTMLEntitiesEncode';
|
||||
description 'Displays the HTML entity code for the query name';
|
||||
category 'cheat_sheets';
|
||||
topics 'programming', 'web_design';
|
||||
code_url 'https://github.com/duckduckgo/zeroclickinfo-spice/blob/master/lib/DDG/Goodie/HTMLEntitiesEncode.pm';
|
||||
zci answer_type => 'html_entity';
|
||||
zci is_cached => 1;
|
||||
|
||||
attribution web => ["http://nishanths.github.io", "Nishanth Shanmugham"],
|
||||
github => ["https://github.com/nishanths", "Nishanth Shanmugham"],
|
||||
twitter => ["https://twitter.com/nshanmugham", "Nishanth Shanmugham"],
|
||||
twitter => 'crazedpsyc',
|
||||
cpan => 'CRZEDPSYC' ;
|
||||
|
||||
handle remainder => sub {
|
||||
# General query cleanup
|
||||
$_ =~ s/^\s+|\s+$//g; # remove front and back whitespace
|
||||
$_ =~ s/(\bwhat\s*is\s*(the)?)//ig; # remove "what is the" (optional: the)
|
||||
$_ =~ s/(\bhow\s*do\s*(i|you|we))//ig; # remove "how do i|you|we"
|
||||
$_ =~ s/(\bhow\s*to)//ig; # remove "how to"
|
||||
$_ =~ s/\b(an|the|for|of|in|is|sign|symbol|character|code|encode|encoded|entity|escape|put|embed|get|insert|display|my|(a(?![\s\-*](grave|acute))))\b//ig; # remove filler words (the word boundary anchors ensure 'for' is not removed from "formula")
|
||||
$_ =~ s/^\s+|\s+$//g; # remove front and back whitespace that existed in between that may now show up after removing the words above
|
||||
|
||||
# Hash-specific query cleanup for better hits
|
||||
my $hashes_query = $_;
|
||||
$hashes_query =~ s/\-+/ /g; # change '-' to ' '
|
||||
$hashes_query =~ s/"|'//g; # remove double and single quotes
|
||||
$hashes_query =~ s/\s*\?$//g; # remove ending question mark
|
||||
# Hashes lookup
|
||||
if ($hashes_query) {
|
||||
my $key;
|
||||
my $value;
|
||||
# Query is for accented character
|
||||
if ($hashes_query =~ /^([a-zA-Z])\s*(grave|acute)$/i) {
|
||||
$hashes_query = $1 . lc $2; # $1's capitalization matters for accented characters lookup, lc $2 allows for more freedom in queries
|
||||
$key = $hashes_query;
|
||||
$value = $accented_chars{$key};
|
||||
# Not an accented character -- lookup the $codes hash instead
|
||||
} else {
|
||||
$key = lc $hashes_query;
|
||||
$value = $codes{$key};
|
||||
}
|
||||
# Try again after substitutions if there is no hit
|
||||
unless (defined $value) {
|
||||
$key =~ s/brackets/bracket/g;
|
||||
$key =~ s/quotes/quote/g;
|
||||
$value = $codes{$key};
|
||||
}
|
||||
# Make final answer
|
||||
if (defined $value) {
|
||||
my $text = make_text($value);
|
||||
my $html = make_html($value);
|
||||
return $text, html => $html;
|
||||
}
|
||||
}
|
||||
|
||||
# Query maybe a single typed-in character to encode
|
||||
# No hits above if we got this far, use html_enc()
|
||||
if ( (/^(?:")(?<char>.)(?:")\s*\??$/) # a (captured) single character within double quotes
|
||||
|| (/^(?:'')(?<char>.)(?:'')\s*\??$/) # or within single quotes
|
||||
|| (/^(?<char>.)\s*\??$/)) { # or stand-alone
|
||||
my $entity = html_enc($+{char});
|
||||
if ($entity eq $+{char}) { # html_enc() was unsuccessful and returned the input itself
|
||||
$entity = ord($+{char}); # get the decimal
|
||||
$entity = '#' . $entity; # dress it up like a decimal
|
||||
}
|
||||
# Remove '&' and ';' from the output of html_enc(), these will be added in html
|
||||
$entity =~ s/^&//g;
|
||||
$entity =~ s/;$//g;
|
||||
# Make final answer
|
||||
my $answer = [[$_, $entity]];
|
||||
my $text = make_text($answer);
|
||||
my $html = make_html($answer);
|
||||
return $text, html => $html;
|
||||
}
|
||||
|
||||
return;
|
||||
};
|
||||
|
||||
1;
|
||||
|
|
|
@ -12,11 +12,11 @@ my $text;
|
|||
my $key;
|
||||
my $value;
|
||||
my %keys = ('backspace' => '8',
|
||||
'tab' => '9',
|
||||
'enter' => '13',
|
||||
'tab' => '9',
|
||||
'enter' => '13',
|
||||
'shift' => '16',
|
||||
'ctrl' => '17',
|
||||
'alt' => '18',
|
||||
'ctrl' => '17',
|
||||
'alt' => '18',
|
||||
'pause' => '19',
|
||||
'break' => '19',
|
||||
'caps lock' => '20',
|
||||
|
@ -26,7 +26,7 @@ my %keys = ('backspace' => '8',
|
|||
'end' => '35',
|
||||
'home' => '36',
|
||||
'left arrow' => '37',
|
||||
'up arrow' => '38',
|
||||
'up arrow' => '38',
|
||||
'right arrow' => '39',
|
||||
'down arrow' => '40',
|
||||
'insert' => '45',
|
||||
|
@ -105,7 +105,7 @@ my %keys = ('backspace' => '8',
|
|||
|
||||
my $header = share('header.txt')->slurp;
|
||||
my $footer = share('footer.txt')->slurp;
|
||||
|
||||
|
||||
handle remainder => sub {
|
||||
my $query = lc($_);
|
||||
return unless exists $keys{$query}
|
||||
|
@ -117,13 +117,13 @@ handle remainder => sub {
|
|||
$html .= "\n<tr><td class='c1'><b>$query</b></td>"
|
||||
. "\n<td class='c2'><b>$keys{$query}</b></td></tr>"
|
||||
if exists $keys{$query};
|
||||
|
||||
|
||||
foreach $key (sort keys %keys){
|
||||
$html .= "\n<tr><td class='c1'>$key</td>"
|
||||
. "\n<td class='c2'>$keys{$key}</td></tr>"
|
||||
unless $key eq $query;
|
||||
};
|
||||
|
||||
|
||||
$html .= $footer;
|
||||
$text = "Keycode for $query: $keys{$query} (JavaScript)"
|
||||
unless not exists $keys{$query};
|
||||
|
|
|
@ -10,7 +10,7 @@ zci answer_type => 'loan';
|
|||
zci is_cached => 1;
|
||||
|
||||
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',
|
||||
'borrow $500000 4.5%',
|
||||
'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
|
||||
my %supported_currency_codes = ( );
|
||||
|
||||
# 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
|
||||
# currency guessing. Perhaps location data can be used to break ties.
|
||||
# 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
|
||||
# currency guessing. Perhaps location data can be used to break ties.
|
||||
sub convert_symbol_to_currency {
|
||||
my ($symbol, $country) = @_;
|
||||
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
|
||||
# to a useable number. Examples:
|
||||
# to a useable number. Examples:
|
||||
# In USD: 400,000 => 400000
|
||||
# In EUR: 400.000,00 => 400000.00
|
||||
sub normalize_formatted_currency_string {
|
||||
my ($str, $currency_code) = @_;
|
||||
|
||||
|
||||
my $thousands_separator = thousands_separator($currency_code) // ',';
|
||||
my $decimal_separator = decimal_separator($currency_code) // '.';
|
||||
|
||||
|
||||
$str =~ s/\Q$thousands_separator//g;
|
||||
if ($decimal_separator ne ".") {
|
||||
$str =~ s/\Q$decimal_separator/\./g;
|
||||
}
|
||||
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
# 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
|
||||
# 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
|
||||
# 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
|
||||
# number.
|
||||
# number.
|
||||
handle remainder => sub {
|
||||
my $query = $_;
|
||||
|
||||
|
||||
# Loan rate is required, query will be ignored if it is missing
|
||||
my $rate = 0;
|
||||
|
||||
|
@ -95,7 +95,7 @@ handle remainder => sub {
|
|||
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_is_in_cash = 0;
|
||||
my $downpayment_without_units = 0;
|
||||
|
@ -112,9 +112,9 @@ handle remainder => sub {
|
|||
if ($query =~ /(\p{Currency_Symbol})?([\d\.,]+)\s?([A-Za-z]{3})?/) {
|
||||
my $symbol = $1;
|
||||
my $principal = $2;
|
||||
my $input_currency_code = $3;
|
||||
my $downpayment = 0;
|
||||
|
||||
my $input_currency_code = $3;
|
||||
my $downpayment = 0;
|
||||
|
||||
if (defined $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
|
||||
# to a useable number.
|
||||
# to a useable number.
|
||||
$principal = normalize_formatted_currency_string($principal, $currency_code);
|
||||
|
||||
# Deal with downpayment information if it was found in the query
|
||||
|
@ -144,23 +144,23 @@ handle remainder => sub {
|
|||
$downpayment = $principal * .01 * $downpayment_without_units;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
my $loan_amount = $principal - $downpayment;
|
||||
my $monthly_payment = loan_monthly_payment($loan_amount, $rate / 12 * .01, $years * 12);
|
||||
my $total_interest = ($monthly_payment * 12 * $years) - $loan_amount;
|
||||
|
||||
return "Monthly Payment is " . currency_format($currency_code, $monthly_payment, FMT_SYMBOL) .
|
||||
" for $years years. Total interest paid is " .
|
||||
currency_format($currency_code, $total_interest, FMT_SYMBOL);
|
||||
|
||||
return "Monthly Payment is " . currency_format($currency_code, $monthly_payment, FMT_SYMBOL) .
|
||||
" for $years years. Total interest paid is " .
|
||||
currency_format($currency_code, $total_interest, FMT_SYMBOL);
|
||||
|
||||
}
|
||||
return;
|
||||
};
|
||||
|
||||
# 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
|
||||
# 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.
|
||||
# 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
|
||||
# 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.
|
||||
%country_to_currency = (
|
||||
'ad' => 'EUR',
|
||||
'ae' => 'AED',
|
||||
|
|
|
@ -21,11 +21,11 @@ handle remainder => sub {
|
|||
return unless $_;
|
||||
my $lower = lc $_;
|
||||
my $text = $lower;
|
||||
|
||||
|
||||
# Encode the variable before putting it in HTML.
|
||||
# There's no need to encode the $text variable because that gets encoded internally.
|
||||
$lower = html_enc($lower);
|
||||
|
||||
|
||||
my $html = qq(<div class="zci--lowercase"><span class="text--primary">$lower</span></div>);
|
||||
|
||||
return $text, html => $html;
|
||||
|
|
|
@ -19,9 +19,9 @@ zci answer_type => 'xkcd_sandwich';
|
|||
zci is_cached => 1;
|
||||
|
||||
handle remainder => sub {
|
||||
return 'Okay.',
|
||||
return 'Okay.',
|
||||
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 '';
|
||||
return;
|
||||
};
|
||||
|
|
|
@ -47,7 +47,7 @@ my %triggerQueries = (
|
|||
);
|
||||
|
||||
handle query_lc => sub {
|
||||
|
||||
|
||||
# Make sure the query is on the list
|
||||
my $queryStripped = $_;
|
||||
$queryStripped =~ s/[^a-zA-z\s]//g;
|
||||
|
@ -68,10 +68,10 @@ handle query_lc => sub {
|
|||
$phase = 'First Quarter' if $phaseAngle == 25;
|
||||
$phase = 'Full Moon' if $phaseAngle == 50;
|
||||
$phase = 'Third Quarter' if $phaseAngle == 75;
|
||||
|
||||
|
||||
my $phaseUrl = $phase;
|
||||
$phaseUrl =~ s/\s+/+/g;
|
||||
|
||||
|
||||
return "The current lunar phase is: $phase", html => qq(The current lunar phase is: <a href="?q=$phaseUrl">$phase</a>);
|
||||
};
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ my @presidents = (
|
|||
"George W. Bush",
|
||||
"Barack Obama",
|
||||
);
|
||||
|
||||
|
||||
handle remainder => sub {
|
||||
s/
|
||||
|who\s+(is|was)\s+the\s+
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
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>'
|
||||
|
||||
use DDG::Goodie;
|
||||
|
|
|
@ -35,9 +35,9 @@ triggers query_nowhitespace_nodash => qr/
|
|||
|
||||
handle query_nowhitespace_nodash => sub {
|
||||
my $parcel_number = $+{parcel_number};
|
||||
|
||||
|
||||
if ($parcel_number && $parcel_number !~ /^isbn/i) {
|
||||
|
||||
|
||||
return $parcel_number,
|
||||
heading => 'Parcelforce Tracking',
|
||||
html =>
|
||||
|
|
|
@ -30,7 +30,7 @@ handle remainder => sub {
|
|||
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>);
|
||||
|
||||
|
||||
return "Accepted: $acc Experimental: $exp Error: $err%", html => $html;
|
||||
};
|
||||
|
||||
|
|
|
@ -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+)?)))$/) {
|
||||
my %polygons = ("pentagon" => 5, "hexagon" => 6, "octagon" => 8);
|
||||
my $shape = $1 ? "circle" : $3 || $5 || $8;
|
||||
|
||||
|
||||
my $answerPrefix = "Perimeter of $shape: ";
|
||||
my $answer;
|
||||
|
||||
|
@ -41,7 +41,7 @@ handle query_lc => sub {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return $answerPrefix.$answer;
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -52,7 +52,7 @@ sub format_prime {
|
|||
|
||||
foreach my $factor (@factors) {
|
||||
my ($text, $html) = format_exp($factor);
|
||||
|
||||
|
||||
push(@text_result, $text);
|
||||
push(@html_result, $html);
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ handle remainder => sub {
|
|||
|
||||
my $start_time = time();
|
||||
my @factors = ();
|
||||
|
||||
|
||||
# Provide only one second for computing the factors.
|
||||
eval {
|
||||
alarm(1);
|
||||
|
|
|
@ -2,7 +2,7 @@ package DDG::Goodie::Randagram;
|
|||
# ABSTRACT: Take a query and spit it out randomly.
|
||||
|
||||
use DDG::Goodie;
|
||||
use List::Util 'shuffle';
|
||||
use List::Util 'shuffle';
|
||||
|
||||
triggers start => "randagram";
|
||||
|
||||
|
|
|
@ -9,27 +9,27 @@ use DDG::Goodie;
|
|||
zci answer_type => "regex_cheat";
|
||||
zci is_cached => 1;
|
||||
|
||||
triggers start =>
|
||||
'regex cheatsheet',
|
||||
'regex cheat sheet',
|
||||
'regex help',
|
||||
'regexp cheatsheet',
|
||||
'regexp cheat sheet',
|
||||
triggers start =>
|
||||
'regex cheatsheet',
|
||||
'regex cheat sheet',
|
||||
'regex help',
|
||||
'regexp cheatsheet',
|
||||
'regexp cheat sheet',
|
||||
'regexp help',
|
||||
'regex symbols',
|
||||
'regex symbols',
|
||||
'regex symbol',
|
||||
'regexp symbols',
|
||||
'regexp symbols',
|
||||
'regexp symbol',
|
||||
'regex chars',
|
||||
'regex chars',
|
||||
'regex char',
|
||||
'regexp chars',
|
||||
'regexp chars',
|
||||
'regexp char',
|
||||
'regex characters',
|
||||
'regex characters',
|
||||
'regex character',
|
||||
'regexp characters',
|
||||
'regexp character',
|
||||
'regex',
|
||||
'regexp',
|
||||
'regexp characters',
|
||||
'regexp character',
|
||||
'regex',
|
||||
'regexp',
|
||||
'regular expressions',
|
||||
'regular expression',
|
||||
'regex guide',
|
||||
|
@ -99,7 +99,7 @@ my %syntax_map = (
|
|||
'[a-q]' => 'Single character range (a or b ... or q)',
|
||||
'[A-Z]' => 'Single character range (A or B ... or Z)',
|
||||
'[0-9]' => 'Single digit from 0 to 9',
|
||||
'^' => "Start of string or line",
|
||||
'^' => "Start of string or line",
|
||||
'\A' => "Start of string",
|
||||
'$' => "End of string or line",
|
||||
'\Z' => "End of string",
|
||||
|
@ -216,29 +216,29 @@ handle remainder => sub {
|
|||
elsif ($_ =~ /^\{([0-9]+),([0-9]+)?\}$/) {
|
||||
if ($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",
|
||||
heading => $heading;
|
||||
}
|
||||
return answer => "$_ - $1 or more",
|
||||
return answer => "$_ - $1 or more",
|
||||
html => "<code>" . html_enc($_) . "</code> - $1 or more occurrences",
|
||||
heading => $heading;
|
||||
}
|
||||
# Check our map if it's in our list of regex patterns.
|
||||
return unless $syntax_map{$syntax_key};
|
||||
|
||||
|
||||
my $text_output = "$_ - $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;
|
||||
}
|
||||
|
||||
|
||||
# Otherwise display the complete tabular output, into n columns in the order specified.
|
||||
|
||||
|
||||
my $text_output = '';
|
||||
|
||||
|
||||
# Content of the div column wrapper.
|
||||
my @html_columns = ();
|
||||
|
||||
|
||||
# Add a helper function for adding the <td> tag.
|
||||
sub add_table_data {
|
||||
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";
|
||||
$text_output .= "\t$syntax_object - $syntax_map{$syntax_object}\n";
|
||||
}
|
||||
|
||||
$text_output .= "\n";
|
||||
|
||||
$text_output .= "\n";
|
||||
$new_table .= "</table>\n";
|
||||
$html_columns[$column] .= $new_table;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
my $html_output = "<div class='regex-container'><div class='regex-column'>";
|
||||
$html_output .= join ("</div><div class='regex-column'>", @html_columns);
|
||||
$html_output .= "</div></div>";
|
||||
|
|
|
@ -42,7 +42,7 @@ handle remainder => sub {
|
|||
|
||||
#Reverse
|
||||
$sequence = reverse($sequence);
|
||||
|
||||
|
||||
return $sequence, html => wrap_html('DNA reverse complement:', $sequence);
|
||||
};
|
||||
|
||||
|
|
|
@ -48,11 +48,11 @@ handle query_raw => sub {
|
|||
$resistance += ($coloursToDigits{$colours[0]}{value} * 10);
|
||||
$resistance += $coloursToDigits{$colours[1]}{value};
|
||||
for (my $i = 0; $i < $coloursToDigits{$colours[2]}{value}; $i++) {
|
||||
$resistance = $resistance * 10;
|
||||
$resistance = $resistance * 10;
|
||||
}
|
||||
my $mult = $coloursToDigits{$colours[2]}{value};
|
||||
if (exists $colours[3]) {
|
||||
$marginE = $coloursToDigits{$colours[3]}{tolerance};
|
||||
$marginE = $coloursToDigits{$colours[3]}{tolerance};
|
||||
} else {
|
||||
$marginE = 20;
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ handle query_raw => sub {
|
|||
if ($resistance > 1000000000) {
|
||||
$resistance = $resistance / 1000000000;
|
||||
$append = "G";
|
||||
}
|
||||
}
|
||||
#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 $source = '<a href="https://en.wikipedia.org/wiki/Electronic_color_code">More at Wikipedia</a>';
|
||||
|
|
|
@ -19,7 +19,7 @@ zci is_cached => 1;
|
|||
|
||||
handle remainder => sub {
|
||||
if ($_) {
|
||||
$_ =~ tr[a-zA-Z][n-za-mN-ZA-M];
|
||||
$_ =~ tr[a-zA-Z][n-za-mN-ZA-M];
|
||||
return "ROT13: $_";
|
||||
};
|
||||
return;
|
||||
|
|
|
@ -4378,10 +4378,10 @@ handle query => sub {
|
|||
# default $router password
|
||||
|^(?:(?:default|password)\ )(.+)(?:\ (?:default|password))$
|
||||
# $router default password
|
||||
# default password $router
|
||||
# default password $router
|
||||
|^(?:(.+)\ )?(?:default\ password|password\ default)(?:\ (.+))?$
|
||||
# password $router
|
||||
# $router password
|
||||
# password $router
|
||||
# $router password
|
||||
|^(?:(.+)\ )?(?:password)(?:\ (.+))?$
|
||||
# $router
|
||||
|^(.+)$
|
||||
|
|
|
@ -14,8 +14,8 @@ topics 'special_interest';
|
|||
source 'http://math.cos.ucf.edu/~reid/Rubik/patterns.html';
|
||||
attribution web => ['robert.io', 'Robert Picard'], twitter => '__rlp', github => ['https://github.com/rpicard', 'rpicard'];
|
||||
|
||||
triggers start => "rcube", "rubik", "rubiks", "rubix",
|
||||
"rubicks", "rubik's", "rubic's", "rubick's",
|
||||
triggers start => "rcube", "rubik", "rubiks", "rubix",
|
||||
"rubicks", "rubik's", "rubic's", "rubick's",
|
||||
"rubik cube", "rubiks cube", "rubic cube", "rubics cube",
|
||||
"rubik's cube patterns", "rubiks cube patterns";
|
||||
|
||||
|
@ -28,15 +28,15 @@ our %patterns = (
|
|||
"swap centers" => "U D' R L' F B' U D'",
|
||||
"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 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'",
|
||||
"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'",
|
||||
"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 =~ s/(\w\S*)/\u\L$1/g;
|
||||
|
@ -49,7 +49,7 @@ sub render_text($) {
|
|||
my $name = pop;
|
||||
return to_titlecase($name) . ": $patterns{$name} \n";
|
||||
}
|
||||
|
||||
|
||||
sub render_html($) {
|
||||
my $name = pop;
|
||||
my $output = "<div><i>" . to_titlecase($name) . "</i>";
|
||||
|
@ -60,16 +60,16 @@ sub render_html($) {
|
|||
handle remainder => sub {
|
||||
|
||||
$_ = lc($_);
|
||||
|
||||
|
||||
#support British English!
|
||||
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/;
|
||||
|
||||
#show answer
|
||||
return render_text($_), html => render_html($_) if ($patterns{$_});
|
||||
|
||||
|
||||
#display the cheatsheet
|
||||
my $output = my $html_output = "";
|
||||
foreach my $pattern (keys %patterns) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/env perl
|
||||
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 warnings;
|
||||
|
@ -35,7 +35,7 @@ handle query => sub {
|
|||
|
||||
my ($input) = @_;
|
||||
my ($address, $cidr) = split qr`[\s/]`, $input;
|
||||
|
||||
|
||||
my @octlets = split /\./, $address;
|
||||
for (@octlets) {
|
||||
return if int($_) > 255;
|
||||
|
@ -48,8 +48,8 @@ handle query => sub {
|
|||
# Convert CIDR & Subnets
|
||||
if ($cidr =~ /^[0-9]+$/) {
|
||||
return if ($cidr > 32 || $cidr < 1);
|
||||
$wildcard_mask = 2**(32-$cidr) - 1;
|
||||
|
||||
$wildcard_mask = 2**(32-$cidr) - 1;
|
||||
|
||||
# Flip the bits.
|
||||
$mask = 0xffffffff ^ $wildcard_mask;
|
||||
} elsif ($cidr =~ /([0-9]{1,3}\.){3}([0-9]{1,3})/) {
|
||||
|
@ -59,44 +59,44 @@ handle query => sub {
|
|||
for(@cidr_octlets) {
|
||||
return if int($_) > 255;
|
||||
}
|
||||
|
||||
|
||||
$mask = ip_to_int(@cidr_octlets);
|
||||
# Convert the integer into its binary representation.
|
||||
my $mask_binary = sprintf("%b", $mask);
|
||||
|
||||
|
||||
# The mask cannot have alternating 1s and 0s.
|
||||
return unless ($mask_binary =~ /^1+0*$/);
|
||||
|
||||
# Flip the bits.
|
||||
$wildcard_mask = 0xffffffff ^ $mask;
|
||||
|
||||
|
||||
# Count the number of 1s.
|
||||
$cidr = ($mask_binary =~ tr/1//);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
my $host = $address_raw & $wildcard_mask;
|
||||
my $network = $address_raw & $mask;
|
||||
|
||||
|
||||
my $start = $network + 1;
|
||||
my $end = $network + ($wildcard_mask - 1);
|
||||
my $broadcast = $network + $wildcard_mask;
|
||||
my $host_count = 1 + $end - $start;
|
||||
|
||||
|
||||
# Check the class type of the IP address.
|
||||
my $class = "A";
|
||||
$class = "E (reserved)" if (($network >> 28 & 0x0F) == 0x0F);
|
||||
$class = "D (multicast)" if (($network >> 28 & 0x0F) == 0x0E);
|
||||
$class = "C" if (($network >> 29 & 0x07) == 0x06);
|
||||
$class = "B" if (($network >> 30 & 0x03) == 0x02);
|
||||
|
||||
|
||||
my $which_specified = "Host #".($host);
|
||||
$which_specified = "Network" if ($host == 0);
|
||||
$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 = "Host Only" if ($cidr == 32);
|
||||
|
||||
|
||||
sub to_html {
|
||||
my $results = "";
|
||||
my $minwidth = "70px";
|
||||
|
@ -121,12 +121,12 @@ handle query => sub {
|
|||
["Netmask", int_to_str($mask)],
|
||||
["Specified", "$which_specified"],
|
||||
);
|
||||
|
||||
|
||||
unless($cidr > 30) {
|
||||
push @output, (["Host Address Range", int_to_str($start) . "-" . int_to_str($end) . " ($host_count hosts)"],
|
||||
["Broadcast", int_to_str($broadcast)]);
|
||||
}
|
||||
|
||||
|
||||
return answer => to_text(@output), html => to_html(@output);
|
||||
};
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ sub parse_to_html_table(@)
|
|||
for my $line (@sudoku_lines)
|
||||
{
|
||||
my @chars = split(/ /, $line);
|
||||
for my $char (@chars)
|
||||
for my $char (@chars)
|
||||
{
|
||||
$char = "<input maxlength='1'/>" if $char eq "_";
|
||||
}
|
||||
|
@ -54,13 +54,13 @@ handle remainder => sub {
|
|||
|
||||
$sudoku->generate(blanks => (9 ** 2) * $blanks);
|
||||
my $str_output = $sudoku->as_string();
|
||||
|
||||
|
||||
#switch 0 to more sensible placeholders
|
||||
$str_output =~ s/0/_/g;
|
||||
|
||||
|
||||
my @sudoku_lines = split(/\n/, $str_output);
|
||||
my $html_table = parse_to_html_table(@sudoku_lines);
|
||||
|
||||
|
||||
return $str_output, html => $html_table;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,61 +1,61 @@
|
|||
package DDG::Goodie::Teredo;
|
||||
# ABSTRACT: Provides the Teredo server IPv4 address,
|
||||
# NAT IPv4 address, and port number encoded in a given
|
||||
# Teredo tunnel IPv6 address.
|
||||
|
||||
use DDG::Goodie;
|
||||
use Net::IP;
|
||||
use Math::BaseConvert;
|
||||
|
||||
triggers start => 'teredo';
|
||||
|
||||
primary_example_queries 'teredo 2001:0000:4136:e378:8000:63bf:3fff:fdd2';
|
||||
description 'Teredo address analyzer';
|
||||
name 'Teredo extractor';
|
||||
code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/Teredo.pm';
|
||||
topics 'sysadmin';
|
||||
category 'transformations';
|
||||
attribution github => ['https://github.com/seanheaton','seanheaton'],
|
||||
twitter => ['http://twitter.com/seanograph','@seanograph'],
|
||||
email => ['mailto:seanoftime@gmail.com','seanoftime@gmail.com'];
|
||||
|
||||
zci answer_type => 'teredo';
|
||||
zci is_cached => 1;
|
||||
|
||||
handle remainder => sub {
|
||||
my @output = ();
|
||||
|
||||
# Create an IPv6 address from the query value
|
||||
my $ip = new Net::IP ($_,6) if $_;
|
||||
|
||||
# Verify the query value is a valid Teredo IPv6 address
|
||||
if ((defined $ip) && ($ip->version() == 6) && (substr($ip->ip(),0,9) eq "2001:0000")) {
|
||||
my $binip = $ip->binip();
|
||||
|
||||
# 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)));
|
||||
|
||||
# negation of bits 80 to 96, converted to decimal, designate NAT port number
|
||||
push @output, (65535 - cnv((substr $binip, 80, 16),2,10));
|
||||
|
||||
# negation of bits 96 to 128 designate IPv4 address of NAT device
|
||||
push @output, (new Net::IP (Net::IP::ip_bintoip(~(substr $binip, 96, 32),4)));
|
||||
return answer => to_text(@output), html => to_html(@output);
|
||||
}
|
||||
return;
|
||||
|
||||
# Params: server, port, client
|
||||
sub to_text {
|
||||
return "Teredo Server IPv4: " . $_[0]->ip() . "\nNAT Public IPv4: " . $_[2]->ip()
|
||||
. "\nClient Port: " . $_[1];
|
||||
}
|
||||
|
||||
# Params: server, port, client
|
||||
sub to_html {
|
||||
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\">Client Port: </span><span class=\"text--primary\">" . $_[1] . "</span></div>";
|
||||
}
|
||||
};
|
||||
|
||||
1;
|
||||
package DDG::Goodie::Teredo;
|
||||
# ABSTRACT: Provides the Teredo server IPv4 address,
|
||||
# NAT IPv4 address, and port number encoded in a given
|
||||
# Teredo tunnel IPv6 address.
|
||||
|
||||
use DDG::Goodie;
|
||||
use Net::IP;
|
||||
use Math::BaseConvert;
|
||||
|
||||
triggers start => 'teredo';
|
||||
|
||||
primary_example_queries 'teredo 2001:0000:4136:e378:8000:63bf:3fff:fdd2';
|
||||
description 'Teredo address analyzer';
|
||||
name 'Teredo extractor';
|
||||
code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/Teredo.pm';
|
||||
topics 'sysadmin';
|
||||
category 'transformations';
|
||||
attribution github => ['https://github.com/seanheaton','seanheaton'],
|
||||
twitter => ['http://twitter.com/seanograph','@seanograph'],
|
||||
email => ['mailto:seanoftime@gmail.com','seanoftime@gmail.com'];
|
||||
|
||||
zci answer_type => 'teredo';
|
||||
zci is_cached => 1;
|
||||
|
||||
handle remainder => sub {
|
||||
my @output = ();
|
||||
|
||||
# Create an IPv6 address from the query value
|
||||
my $ip = new Net::IP ($_,6) if $_;
|
||||
|
||||
# Verify the query value is a valid Teredo IPv6 address
|
||||
if ((defined $ip) && ($ip->version() == 6) && (substr($ip->ip(),0,9) eq "2001:0000")) {
|
||||
my $binip = $ip->binip();
|
||||
|
||||
# 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)));
|
||||
|
||||
# negation of bits 80 to 96, converted to decimal, designate NAT port number
|
||||
push @output, (65535 - cnv((substr $binip, 80, 16),2,10));
|
||||
|
||||
# negation of bits 96 to 128 designate IPv4 address of NAT device
|
||||
push @output, (new Net::IP (Net::IP::ip_bintoip(~(substr $binip, 96, 32),4)));
|
||||
return answer => to_text(@output), html => to_html(@output);
|
||||
}
|
||||
return;
|
||||
|
||||
# Params: server, port, client
|
||||
sub to_text {
|
||||
return "Teredo Server IPv4: " . $_[0]->ip() . "\nNAT Public IPv4: " . $_[2]->ip()
|
||||
. "\nClient Port: " . $_[1];
|
||||
}
|
||||
|
||||
# Params: server, port, client
|
||||
sub to_html {
|
||||
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\">Client Port: </span><span class=\"text--primary\">" . $_[1] . "</span></div>";
|
||||
}
|
||||
};
|
||||
|
||||
1;
|
||||
|
|
|
@ -18,7 +18,7 @@ secondary_example_queries 'tmux quick reference', 'tmux guide';
|
|||
|
||||
triggers startend => (
|
||||
'tmux cheat sheet',
|
||||
'tmux cheatsheet',
|
||||
'tmux cheatsheet',
|
||||
'tmux commands',
|
||||
'tmux guide',
|
||||
'tmux help',
|
||||
|
@ -37,7 +37,7 @@ attribution github => ["charles-l", "Charles Saternos"],
|
|||
web => ["http://charles-l.github.io", "Charles Saternos"];
|
||||
|
||||
handle remainder => sub {
|
||||
return
|
||||
return
|
||||
heading => 'Tmux Cheat Sheet',
|
||||
html => html_cheat_sheet(),
|
||||
answer => text_cheat_sheet(),
|
||||
|
|
|
@ -28,7 +28,7 @@ handle query_raw => sub {
|
|||
#remove triggers and trim
|
||||
s/(^$trigger_words)|($trigger_words$)//i;
|
||||
s/(^\s+)|(\s+$)//;
|
||||
|
||||
|
||||
my $decoded = decodeURIComponent($_);
|
||||
|
||||
if($decoded =~ /^\s+$/)
|
||||
|
|
|
@ -2,16 +2,16 @@ package DDG::Goodie::UltimateAnswer;
|
|||
# ABSTRACT: A Hitchhiker's Guide to the Galaxy easter egg.
|
||||
|
||||
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';
|
||||
primary_example_queries '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';
|
||||
|
||||
|
||||
|
||||
name 'Ultimate Answer';
|
||||
description 'Hichhiker\'s Guide to the Galaxy reference.';
|
||||
category 'special';
|
||||
topics 'entertainment';
|
||||
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'];
|
||||
|
||||
zci answer_type => 'UltimateAnswer';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package DDG::Goodie::Unicornify;
|
||||
# ABSTRACT: Return Gravatar image given an email address
|
||||
# ABSTRACT: Return Gravatar image given an email address
|
||||
|
||||
use DDG::Goodie;
|
||||
use CGI qw/img/;
|
||||
|
@ -13,13 +13,13 @@ handle remainder => sub {
|
|||
my $link = 'http://unicornify.appspot.com/';
|
||||
if (Email::Valid->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 $html = 'This is a unique unicorn for ' . $_ . ':'
|
||||
.'<br /><a href="' . unicornify_url(email => $_, size => 128) .'">'
|
||||
.'<img src="/iu/?u='.unicornify_url(email => $_, size => "100").'" class="zci--unicornify-img" /></a>'
|
||||
. 'Learn more at <a href="'.$link.'">unicornify.appspot.com</a>';
|
||||
|
||||
|
||||
return $answer, heading => $heading, html => $html;
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
package DDG::Goodie::Unidecode;
|
||||
# ABSTRACT: return an ASCII version of the search query
|
||||
|
||||
use DDG::Goodie;
|
||||
use Text::Unidecode;
|
||||
use utf8;
|
||||
|
||||
triggers startend => "unidecode";
|
||||
|
||||
zci is_cached => 1;
|
||||
zci answer_type => "convert_to_ascii";
|
||||
|
||||
attribution github => ['https://github.com/moritz', 'moritz'];
|
||||
primary_example_queries 'unidecode møæp';
|
||||
secondary_example_queries "unidecode å亰";
|
||||
description 'decode special non-latin characters';
|
||||
code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/Unidecode.pm';
|
||||
category 'computing_tools';
|
||||
topics 'programming';
|
||||
|
||||
handle remainder => sub {
|
||||
my $u = unidecode $_;
|
||||
# unidecode output sometimes contains trailing spaces
|
||||
$u =~ s/\s+$//;
|
||||
return $u;
|
||||
};
|
||||
|
||||
1;
|
||||
package DDG::Goodie::Unidecode;
|
||||
# ABSTRACT: return an ASCII version of the search query
|
||||
|
||||
use DDG::Goodie;
|
||||
use Text::Unidecode;
|
||||
use utf8;
|
||||
|
||||
triggers startend => "unidecode";
|
||||
|
||||
zci is_cached => 1;
|
||||
zci answer_type => "convert_to_ascii";
|
||||
|
||||
attribution github => ['https://github.com/moritz', 'moritz'];
|
||||
primary_example_queries 'unidecode møæp';
|
||||
secondary_example_queries "unidecode å亰";
|
||||
description 'decode special non-latin characters';
|
||||
code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/Unidecode.pm';
|
||||
category 'computing_tools';
|
||||
topics 'programming';
|
||||
|
||||
handle remainder => sub {
|
||||
my $u = unidecode $_;
|
||||
# unidecode output sometimes contains trailing spaces
|
||||
$u =~ s/\s+$//;
|
||||
return $u;
|
||||
};
|
||||
|
||||
1;
|
||||
|
|
|
@ -27,11 +27,11 @@ handle remainder => sub {
|
|||
return unless $_;
|
||||
my $upper = uc $_;
|
||||
my $text = $upper;
|
||||
|
||||
|
||||
# Encode the variable before putting it in HTML.
|
||||
# There's no need to encode the $text variable because that gets encoded internally.
|
||||
$upper = html_enc($upper);
|
||||
|
||||
|
||||
my $html = qq(<div class="zci--uppercase"><span class="text--primary">$upper</span></div>);
|
||||
|
||||
return $text, html => $html;
|
||||
|
|
|
@ -17,15 +17,15 @@ primary_example_queries 'vim help', 'vim cheat sheet', 'vim commands';
|
|||
secondary_example_queries 'vi quick reference', 'vi commands', 'vi guide';
|
||||
|
||||
triggers startend => (
|
||||
'vi cheat sheet',
|
||||
'vi cheatsheet',
|
||||
'vi cheat sheet',
|
||||
'vi cheatsheet',
|
||||
'vi commands',
|
||||
'vi guide',
|
||||
'vi help',
|
||||
'vi quick reference',
|
||||
'vi reference',
|
||||
'vim cheat sheet',
|
||||
'vim cheatsheet',
|
||||
'vim cheat sheet',
|
||||
'vim cheatsheet',
|
||||
'vim commands',
|
||||
'vim guide',
|
||||
'vim help',
|
||||
|
@ -38,7 +38,7 @@ attribution github => ["kablamo", "Eric Johnson"],
|
|||
web => ["http://kablamo.org", "Eric Johnson"];
|
||||
|
||||
handle remainder => sub {
|
||||
return
|
||||
return
|
||||
heading => 'Vim Cheat Sheet',
|
||||
html => html_cheat_sheet(),
|
||||
answer => text_cheat_sheet(),
|
||||
|
|
|
@ -36,7 +36,7 @@ handle remainder => sub {
|
|||
return unless $_ =~ qr/^($datestring_regex) (?:(?:and|to) )?($datestring_regex)/i;
|
||||
my ($start, $end) = (parse_datestring_to_date($1), parse_datestring_to_date($2));
|
||||
return unless ($start && $end);
|
||||
|
||||
|
||||
# Flip if the dates are the wrong way around
|
||||
($end, $start) = ($start, $end) if ( DateTime->compare($start, $end) == 1 );
|
||||
|
||||
|
@ -60,16 +60,16 @@ sub delta_weekdays {
|
|||
my $difference = $start->delta_days($end);
|
||||
|
||||
$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();
|
||||
|
||||
|
||||
$wholeweeks = int($day_count / 7);
|
||||
$result = $wholeweeks * 5;
|
||||
$temp = $day_count - $wholeweeks * 7;
|
||||
|
||||
|
||||
$dow2 = $dow1 - 1 + $temp;
|
||||
|
||||
|
||||
$dow2 -= 7 if($dow2 > 7);
|
||||
|
||||
for(;;) {
|
||||
|
@ -78,7 +78,7 @@ sub delta_weekdays {
|
|||
$dow1 = $dow1 + 1;
|
||||
$dow1 = $dow1 - 7 if($dow1 > 7);
|
||||
}
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ handle remainder => sub {
|
|||
my ($start_date, $end_date) = parse_all_datestrings_to_date($1, $2);
|
||||
|
||||
return unless ($start_date && $end_date);
|
||||
|
||||
|
||||
($start_date, $end_date) = ($end_date, $start_date) if (DateTime->compare($start_date, $end_date) == 1);
|
||||
|
||||
my $calendar = Date::Calendar->new($Profiles->{US});
|
||||
|
|
|
@ -21,7 +21,7 @@ my @quotes = share('quotes.txt')->slurp;
|
|||
handle query => sub {
|
||||
# Ensure rand is seeded for each process
|
||||
srand();
|
||||
|
||||
|
||||
return if $_ !~ m/quotes?/;
|
||||
my $rand = int(rand(scalar(@quotes)));
|
||||
my $quote = $quotes[$rand];
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package DDG::GoodieBundle::OpenSourceDuckDuckGo;
|
||||
# ABSTRACT: The open source Goodie Bundle of DuckDuckGo
|
||||
|
||||
# This package is only a namespace/version holder
|
||||
|
||||
1;
|
||||
package DDG::GoodieBundle::OpenSourceDuckDuckGo;
|
||||
# ABSTRACT: The open source Goodie Bundle of DuckDuckGo
|
||||
|
||||
# This package is only a namespace/version holder
|
||||
|
||||
1;
|
||||
|
|
|
@ -398,7 +398,7 @@ sub parse_descriptive_datestring_to_date {
|
|||
|
||||
my $now = DateTime->now();
|
||||
my $month = $+{'m'}; # Set in each alternative match.
|
||||
|
||||
|
||||
if (my $day = $+{'d'}) {
|
||||
return parse_datestring_to_date("$day $month ".$now->year());
|
||||
}
|
||||
|
|
|
@ -38,8 +38,8 @@
|
|||
</style>
|
||||
<div class="crontab-container">
|
||||
<div class="crontab-column">
|
||||
<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
|
||||
<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
|
||||
(day of month, or day of week) match the current time. A field may be
|
||||
an asterisk (<code>*</code>), which will always match.</p>
|
||||
<table>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# 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
|
||||
# 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
|
||||
# (day of month, or day of week) match the current time. A field may be
|
||||
# an asterisk (*), which will always match.
|
||||
#
|
||||
#
|
||||
# Fields in order:
|
||||
# minute (0-59)
|
||||
# hour (0-23)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
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
|
||||
|
||||
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:
|
||||
Output is the file (currencies.txt) with list of countries and currencies with iso code in ()
|
||||
For example:
|
||||
slovakia
|
||||
For example:
|
||||
slovakia
|
||||
Euro (EUR)
|
||||
|
||||
If there is more than one currency used by each country then each currency is separated by comma
|
||||
For example:
|
||||
zimbabwe
|
||||
Botswana pula (BWP),British pound (GBP)
|
||||
zimbabwe
|
||||
Botswana pula (BWP),British pound (GBP)
|
||||
|
||||
Country name is lowercased for better comparison with user input. But it gets capitalized in search results.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/python
|
||||
# -*- 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
|
||||
|
||||
import lxml.html
|
||||
|
@ -44,10 +44,10 @@ for table in tables:
|
|||
if len(cells) == 5:
|
||||
currency = cells[0].text_content()
|
||||
iso_code = cells[2].text_content()
|
||||
|
||||
|
||||
currency = clear_text(currency)
|
||||
iso_code = iso_code if iso_code != "None" else ""
|
||||
|
||||
|
||||
if currency != "None" and currency != "":
|
||||
add_currency(country[1:], currency, iso_code, countries)
|
||||
|
||||
|
@ -58,7 +58,7 @@ result = []
|
|||
for country in sorted(countries):
|
||||
description = ""
|
||||
formated_record = []
|
||||
|
||||
|
||||
for record in countries[country]:
|
||||
iso_code = "" if record[1] == "" else (" (" + record[1] + ")")
|
||||
currency = record[0]
|
||||
|
|
|
@ -61,7 +61,7 @@ Reading & use of other information media
|
|||
029
|
||||
No longer used, formerly Literary methods
|
||||
030
|
||||
General [[encyclopedic]] works
|
||||
General [[encyclopedic]] works
|
||||
031
|
||||
Encyclopedias in American English
|
||||
032
|
||||
|
@ -225,7 +225,7 @@ Metaphysics
|
|||
111
|
||||
[[Ontology]]
|
||||
112
|
||||
No longer usedâformerly [[Methodology]]
|
||||
No longer usedâformerly [[Methodology]]
|
||||
113
|
||||
[[Cosmology]] ([[Philosophy of nature]])
|
||||
114
|
||||
|
@ -303,7 +303,7 @@ Other philosophical systems
|
|||
150
|
||||
Psychology
|
||||
151
|
||||
No longer usedâformerly Intellect
|
||||
No longer usedâformerly Intellect
|
||||
152
|
||||
[[Perception]], [[Motion (physics)|movement]], [[emotion]]s, and [[Motivation|drive]]s
|
||||
153
|
||||
|
@ -319,7 +319,7 @@ No longer usedâformerly [[Emotion]]s
|
|||
158
|
||||
[[Applied psychology]]
|
||||
159
|
||||
No longer usedâformerly Will
|
||||
No longer usedâformerly Will
|
||||
160
|
||||
Logic
|
||||
161
|
||||
|
@ -327,9 +327,9 @@ Logic
|
|||
162
|
||||
[[Deductive reasoning|Deduction]]
|
||||
163
|
||||
Not assigned or no longer used
|
||||
Not assigned or no longer used
|
||||
164
|
||||
Not assigned or no longer used
|
||||
Not assigned or no longer used
|
||||
165
|
||||
[[fallacy|Fallacies]] and sources of error
|
||||
166
|
||||
|
@ -431,7 +431,7 @@ Sources
|
|||
215
|
||||
[[Relationship between religion and science|Science & religion]]
|
||||
216
|
||||
No longer usedâformerly Evil
|
||||
No longer usedâformerly Evil
|
||||
217
|
||||
No longer usedâformerly Prayer
|
||||
218
|
||||
|
@ -469,7 +469,7 @@ Spiritual beings
|
|||
236
|
||||
[[Christian eschatology|Eschatology]]
|
||||
237
|
||||
No longer usedâformerly Future state
|
||||
No longer usedâformerly Future state
|
||||
238
|
||||
[[Creed]]s & [[catechism]]s
|
||||
239
|
||||
|
@ -503,11 +503,11 @@ Pastoral office ([[Pastoral theology]])
|
|||
255
|
||||
[[Congregation (catholic)|Religious congregations]] & orders
|
||||
256
|
||||
No longer usedâformerly Religious societies
|
||||
No longer usedâformerly Religious societies
|
||||
257
|
||||
No longer usedâformerly Parochial schools, libraries, etc.
|
||||
258
|
||||
No longer usedâformerly Parochial medicine
|
||||
No longer usedâformerly Parochial medicine
|
||||
259
|
||||
Activities of the local church
|
||||
261
|
||||
|
@ -561,7 +561,7 @@ Christian church in other areas
|
|||
287
|
||||
[[Methodist]] & related churches
|
||||
288
|
||||
No longer usedâformerly [[Unitarianism|Unitarian]]
|
||||
No longer usedâformerly [[Unitarianism|Unitarian]]
|
||||
289
|
||||
Other denominations & sects
|
||||
291
|
||||
|
@ -579,7 +579,7 @@ Classical ([[Ancient Greek religion|Greek]] & [[Religion in ancient Rome|Roman]]
|
|||
297
|
||||
[[Islam]], [[Bábism]] & [[Bahá'àFaith]]
|
||||
298
|
||||
No longer usedâformerly [[Mormonism]]
|
||||
No longer usedâformerly [[Mormonism]]
|
||||
299
|
||||
Other religions
|
||||
300
|
||||
|
@ -721,9 +721,9 @@ School management; special education
|
|||
375
|
||||
[[Curriculum]]s
|
||||
376
|
||||
No longer usedâformerly Education of women
|
||||
No longer usedâformerly Education of women
|
||||
377
|
||||
No longer usedâformerly Ethical education
|
||||
No longer usedâformerly Ethical education
|
||||
378
|
||||
[[Higher education]]
|
||||
379
|
||||
|
@ -759,7 +759,7 @@ Etiquette ([[Manners]])
|
|||
396
|
||||
No longer usedâformerly Women's position and treatment
|
||||
397
|
||||
No longer usedâformerly [[Outcast (person)|outcast]] studies
|
||||
No longer usedâformerly [[Outcast (person)|outcast]] studies
|
||||
398
|
||||
[[Folklore]]
|
||||
399
|
||||
|
@ -795,7 +795,7 @@ Geographical & persons treatment
|
|||
415
|
||||
Structural systems ([[Grammar]])
|
||||
416
|
||||
No longer usedâformerly [[Prosody (linguistics)]]
|
||||
No longer usedâformerly [[Prosody (linguistics)]]
|
||||
417
|
||||
[[Dialectology]] & [[historical linguistics]]
|
||||
418
|
||||
|
@ -827,11 +827,11 @@ German etymology
|
|||
433
|
||||
German dictionaries
|
||||
434
|
||||
Not assigned or no longer used
|
||||
Not assigned or no longer used
|
||||
435
|
||||
[[German grammar]]
|
||||
436
|
||||
Not assigned or no longer used
|
||||
Not assigned or no longer used
|
||||
437
|
||||
[[German dialects|German language variations]]
|
||||
438
|
||||
|
@ -845,11 +845,11 @@ French etymology
|
|||
443
|
||||
French dictionaries
|
||||
444
|
||||
Not assigned or no longer used
|
||||
Not assigned or no longer used
|
||||
445
|
||||
[[French grammar]]
|
||||
446
|
||||
Not assigned or no longer used
|
||||
Not assigned or no longer used
|
||||
447
|
||||
[[Dialects of French|French language variations]]
|
||||
448
|
||||
|
@ -863,11 +863,11 @@ Italian etymology
|
|||
453
|
||||
Italian dictionaries
|
||||
454
|
||||
Not assigned or no longer used
|
||||
Not assigned or no longer used
|
||||
455
|
||||
[[Italian grammar]]
|
||||
456
|
||||
Not assigned or no longer used
|
||||
Not assigned or no longer used
|
||||
457
|
||||
[[Italian dialects|Italian language variations]]
|
||||
458
|
||||
|
@ -881,11 +881,11 @@ Spanish etymology
|
|||
463
|
||||
Spanish dictionaries
|
||||
464
|
||||
Not assigned or no longer used
|
||||
Not assigned or no longer used
|
||||
465
|
||||
[[Spanish grammar]]
|
||||
466
|
||||
Not assigned or no longer used
|
||||
Not assigned or no longer used
|
||||
467
|
||||
[[Spanish dialects and varieties|Spanish language variations]]
|
||||
468
|
||||
|
@ -899,11 +899,11 @@ Portuguese
|
|||
473
|
||||
Classical Latin dictionaries
|
||||
474
|
||||
Not assigned or no longer used
|
||||
Not assigned or no longer used
|
||||
475
|
||||
Classical [[Latin grammar]]
|
||||
476
|
||||
Not assigned or no longer used
|
||||
Not assigned or no longer used
|
||||
477
|
||||
[[old Latin|Old]], Postclassical, [[Vulgar Latin]]
|
||||
478
|
||||
|
@ -917,11 +917,11 @@ Classical Greek etymology
|
|||
483
|
||||
Classical Greek dictionaries
|
||||
484
|
||||
Not assigned or no longer used
|
||||
Not assigned or no longer used
|
||||
485
|
||||
Classical Greek grammar
|
||||
486
|
||||
Not assigned or no longer used
|
||||
Not assigned or no longer used
|
||||
487
|
||||
Preclassical & postclassical Greek
|
||||
488
|
||||
|
@ -955,7 +955,7 @@ Miscellany
|
|||
503
|
||||
Dictionaries & encyclopedias
|
||||
504
|
||||
Not assigned or no longer used
|
||||
Not assigned or no longer used
|
||||
505
|
||||
Serial publications
|
||||
506
|
||||
|
@ -979,7 +979,7 @@ General principles
|
|||
516
|
||||
[[Topic outline of geometry|Geometry]]
|
||||
517
|
||||
Not assigned or no longer used
|
||||
Not assigned or no longer used
|
||||
518
|
||||
[[Numerical analysis]]
|
||||
519
|
||||
|
@ -991,7 +991,7 @@ Techniques, equipment, materials
|
|||
523
|
||||
Specific celestial bodies & phenomena
|
||||
524
|
||||
Not assigned or no longer used
|
||||
Not assigned or no longer used
|
||||
525
|
||||
[[Earth]] (Astronomical geography)
|
||||
526
|
||||
|
@ -1109,7 +1109,7 @@ Not assigned or no longer used
|
|||
588
|
||||
[[Bryophyte|Bryophyta]]
|
||||
589
|
||||
Forestry
|
||||
Forestry
|
||||
591
|
||||
[[Outline of zoology|Zoology]]
|
||||
592
|
||||
|
@ -1177,7 +1177,7 @@ Incidence & prevention of disease
|
|||
625
|
||||
Engineering of [[railroad]]s, [[road]]s
|
||||
626
|
||||
Not assigned or no longer used
|
||||
Not assigned or no longer used
|
||||
627
|
||||
[[Hydraulic engineering]]
|
||||
628
|
||||
|
@ -1227,11 +1227,11 @@ Processes of written communication
|
|||
653
|
||||
[[Shorthand]]
|
||||
654
|
||||
Not assigned or no longer used
|
||||
Not assigned or no longer used
|
||||
655
|
||||
Not assigned or no longer used
|
||||
Not assigned or no longer used
|
||||
656
|
||||
Not assigned or no longer used
|
||||
Not assigned or no longer used
|
||||
657
|
||||
[[Accounting]]
|
||||
658
|
||||
|
@ -1291,7 +1291,7 @@ Clothing
|
|||
688
|
||||
Other final products & [[packaging]]
|
||||
689
|
||||
Not assigned or no longer used
|
||||
Not assigned or no longer used
|
||||
691
|
||||
Building [[material]]s
|
||||
692
|
||||
|
@ -1391,7 +1391,7 @@ Drawing & drawings
|
|||
743
|
||||
Drawing & drawings by subject
|
||||
744
|
||||
Not assigned or no longer used
|
||||
Not assigned or no longer used
|
||||
745
|
||||
Decorative arts
|
||||
746
|
||||
|
@ -1413,7 +1413,7 @@ Techniques, equipment, forms
|
|||
755
|
||||
[[iconography|Religion & religious symbolism]]
|
||||
756
|
||||
Not assigned or no longer used
|
||||
Not assigned or no longer used
|
||||
757
|
||||
Human figures & their parts
|
||||
758
|
||||
|
@ -1423,7 +1423,7 @@ Geographical, [[History of painting|historical]], areas, persons treatment
|
|||
761
|
||||
Relief processes ([[Block printing]])
|
||||
762
|
||||
Not assigned or no longer used
|
||||
Not assigned or no longer used
|
||||
763
|
||||
[[lithography|Lithographic]] (Planographic) processes
|
||||
764
|
||||
|
@ -1435,7 +1435,7 @@ Metal [[engraving]]
|
|||
767
|
||||
[[Etching]] & [[drypoint]]
|
||||
768
|
||||
Not assigned or no longer used
|
||||
Not assigned or no longer used
|
||||
769
|
||||
Prints
|
||||
771
|
||||
|
@ -1451,7 +1451,7 @@ Pigment processes of printing
|
|||
776
|
||||
[[Computer art]]
|
||||
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
|
||||
[[:Category:Photography by genre|Fields & kinds of photography]]
|
||||
779
|
||||
|
@ -1473,7 +1473,7 @@ Music for single voices; The [[human voice|voice]]
|
|||
788
|
||||
[[Wind instrument]]s (Aerophones)
|
||||
789
|
||||
Not assigned or no longer used
|
||||
Not assigned or no longer used
|
||||
791
|
||||
Public performances
|
||||
792
|
||||
|
@ -1501,7 +1501,7 @@ Miscellany
|
|||
803
|
||||
Dictionaries & encyclopedias
|
||||
804
|
||||
Not assigned or no longer used
|
||||
Not assigned or no longer used
|
||||
805
|
||||
[[Literary magazine|Serial publications]]
|
||||
806
|
||||
|
@ -1529,7 +1529,7 @@ Satire & humor
|
|||
818
|
||||
Miscellaneous writings
|
||||
819
|
||||
Not assigned or no longer used
|
||||
Not assigned or no longer used
|
||||
821
|
||||
[[English poetry]]
|
||||
822
|
||||
|
@ -1825,9 +1825,9 @@ General history of South America; [[History of Guyana|Guiana]]
|
|||
989
|
||||
General history of South America; [[history of Paraguay|Paraguay]] & [[History of Uruguay|Uruguay]]
|
||||
991
|
||||
Not assigned or no longer used
|
||||
Not assigned or no longer used
|
||||
992
|
||||
Not assigned or no longer used
|
||||
Not assigned or no longer used
|
||||
993
|
||||
General history of other areas; [[History of New Zealand|New Zealand]]
|
||||
994
|
||||
|
|
|
@ -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 @
|
||||
zeta = z, eta = h, theta = q, iota = i, lamda = l, mu = m@
|
||||
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.
|
@ -9,7 +9,7 @@ use File::Slurp qw(read_file write_file);
|
|||
|
||||
# open file
|
||||
open(FILE, "/usr/share/dict/words") or die("Unable to open file");
|
||||
|
||||
|
||||
# read file into an array
|
||||
my %dict = ();
|
||||
|
||||
|
@ -22,7 +22,7 @@ while (my $line = <FILE>) {
|
|||
unless ($amt eq '\'s'){
|
||||
|
||||
$lcline = lc($line);
|
||||
|
||||
|
||||
## Spliting the string with no delimeter.
|
||||
$sorted_string = join("",sort(split("",$lcline)));
|
||||
|
||||
|
@ -35,7 +35,7 @@ while (my $line = <FILE>) {
|
|||
}
|
||||
}
|
||||
|
||||
# close file
|
||||
# close file
|
||||
close(FILE);
|
||||
|
||||
my $json = encode_json \%dict;
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
</td>
|
||||
</tr>
|
||||
<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>
|
||||
</td>
|
||||
<td class="record__cell__value">
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
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
|
||||
{
|
||||
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)
|
||||
{
|
||||
border-right: 3px solid rgba(136, 136, 136, 0.478);
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
SYNOPSIS
|
||||
|
||||
fetch.sh
|
||||
fetch.sh
|
||||
parser.pl
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
fetch.sh downloads the cheat sheet data from
|
||||
fetch.sh downloads the cheat sheet data from
|
||||
https://github.com/rtorr/vim-cheat-sheet
|
||||
|
||||
parser.pl parses the html retrieved by fetch.sh and generates
|
||||
|
|
|
@ -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: 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: 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: 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: 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: 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: [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: 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?
|
||||
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: Stop exploding, you cowards.
|
||||
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.
|
||||
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: 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.
|
||||
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.
|
||||
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: [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: 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.
|
||||
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: 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.
|
||||
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: 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.
|
||||
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: 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: [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: 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.
|
||||
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.
|
||||
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]
|
||||
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: 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: 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: 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: 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: I surrender and volunteer for treason!
|
||||
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: 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!
|
||||
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: [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.
|
||||
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: 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: 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: 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: [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.
|
||||
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: 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.
|
||||
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: 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!
|
||||
[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: [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.
|
||||
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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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.
|
||||
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: 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: 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.
|
||||
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: 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.
|
||||
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.
|
||||
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: [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: 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.
|
||||
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: 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.
|
||||
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: 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.
|
||||
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: 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: [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: 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.
|
||||
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.
|
||||
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]
|
||||
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: 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: 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: 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: 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: I surrender and volunteer for treason!
|
||||
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: 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!
|
||||
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: [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.
|
||||
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: 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: 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: 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: [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.
|
||||
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: 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.
|
||||
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: 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!
|
||||
[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: [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.
|
||||
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: 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: 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: 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.
|
||||
|
|
|
@ -298,7 +298,7 @@ subtest 'Dates' => sub {
|
|||
}
|
||||
restore_time();
|
||||
};
|
||||
|
||||
|
||||
subtest 'Valid mixture of formatted and descriptive dates' => sub {
|
||||
set_fixed_time('2000-01-01T00:00:00Z');
|
||||
my %mixed_dates_to_test = (
|
||||
|
@ -320,13 +320,13 @@ subtest 'Dates' => sub {
|
|||
'next january' => 978307200,
|
||||
'december' => 975628800,
|
||||
);
|
||||
|
||||
|
||||
foreach my $test_mixed_date (sort keys %mixed_dates_to_test) {
|
||||
my $parsed_date_object = RoleTester::parse_datestring_to_date($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.');
|
||||
}
|
||||
|
||||
|
||||
restore_time();
|
||||
}
|
||||
};
|
||||
|
|
2
t/Base.t
2
t/Base.t
|
@ -21,7 +21,7 @@ ddg_goodie_test(
|
|||
'10 in base 3' => test_zci('10 in base 3 is 101'),
|
||||
'18442240474082181119 to hex' => test_zci('18442240474082181119 in base 16 is FFEFFFFFFFFFFFFF'),
|
||||
'999999999999999999999999 to hex' => test_zci('999999999999999999999999 in base 16 is D3C21BCECCEDA0FFFFFF')
|
||||
|
||||
|
||||
);
|
||||
|
||||
done_testing;
|
||||
|
|
|
@ -37,12 +37,12 @@ ddg_goodie_test(
|
|||
heading => '[[ /tmp/hello -nt /etc/test ]] (Bash)',
|
||||
),
|
||||
'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/.+/,
|
||||
heading => '[ -z hello ] (Bash)',
|
||||
),
|
||||
'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/.+/,
|
||||
heading => '[[ "abc" -lt "cba" ]] (Bash)',
|
||||
),
|
||||
|
|
|
@ -17,72 +17,72 @@ ddg_goodie_test(
|
|||
html => "<div>Result: <b>1</b></div>",
|
||||
heading => "Binary Logic"
|
||||
),
|
||||
'4 ⊕ 5' => test_zci('1',
|
||||
html => "<div>Result: <b>1</b></div>",
|
||||
'4 ⊕ 5' => test_zci('1',
|
||||
html => "<div>Result: <b>1</b></div>",
|
||||
heading => "Binary Logic"
|
||||
),
|
||||
'9489 xor 394 xor 9349 xor 39 xor 29 xor 4967 xor 3985' => test_zci('7378',
|
||||
html => "<div>Result: <b>7378</b></div>",
|
||||
'9489 xor 394 xor 9349 xor 39 xor 29 xor 4967 xor 3985' => test_zci('7378',
|
||||
html => "<div>Result: <b>7378</b></div>",
|
||||
heading => "Binary Logic"
|
||||
),
|
||||
'10 and 12' => test_zci('8',
|
||||
html => "<div>Result: <b>8</b></div>",
|
||||
'10 and 12' => test_zci('8',
|
||||
html => "<div>Result: <b>8</b></div>",
|
||||
heading => "Binary Logic"
|
||||
),
|
||||
'10 ∧ 12' => test_zci('8',
|
||||
html => "<div>Result: <b>8</b></div>",
|
||||
'10 ∧ 12' => test_zci('8',
|
||||
html => "<div>Result: <b>8</b></div>",
|
||||
heading => "Binary Logic"
|
||||
),
|
||||
'52 or 100' => test_zci('116',
|
||||
html => "<div>Result: <b>116</b></div>",
|
||||
'52 or 100' => test_zci('116',
|
||||
html => "<div>Result: <b>116</b></div>",
|
||||
heading => "Binary Logic"
|
||||
),
|
||||
'52 ∨ 100' => test_zci('116',
|
||||
html => "<div>Result: <b>116</b></div>",
|
||||
'52 ∨ 100' => test_zci('116',
|
||||
html => "<div>Result: <b>116</b></div>",
|
||||
heading => "Binary Logic"
|
||||
),
|
||||
'23 and (30 or 128)' => test_zci('22',
|
||||
html => "<div>Result: <b>22</b></div>",
|
||||
'23 and (30 or 128)' => test_zci('22',
|
||||
html => "<div>Result: <b>22</b></div>",
|
||||
heading => "Binary Logic"
|
||||
),
|
||||
'23 ∧ (30 ∨ 128)' => test_zci('22',
|
||||
html => "<div>Result: <b>22</b></div>",
|
||||
'23 ∧ (30 ∨ 128)' => test_zci('22',
|
||||
html => "<div>Result: <b>22</b></div>",
|
||||
heading => "Binary Logic"
|
||||
),
|
||||
'0x999 xor 0x589' => test_zci('3088',
|
||||
html => "<div>Result: <b>3088</b></div>",
|
||||
'0x999 xor 0x589' => test_zci('3088',
|
||||
html => "<div>Result: <b>3088</b></div>",
|
||||
heading => "Binary Logic"
|
||||
),
|
||||
'0x999 ⊕ 0x589' => test_zci('3088',
|
||||
html => "<div>Result: <b>3088</b></div>",
|
||||
'0x999 ⊕ 0x589' => test_zci('3088',
|
||||
html => "<div>Result: <b>3088</b></div>",
|
||||
heading => "Binary Logic"
|
||||
),
|
||||
'not 1' => test_zci('18446744073709551614',
|
||||
html => "<div>Result: <b>18446744073709551614</b></div>",
|
||||
'not 1' => test_zci('18446744073709551614',
|
||||
html => "<div>Result: <b>18446744073709551614</b></div>",
|
||||
heading => "Binary Logic"
|
||||
),
|
||||
'¬1' => test_zci('18446744073709551614',
|
||||
html => "<div>Result: <b>18446744073709551614</b></div>",
|
||||
'¬1' => test_zci('18446744073709551614',
|
||||
html => "<div>Result: <b>18446744073709551614</b></div>",
|
||||
heading => "Binary Logic"
|
||||
),
|
||||
'3 and 2' => test_zci('2',
|
||||
html => "<div>Result: <b>2</b></div>",
|
||||
'3 and 2' => test_zci('2',
|
||||
html => "<div>Result: <b>2</b></div>",
|
||||
heading => "Binary Logic"
|
||||
),
|
||||
'1 or 1234' => test_zci('1235',
|
||||
html => "<div>Result: <b>1235</b></div>",
|
||||
'1 or 1234' => test_zci('1235',
|
||||
html => "<div>Result: <b>1235</b></div>",
|
||||
heading => "Binary Logic"
|
||||
),
|
||||
'34 or 100' => test_zci('102',
|
||||
html => "<div>Result: <b>102</b></div>",
|
||||
'34 or 100' => test_zci('102',
|
||||
html => "<div>Result: <b>102</b></div>",
|
||||
heading => "Binary Logic"
|
||||
),
|
||||
'10 and (30 or 128)' => test_zci('10',
|
||||
html => "<div>Result: <b>10</b></div>",
|
||||
'10 and (30 or 128)' => test_zci('10',
|
||||
html => "<div>Result: <b>10</b></div>",
|
||||
heading => "Binary Logic"
|
||||
),
|
||||
'0x01 or not 0X100' => test_zci('18446744073709551359',
|
||||
html => "<div>Result: <b>18446744073709551359</b></div>",
|
||||
'0x01 or not 0X100' => test_zci('18446744073709551359',
|
||||
html => "<div>Result: <b>18446744073709551359</b></div>",
|
||||
heading => "Binary Logic"
|
||||
),
|
||||
'0x01 or 0x02' => test_zci('3',
|
||||
|
|
|
@ -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 november 2009' => test_zci("
|
||||
S M T W T F S November 2009
|
||||
1 2 3 4 5 6 7
|
||||
8 9 10 11 12 13 14
|
||||
15 16 17 18 19 20 21
|
||||
22 23 24 25 26 27 28
|
||||
29 30
|
||||
1 2 3 4 5 6 7
|
||||
8 9 10 11 12 13 14
|
||||
15 16 17 18 19 20 21
|
||||
22 23 24 25 26 27 28
|
||||
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>#),
|
||||
'calendar nov 2009' => test_zci("
|
||||
S M T W T F S November 2009
|
||||
1 2 3 4 5 6 7
|
||||
8 9 10 11 12 13 14
|
||||
15 16 17 18 19 20 21
|
||||
22 23 24 25 26 27 28
|
||||
29 30
|
||||
1 2 3 4 5 6 7
|
||||
8 9 10 11 12 13 14
|
||||
15 16 17 18 19 20 21
|
||||
22 23 24 25 26 27 28
|
||||
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>#),
|
||||
'calendar 29 nov 2015' => test_zci("
|
||||
S M T W T F S November 2015
|
||||
1 2 3 4 5 6 7
|
||||
8 9 10 11 12 13 14
|
||||
15 16 17 18 19 20 21
|
||||
22 23 24 25 26 27 28
|
||||
|29| 30
|
||||
1 2 3 4 5 6 7
|
||||
8 9 10 11 12 13 14
|
||||
15 16 17 18 19 20 21
|
||||
22 23 24 25 26 27 28
|
||||
|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>#),
|
||||
'calendar 29.11.2015' => test_zci("
|
||||
S M T W T F S November 2015
|
||||
1 2 3 4 5 6 7
|
||||
8 9 10 11 12 13 14
|
||||
15 16 17 18 19 20 21
|
||||
22 23 24 25 26 27 28
|
||||
|29| 30
|
||||
1 2 3 4 5 6 7
|
||||
8 9 10 11 12 13 14
|
||||
15 16 17 18 19 20 21
|
||||
22 23 24 25 26 27 28
|
||||
|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>#),
|
||||
'cal 1980-11-29' => test_zci("
|
||||
S M T W T F S November 1980
|
||||
1
|
||||
2 3 4 5 6 7 8
|
||||
9 10 11 12 13 14 15
|
||||
16 17 18 19 20 21 22
|
||||
1
|
||||
2 3 4 5 6 7 8
|
||||
9 10 11 12 13 14 15
|
||||
16 17 18 19 20 21 22
|
||||
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> </td><td> </td><td> </td><td> </td><td> </td><td> </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("
|
||||
S M T W T F S November 2009
|
||||
1 2 3 4 5 6 7
|
||||
8 9 10 11 12 13 14
|
||||
15 16 17 18 19 20 21
|
||||
22 23 24 25 26 27 28
|
||||
29 30
|
||||
1 2 3 4 5 6 7
|
||||
8 9 10 11 12 13 14
|
||||
15 16 17 18 19 20 21
|
||||
22 23 24 25 26 27 28
|
||||
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>#),
|
||||
'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 of november 2009' => test_zci("
|
||||
S M T W T F S November 2009
|
||||
1 2 3 4 5 6 7
|
||||
8 9 10 11 12 13 14
|
||||
15 16 17 18 19 20 21
|
||||
22 23 24 25 26 27 28
|
||||
29 30
|
||||
1 2 3 4 5 6 7
|
||||
8 9 10 11 12 13 14
|
||||
15 16 17 18 19 20 21
|
||||
22 23 24 25 26 27 28
|
||||
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>#),
|
||||
'22/8/2003 to the hijri calendar' => undef,
|
||||
);
|
||||
|
|
|
@ -12,7 +12,7 @@ ddg_goodie_test(
|
|||
[qw(
|
||||
DDG::Goodie::Chess960
|
||||
)],
|
||||
map {
|
||||
map {
|
||||
$_ => test_zci(qr/^Position \d{1,3}:
|
||||
White: ([BKNQRP] ?){1,8}
|
||||
([BKNQRP] ?){0,8}
|
||||
|
|
|
@ -38,7 +38,7 @@ ddg_goodie_test(
|
|||
#Should not trigger for impossible latitudes and longitudes
|
||||
'95º 4\' N as decimal' => undef,
|
||||
'convert 293.11 degrees to dms' => undef,
|
||||
|
||||
|
||||
#Should not trigger for impossible combinations of sign and
|
||||
# cardinal direction
|
||||
'-71º 12\' 51" S as a decimal latitude' => undef,
|
||||
|
|
|
@ -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.),
|
||||
answer_type => "crypthashcheck"
|
||||
),
|
||||
'hash ecaceaca62d6c47190ed6c6f94a298f28a46450fda0bd1ec8fc64bc4a7a8cd436791a35f3c4e339b7ae480c1b751f1c1' => test_zci(
|
||||
'hash ecaceaca62d6c47190ed6c6f94a298f28a46450fda0bd1ec8fc64bc4a7a8cd436791a35f3c4e339b7ae480c1b751f1c1' => test_zci(
|
||||
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.),
|
||||
answer_type => "crypthashcheck"
|
||||
),
|
||||
'hash b1d7eb51d4372c505446abca04835a101275e498' => test_zci(
|
||||
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"
|
||||
),
|
||||
'hash 6286e0a5cbc030f7b2d105f594ae0afb9105c92175c6b07ff454734c23cd0bddfed77639fe59b68a70b8c78af27657f611cbe89c27f7a47b978fa9449808c19f' => test_zci(
|
||||
|
@ -38,15 +38,15 @@ ddg_goodie_test(
|
|||
answer_type => "crypthashcheck"
|
||||
),
|
||||
'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.'
|
||||
),
|
||||
'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.'
|
||||
),
|
||||
);
|
||||
|
||||
done_testing;
|
||||
|
||||
|
||||
|
||||
|
|
22
t/Cusip.t
22
t/Cusip.t
|
@ -22,19 +22,19 @@ ddg_goodie_test(
|
|||
|
||||
# queries with too many chars should not trigger the IA
|
||||
'cusip 0123456789' => undef,
|
||||
|
||||
|
||||
# white spaces should not be counted as chars
|
||||
'cusip 6789' => undef,
|
||||
'cusip 1234 ' => 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
|
||||
'cusip _12345678' => undef,
|
||||
'cusip 01234567+' => undef,
|
||||
|
||||
|
||||
# multiple IDs are not currently checked
|
||||
'cusip 037833100 037833100' => undef,
|
||||
'cusip 037833100 037833100' => undef,
|
||||
'cusip 037833100 12345' => undef,
|
||||
'cusip 12345 037833100' => 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/.*/),
|
||||
|
||||
|
||||
# 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 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
|
||||
'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 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 '@'
|
||||
# these CUSIP ID check digits were calculated by hand
|
||||
# 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#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@01' => test_zci("037833\@01 is a properly formatted CUSIP number.", html => qr/.*/),
|
||||
|
||||
# CUSIP IDs ending in '*', '#', and '@' should not break the IA
|
||||
'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
|
||||
# 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/.*/),
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue