├── .gitignore ├── share └── goodie │ ├── currency_in │ ├── parse.sh │ ├── fetch.sh │ └── README.txt │ ├── teredo │ └── teredo.css │ ├── figlet │ ├── 3d.flf │ ├── 3x5.flf │ ├── b1ff.flf │ ├── bell.flf │ ├── doh.flf │ ├── doom.flf │ ├── epic.flf │ ├── kban.flf │ ├── lcd.flf │ ├── lean.flf │ ├── mike.flf │ ├── mini.flf │ ├── o8.flf │ ├── ogre.flf │ ├── pawp.flf │ ├── stop.flf │ ├── term.flf │ ├── thin.flf │ ├── trek.flf │ ├── wavy.flf │ ├── avatar.flf │ ├── banner.flf │ ├── basic.flf │ ├── binary.flf │ ├── block.flf │ ├── bubble.flf │ ├── chunky.flf │ ├── cosmic.flf │ ├── double.flf │ ├── fender.flf │ ├── fuzzy.flf │ ├── goofy.flf │ ├── gothic.flf │ ├── invita.flf │ ├── italic.flf │ ├── ivrit.flf │ ├── linux.flf │ ├── madrid.flf │ ├── mirror.flf │ ├── morse.flf │ ├── moscow.flf │ ├── nancyj.flf │ ├── peaks.flf │ ├── pepper.flf │ ├── poison.flf │ ├── puffy.flf │ ├── relief.flf │ ├── roman.flf │ ├── rot13.flf │ ├── rozzo.flf │ ├── runic.flf │ ├── runyc.flf │ ├── sblood.flf │ ├── script.flf │ ├── shadow.flf │ ├── short.flf │ ├── slant.flf │ ├── slide.flf │ ├── small.flf │ ├── speed.flf │ ├── tanja.flf │ ├── thick.flf │ ├── ticks.flf │ ├── weird.flf │ ├── acrobatic.flf │ ├── alligator.flf │ ├── alphabet.flf │ ├── banner3.flf │ ├── banner3d.flf │ ├── banner4.flf │ ├── barbwire.flf │ ├── bigchief.flf │ ├── bulbhead.flf │ ├── calgphy2.flf │ ├── catwalk.flf │ ├── coinstak.flf │ ├── colossal.flf │ ├── computer.flf │ ├── contessa.flf │ ├── contrast.flf │ ├── cricket.flf │ ├── diamond.flf │ ├── digital.flf │ ├── dotmatrix.flf │ ├── eftichess.flf │ ├── eftifont.flf │ ├── eftipiti.flf │ ├── eftirobot.flf │ ├── eftitalic.flf │ ├── eftiwall.flf │ ├── eftiwater.flf │ ├── fourtops.flf │ ├── graffiti.flf │ ├── hollywood.flf │ ├── jazmine.flf │ ├── jerusalem.flf │ ├── katakana.flf │ ├── larry3d.flf │ ├── letters.flf │ ├── marquee.flf │ ├── maxfour.flf │ ├── mnemonic.flf │ ├── nipples.flf │ ├── ntgreek.flf │ ├── pebbles.flf │ ├── pyramid.flf │ ├── relief2.flf │ ├── rounded.flf │ ├── rowancap.flf │ ├── serifcap.flf │ ├── slscript.flf │ ├── smisome1.flf │ ├── smscript.flf │ ├── smshadow.flf │ ├── smslant.flf │ ├── smtengwar.flf │ ├── standard.flf │ ├── starwars.flf │ ├── stellar.flf │ ├── straight.flf │ ├── tengwar.flf │ ├── tinkertoy.flf │ ├── tombstone.flf │ ├── tsalagi.flf │ ├── twopoint.flf │ ├── univers.flf │ ├── usaflag.flf │ ├── alligator2.flf │ ├── caligraphy.flf │ ├── cyberlarge.flf │ ├── cybermedium.flf │ ├── cybersmall.flf │ ├── isometric1.flf │ ├── isometric2.flf │ ├── isometric3.flf │ ├── isometric4.flf │ ├── lockergnome.flf │ ├── nancyjfancy.flf │ ├── rectangles.flf │ ├── smkeyboard.flf │ ├── stampatello.flf │ ├── threepoint.flf │ ├── ticksslant.flf │ ├── 5lineoblique.flf │ ├── doubleshorts.flf │ ├── nancyjunderlined.flf │ └── figlet.css │ ├── sha │ └── sha.css │ ├── ultimate_answer │ └── ultimate_answer.css │ ├── valar_morghulis │ └── valar_morghulis.css │ ├── unicornify │ └── unicornify.css │ ├── coin │ └── coin.css │ ├── bash_primary_expressions │ └── bash_primary_expressions.css │ ├── vim_cheat_sheet │ ├── fetch.sh │ ├── README.txt │ ├── template.tx │ └── vim_cheat_sheet.css │ ├── dice │ └── dice.css │ ├── calculator │ └── calculator.css │ ├── conversions │ └── conversions.css │ ├── convert_lat_lon │ └── convert_lat_lon.css │ ├── hex_to_dec │ └── hex_to_dec.css │ ├── htmlentities_encode │ └── htmlentities_encode.css │ ├── lowercase │ └── lowercase.css │ ├── uppercase │ └── uppercase.css │ ├── urlencode │ └── urlencode.css │ ├── average │ └── average.css │ ├── color_codes │ └── color_codes.css │ ├── latex │ └── latex.css │ ├── htmlentities_decode │ └── htmlentities_decode.css │ ├── md5 │ └── md5.css │ ├── private_network │ ├── private_network.css │ └── private_network.txt │ ├── anagram │ ├── anagram.css │ └── prune_words.pl │ ├── chinese_zodiac │ └── chinese_zodiac.css │ ├── weekdays_between │ └── weekdays_between.css │ ├── blood_donor │ └── blood_donor.css │ ├── reverse_complement │ └── reverse_complement.css │ ├── resistor_colors │ └── resistor_colors.css │ ├── js_keycodes │ ├── footer.txt │ └── header.txt │ ├── calendar_today │ └── calendar_today.css │ ├── public_dns │ ├── public_dns.css │ └── providers.yml │ ├── regex_cheat_sheet │ └── regex_cheat_sheet.css │ ├── sudoku │ └── sudoku.css │ ├── find_anagrams │ └── generate_word_json.pl │ └── crontab_cheat_sheet │ └── crontab_cheat_sheet.txt ├── lib └── DDG │ ├── GoodieBundle │ └── OpenSourceDuckDuckGo.pm │ └── Goodie │ ├── Braille.pm │ ├── Ascii.pm │ ├── Factors.pm │ ├── Rot13.pm │ ├── Rafl.pm │ ├── PigLatin.pm │ ├── Unidecode.pm │ ├── ValarMorghulis.pm │ ├── PrivateNetwork.pm │ ├── Fortune.pm │ ├── Morse.pm │ ├── FlipText.pm │ ├── Reverse.pm │ ├── MakeMeASandwich.pm │ ├── LaserShip.pm │ ├── UltimateAnswer.pm │ ├── Roman.pm │ ├── Randagram.pm │ ├── ZappBrannigan.pm │ ├── WhereAmI.pm │ ├── Lowercase.pm │ ├── GreatestCommonFactor.pm │ ├── Unicornify.pm │ ├── GenerateMAC.pm │ ├── BirthStone.pm │ ├── RandomName.pm │ ├── Regexp.pm │ ├── Coin.pm │ ├── Palindrome.pm │ ├── Tips.pm │ ├── UnixTime.pm │ ├── AspectRatio.pm │ ├── UN.pm │ ├── GUID.pm │ ├── GoldenRatio.pm │ ├── Base.pm │ ├── EmToPx.pm │ ├── Base64.pm │ ├── PercentError.pm │ ├── Uppercase.pm │ ├── Atbash.pm │ ├── ISO639.pm │ ├── HKDK.pm │ ├── Fibonacci.pm │ ├── HexToDec.pm │ ├── LeetSpeak.pm │ ├── Frequency.pm │ ├── GimpCheatSheet.pm │ ├── IPS.pm │ ├── URLEncode.pm │ └── TitleCase.pm ├── template ├── t │ └── Example.t └── lib │ └── DDG │ └── Goodie │ └── Example.pm ├── weaver.ini ├── t ├── Randagram.t ├── ZappBrannigan.t ├── Unidecode.t ├── Password.t ├── Rot13.t ├── Rafl.t ├── RandomNumber.t ├── PigLatin.t ├── Base64.t ├── ValarMorghulis.t ├── Fortune.t ├── Factors.t ├── UltimateAnswer.t ├── AspectRatio.t ├── FlipText.t ├── RandomName.t ├── BirthStone.t ├── Uppercase.t ├── WhereAmI.t ├── Fibonacci.t ├── EmToPx.t ├── LeetSpeak.t ├── Braille.t ├── Reverse.t ├── Atbash.t ├── TitleCase.t ├── CalcRoots.t ├── Tips.t ├── PublicDNS.t ├── LaserShip.t ├── Regexp.t ├── MakeMeASandwich.t ├── NLetterWords.t ├── Phonetic.t ├── ParseCron.t ├── HKDK.t ├── IDN.t ├── Sort.t ├── Teredo.t ├── USPS.t ├── SigFigs.t ├── GimpCheatSheet.t ├── CurrencyIn.t ├── Ascii.t ├── Unicornify.t ├── Latex.t ├── Paper.t ├── UnixTime.t ├── Roman.t ├── Morse.t ├── Palindrome.t ├── Chess960.t ├── SumOfNaturalNumbers.t ├── Sudoku.t ├── Base.t ├── Lowercase.t ├── MoonPhases.t ├── PrivateNetwork.t ├── DHL.t ├── EmailValidator.t ├── MD5.t ├── Parcelforce.t ├── IPS.t ├── ISO639.t ├── VimCheatSheet.t ├── Shortcut.t ├── PrimeFactors.t ├── Frequency.t ├── Average.t ├── LeapYear.t ├── HexToASCII.t ├── ABC.t ├── BloodDonor.t ├── Coin.t ├── GreatestCommonFactor.t ├── GenerateMAC.t ├── HexToDec.t ├── SubnetCalc.t ├── Anagram.t ├── VIN.t ├── GUID.t ├── Jira.t ├── DaysBetween.t ├── FedEx.t └── GoldenRatio.t ├── README.md └── .travis.yml /.gitignore: -------------------------------------------------------------------------------- 1 | DDG-* 2 | .build 3 | *.sw* 4 | *~ 5 | -------------------------------------------------------------------------------- /share/goodie/currency_in/parse.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Make currency.txt: 4 | python parse.py 5 | 6 | -------------------------------------------------------------------------------- /share/goodie/teredo/teredo.css: -------------------------------------------------------------------------------- 1 | .zci--answer .teredo__label { 2 | display: inline-block; 3 | min-width: 130px 4 | } -------------------------------------------------------------------------------- /share/goodie/figlet/3d.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/3d.flf -------------------------------------------------------------------------------- /share/goodie/figlet/3x5.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/3x5.flf -------------------------------------------------------------------------------- /share/goodie/figlet/b1ff.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/b1ff.flf -------------------------------------------------------------------------------- /share/goodie/figlet/bell.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/bell.flf -------------------------------------------------------------------------------- /share/goodie/figlet/doh.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/doh.flf -------------------------------------------------------------------------------- /share/goodie/figlet/doom.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/doom.flf -------------------------------------------------------------------------------- /share/goodie/figlet/epic.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/epic.flf -------------------------------------------------------------------------------- /share/goodie/figlet/kban.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/kban.flf -------------------------------------------------------------------------------- /share/goodie/figlet/lcd.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/lcd.flf -------------------------------------------------------------------------------- /share/goodie/figlet/lean.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/lean.flf -------------------------------------------------------------------------------- /share/goodie/figlet/mike.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/mike.flf -------------------------------------------------------------------------------- /share/goodie/figlet/mini.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/mini.flf -------------------------------------------------------------------------------- /share/goodie/figlet/o8.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/o8.flf -------------------------------------------------------------------------------- /share/goodie/figlet/ogre.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/ogre.flf -------------------------------------------------------------------------------- /share/goodie/figlet/pawp.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/pawp.flf -------------------------------------------------------------------------------- /share/goodie/figlet/stop.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/stop.flf -------------------------------------------------------------------------------- /share/goodie/figlet/term.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/term.flf -------------------------------------------------------------------------------- /share/goodie/figlet/thin.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/thin.flf -------------------------------------------------------------------------------- /share/goodie/figlet/trek.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/trek.flf -------------------------------------------------------------------------------- /share/goodie/figlet/wavy.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/wavy.flf -------------------------------------------------------------------------------- /share/goodie/figlet/avatar.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/avatar.flf -------------------------------------------------------------------------------- /share/goodie/figlet/banner.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/banner.flf -------------------------------------------------------------------------------- /share/goodie/figlet/basic.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/basic.flf -------------------------------------------------------------------------------- /share/goodie/figlet/binary.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/binary.flf -------------------------------------------------------------------------------- /share/goodie/figlet/block.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/block.flf -------------------------------------------------------------------------------- /share/goodie/figlet/bubble.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/bubble.flf -------------------------------------------------------------------------------- /share/goodie/figlet/chunky.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/chunky.flf -------------------------------------------------------------------------------- /share/goodie/figlet/cosmic.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/cosmic.flf -------------------------------------------------------------------------------- /share/goodie/figlet/double.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/double.flf -------------------------------------------------------------------------------- /share/goodie/figlet/fender.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/fender.flf -------------------------------------------------------------------------------- /share/goodie/figlet/fuzzy.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/fuzzy.flf -------------------------------------------------------------------------------- /share/goodie/figlet/goofy.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/goofy.flf -------------------------------------------------------------------------------- /share/goodie/figlet/gothic.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/gothic.flf -------------------------------------------------------------------------------- /share/goodie/figlet/invita.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/invita.flf -------------------------------------------------------------------------------- /share/goodie/figlet/italic.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/italic.flf -------------------------------------------------------------------------------- /share/goodie/figlet/ivrit.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/ivrit.flf -------------------------------------------------------------------------------- /share/goodie/figlet/linux.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/linux.flf -------------------------------------------------------------------------------- /share/goodie/figlet/madrid.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/madrid.flf -------------------------------------------------------------------------------- /share/goodie/figlet/mirror.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/mirror.flf -------------------------------------------------------------------------------- /share/goodie/figlet/morse.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/morse.flf -------------------------------------------------------------------------------- /share/goodie/figlet/moscow.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/moscow.flf -------------------------------------------------------------------------------- /share/goodie/figlet/nancyj.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/nancyj.flf -------------------------------------------------------------------------------- /share/goodie/figlet/peaks.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/peaks.flf -------------------------------------------------------------------------------- /share/goodie/figlet/pepper.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/pepper.flf -------------------------------------------------------------------------------- /share/goodie/figlet/poison.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/poison.flf -------------------------------------------------------------------------------- /share/goodie/figlet/puffy.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/puffy.flf -------------------------------------------------------------------------------- /share/goodie/figlet/relief.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/relief.flf -------------------------------------------------------------------------------- /share/goodie/figlet/roman.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/roman.flf -------------------------------------------------------------------------------- /share/goodie/figlet/rot13.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/rot13.flf -------------------------------------------------------------------------------- /share/goodie/figlet/rozzo.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/rozzo.flf -------------------------------------------------------------------------------- /share/goodie/figlet/runic.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/runic.flf -------------------------------------------------------------------------------- /share/goodie/figlet/runyc.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/runyc.flf -------------------------------------------------------------------------------- /share/goodie/figlet/sblood.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/sblood.flf -------------------------------------------------------------------------------- /share/goodie/figlet/script.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/script.flf -------------------------------------------------------------------------------- /share/goodie/figlet/shadow.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/shadow.flf -------------------------------------------------------------------------------- /share/goodie/figlet/short.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/short.flf -------------------------------------------------------------------------------- /share/goodie/figlet/slant.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/slant.flf -------------------------------------------------------------------------------- /share/goodie/figlet/slide.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/slide.flf -------------------------------------------------------------------------------- /share/goodie/figlet/small.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/small.flf -------------------------------------------------------------------------------- /share/goodie/figlet/speed.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/speed.flf -------------------------------------------------------------------------------- /share/goodie/figlet/tanja.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/tanja.flf -------------------------------------------------------------------------------- /share/goodie/figlet/thick.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/thick.flf -------------------------------------------------------------------------------- /share/goodie/figlet/ticks.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/ticks.flf -------------------------------------------------------------------------------- /share/goodie/figlet/weird.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/weird.flf -------------------------------------------------------------------------------- /share/goodie/figlet/acrobatic.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/acrobatic.flf -------------------------------------------------------------------------------- /share/goodie/figlet/alligator.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/alligator.flf -------------------------------------------------------------------------------- /share/goodie/figlet/alphabet.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/alphabet.flf -------------------------------------------------------------------------------- /share/goodie/figlet/banner3.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/banner3.flf -------------------------------------------------------------------------------- /share/goodie/figlet/banner3d.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/banner3d.flf -------------------------------------------------------------------------------- /share/goodie/figlet/banner4.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/banner4.flf -------------------------------------------------------------------------------- /share/goodie/figlet/barbwire.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/barbwire.flf -------------------------------------------------------------------------------- /share/goodie/figlet/bigchief.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/bigchief.flf -------------------------------------------------------------------------------- /share/goodie/figlet/bulbhead.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/bulbhead.flf -------------------------------------------------------------------------------- /share/goodie/figlet/calgphy2.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/calgphy2.flf -------------------------------------------------------------------------------- /share/goodie/figlet/catwalk.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/catwalk.flf -------------------------------------------------------------------------------- /share/goodie/figlet/coinstak.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/coinstak.flf -------------------------------------------------------------------------------- /share/goodie/figlet/colossal.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/colossal.flf -------------------------------------------------------------------------------- /share/goodie/figlet/computer.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/computer.flf -------------------------------------------------------------------------------- /share/goodie/figlet/contessa.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/contessa.flf -------------------------------------------------------------------------------- /share/goodie/figlet/contrast.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/contrast.flf -------------------------------------------------------------------------------- /share/goodie/figlet/cricket.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/cricket.flf -------------------------------------------------------------------------------- /share/goodie/figlet/diamond.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/diamond.flf -------------------------------------------------------------------------------- /share/goodie/figlet/digital.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/digital.flf -------------------------------------------------------------------------------- /share/goodie/figlet/dotmatrix.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/dotmatrix.flf -------------------------------------------------------------------------------- /share/goodie/figlet/eftichess.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/eftichess.flf -------------------------------------------------------------------------------- /share/goodie/figlet/eftifont.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/eftifont.flf -------------------------------------------------------------------------------- /share/goodie/figlet/eftipiti.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/eftipiti.flf -------------------------------------------------------------------------------- /share/goodie/figlet/eftirobot.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/eftirobot.flf -------------------------------------------------------------------------------- /share/goodie/figlet/eftitalic.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/eftitalic.flf -------------------------------------------------------------------------------- /share/goodie/figlet/eftiwall.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/eftiwall.flf -------------------------------------------------------------------------------- /share/goodie/figlet/eftiwater.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/eftiwater.flf -------------------------------------------------------------------------------- /share/goodie/figlet/fourtops.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/fourtops.flf -------------------------------------------------------------------------------- /share/goodie/figlet/graffiti.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/graffiti.flf -------------------------------------------------------------------------------- /share/goodie/figlet/hollywood.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/hollywood.flf -------------------------------------------------------------------------------- /share/goodie/figlet/jazmine.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/jazmine.flf -------------------------------------------------------------------------------- /share/goodie/figlet/jerusalem.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/jerusalem.flf -------------------------------------------------------------------------------- /share/goodie/figlet/katakana.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/katakana.flf -------------------------------------------------------------------------------- /share/goodie/figlet/larry3d.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/larry3d.flf -------------------------------------------------------------------------------- /share/goodie/figlet/letters.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/letters.flf -------------------------------------------------------------------------------- /share/goodie/figlet/marquee.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/marquee.flf -------------------------------------------------------------------------------- /share/goodie/figlet/maxfour.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/maxfour.flf -------------------------------------------------------------------------------- /share/goodie/figlet/mnemonic.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/mnemonic.flf -------------------------------------------------------------------------------- /share/goodie/figlet/nipples.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/nipples.flf -------------------------------------------------------------------------------- /share/goodie/figlet/ntgreek.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/ntgreek.flf -------------------------------------------------------------------------------- /share/goodie/figlet/pebbles.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/pebbles.flf -------------------------------------------------------------------------------- /share/goodie/figlet/pyramid.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/pyramid.flf -------------------------------------------------------------------------------- /share/goodie/figlet/relief2.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/relief2.flf -------------------------------------------------------------------------------- /share/goodie/figlet/rounded.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/rounded.flf -------------------------------------------------------------------------------- /share/goodie/figlet/rowancap.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/rowancap.flf -------------------------------------------------------------------------------- /share/goodie/figlet/serifcap.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/serifcap.flf -------------------------------------------------------------------------------- /share/goodie/figlet/slscript.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/slscript.flf -------------------------------------------------------------------------------- /share/goodie/figlet/smisome1.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/smisome1.flf -------------------------------------------------------------------------------- /share/goodie/figlet/smscript.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/smscript.flf -------------------------------------------------------------------------------- /share/goodie/figlet/smshadow.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/smshadow.flf -------------------------------------------------------------------------------- /share/goodie/figlet/smslant.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/smslant.flf -------------------------------------------------------------------------------- /share/goodie/figlet/smtengwar.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/smtengwar.flf -------------------------------------------------------------------------------- /share/goodie/figlet/standard.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/standard.flf -------------------------------------------------------------------------------- /share/goodie/figlet/starwars.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/starwars.flf -------------------------------------------------------------------------------- /share/goodie/figlet/stellar.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/stellar.flf -------------------------------------------------------------------------------- /share/goodie/figlet/straight.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/straight.flf -------------------------------------------------------------------------------- /share/goodie/figlet/tengwar.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/tengwar.flf -------------------------------------------------------------------------------- /share/goodie/figlet/tinkertoy.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/tinkertoy.flf -------------------------------------------------------------------------------- /share/goodie/figlet/tombstone.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/tombstone.flf -------------------------------------------------------------------------------- /share/goodie/figlet/tsalagi.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/tsalagi.flf -------------------------------------------------------------------------------- /share/goodie/figlet/twopoint.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/twopoint.flf -------------------------------------------------------------------------------- /share/goodie/figlet/univers.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/univers.flf -------------------------------------------------------------------------------- /share/goodie/figlet/usaflag.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/usaflag.flf -------------------------------------------------------------------------------- /share/goodie/figlet/alligator2.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/alligator2.flf -------------------------------------------------------------------------------- /share/goodie/figlet/caligraphy.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/caligraphy.flf -------------------------------------------------------------------------------- /share/goodie/figlet/cyberlarge.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/cyberlarge.flf -------------------------------------------------------------------------------- /share/goodie/figlet/cybermedium.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/cybermedium.flf -------------------------------------------------------------------------------- /share/goodie/figlet/cybersmall.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/cybersmall.flf -------------------------------------------------------------------------------- /share/goodie/figlet/isometric1.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/isometric1.flf -------------------------------------------------------------------------------- /share/goodie/figlet/isometric2.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/isometric2.flf -------------------------------------------------------------------------------- /share/goodie/figlet/isometric3.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/isometric3.flf -------------------------------------------------------------------------------- /share/goodie/figlet/isometric4.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/isometric4.flf -------------------------------------------------------------------------------- /share/goodie/figlet/lockergnome.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/lockergnome.flf -------------------------------------------------------------------------------- /share/goodie/figlet/nancyjfancy.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/nancyjfancy.flf -------------------------------------------------------------------------------- /share/goodie/figlet/rectangles.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/rectangles.flf -------------------------------------------------------------------------------- /share/goodie/figlet/smkeyboard.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/smkeyboard.flf -------------------------------------------------------------------------------- /share/goodie/figlet/stampatello.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/stampatello.flf -------------------------------------------------------------------------------- /share/goodie/figlet/threepoint.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/threepoint.flf -------------------------------------------------------------------------------- /share/goodie/figlet/ticksslant.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/ticksslant.flf -------------------------------------------------------------------------------- /share/goodie/sha/sha.css: -------------------------------------------------------------------------------- 1 | .zci--answer .zci--sha { 2 | font-weight: 300; 3 | padding: .25em 0; 4 | word-wrap: break-word; 5 | } 6 | -------------------------------------------------------------------------------- /share/goodie/ultimate_answer/ultimate_answer.css: -------------------------------------------------------------------------------- 1 | .zci--answer .zci--ultanswer { 2 | font-weight: 400; 3 | font-size: 1.5em; 4 | } 5 | -------------------------------------------------------------------------------- /share/goodie/valar_morghulis/valar_morghulis.css: -------------------------------------------------------------------------------- 1 | .zci--answer .zci--valarmorg { 2 | font-weight: 400; 3 | font-size: 1.5em; 4 | } 5 | -------------------------------------------------------------------------------- /share/goodie/figlet/5lineoblique.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/5lineoblique.flf -------------------------------------------------------------------------------- /share/goodie/figlet/doubleshorts.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/doubleshorts.flf -------------------------------------------------------------------------------- /share/goodie/unicornify/unicornify.css: -------------------------------------------------------------------------------- 1 | .zci--answer .zci--unicornify-img { 2 | margin: 10px 0px 10px 20px; 3 | border-radius: 8px; 4 | } 5 | -------------------------------------------------------------------------------- /share/goodie/figlet/nancyjunderlined.flf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duckduckhack/zeroclickinfo-goodies/master/share/goodie/figlet/nancyjunderlined.flf -------------------------------------------------------------------------------- /share/goodie/coin/coin.css: -------------------------------------------------------------------------------- 1 | .zci--answer .zci__body, .zero_click_answer { 2 | padding-top: 0.5em; 3 | padding-bottom: 0.5em; 4 | font-size: 1.4em; 5 | } -------------------------------------------------------------------------------- /share/goodie/currency_in/fetch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | mkdir -p download 3 | wget "http://en.wikipedia.org/wiki/List_of_circulating_currencies" -O download/page.dat 4 | -------------------------------------------------------------------------------- /share/goodie/bash_primary_expressions/bash_primary_expressions.css: -------------------------------------------------------------------------------- 1 | .zci--answer .zci__body pre { 2 | padding: 0; 3 | margin-right: 0; 4 | display: inline; 5 | } -------------------------------------------------------------------------------- /share/goodie/vim_cheat_sheet/fetch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | mkdir -p download 3 | wget "http://raw2.github.com/rtorr/vim-cheat-sheet/develop/app/index.html" -O download/vimcheat.html 4 | -------------------------------------------------------------------------------- /share/goodie/dice/dice.css: -------------------------------------------------------------------------------- 1 | .zci--answer .zci--dice-die { 2 | font-size: 2em; 3 | } 4 | 5 | .zci--answer .zci--dice-sum { 6 | font-size: 2em; 7 | white-space: nowrap; 8 | } 9 | -------------------------------------------------------------------------------- /share/goodie/calculator/calculator.css: -------------------------------------------------------------------------------- 1 | .zci--answer .zci--calculator { 2 | font-size: 1.5em; 3 | font-weight: 300; 4 | padding-top: .25em; 5 | padding-bottom: .25em; 6 | } 7 | -------------------------------------------------------------------------------- /share/goodie/conversions/conversions.css: -------------------------------------------------------------------------------- 1 | .zci--answer .zci--conversions { 2 | font-size: 1.5em; 3 | font-weight: 300; 4 | padding-top: .25em; 5 | padding-bottom: .25em; 6 | } -------------------------------------------------------------------------------- /share/goodie/convert_lat_lon/convert_lat_lon.css: -------------------------------------------------------------------------------- 1 | .zci--answer .zci--conversions { 2 | font-size: 1.5em; 3 | font-weight: 300; 4 | padding-top: .25em; 5 | padding-bottom: .25em; 6 | } 7 | -------------------------------------------------------------------------------- /share/goodie/hex_to_dec/hex_to_dec.css: -------------------------------------------------------------------------------- 1 | .zci--answer .zci--hextodec { 2 | font-weight: 300; 3 | word-break: break-word; 4 | } 5 | .zci--answer .zci--hextodec .hextodec--decimal { 6 | font-size: 1.7em; 7 | } 8 | -------------------------------------------------------------------------------- /share/goodie/htmlentities_encode/htmlentities_encode.css: -------------------------------------------------------------------------------- 1 | .zci--answer .zci--htmlentitiesencode { 2 | padding-top: 0.25em; 3 | padding-bottom: 0.25em; 4 | font-weight: 300; 5 | font-size: 1.5em; 6 | } 7 | -------------------------------------------------------------------------------- /share/goodie/lowercase/lowercase.css: -------------------------------------------------------------------------------- 1 | .zci--answer .zci--lowercase { 2 | padding-top: 0.25em; 3 | padding-bottom: 0.25em; 4 | font-weight: 300; 5 | font-size: 1.75em; 6 | word-wrap:break-word; 7 | } 8 | -------------------------------------------------------------------------------- /share/goodie/uppercase/uppercase.css: -------------------------------------------------------------------------------- 1 | .zci--answer .zci--uppercase { 2 | padding-top: 0.25em; 3 | padding-bottom: 0.25em; 4 | font-weight: 300; 5 | font-size: 1.75em; 6 | word-wrap:break-word; 7 | } 8 | -------------------------------------------------------------------------------- /share/goodie/urlencode/urlencode.css: -------------------------------------------------------------------------------- 1 | .zci--answer .zci--urlencode { 2 | padding-top: 0.25em; 3 | padding-bottom: 0.25em; 4 | font-weight: 300; 5 | font-size: 1.5em; 6 | word-wrap:break-word; 7 | } 8 | -------------------------------------------------------------------------------- /lib/DDG/GoodieBundle/OpenSourceDuckDuckGo.pm: -------------------------------------------------------------------------------- 1 | package DDG::GoodieBundle::OpenSourceDuckDuckGo; 2 | # ABSTRACT: The open source Goodie Bundle of DuckDuckGo 3 | 4 | # This package is only a namespace/version holder 5 | 6 | 1; 7 | -------------------------------------------------------------------------------- /share/goodie/average/average.css: -------------------------------------------------------------------------------- 1 | .zci--answer .average--container { 2 | font-size: 1.2em; 3 | } 4 | 5 | .zci--answer .average--key { 6 | font-weight: 300; 7 | } 8 | 9 | .zci--answer .average--value { 10 | font-weight: 500; 11 | } -------------------------------------------------------------------------------- /share/goodie/color_codes/color_codes.css: -------------------------------------------------------------------------------- 1 | .zci--answer .zci--color-codes .colorcodesbox { 2 | border: 2px solid #999; 3 | height: 30px; 4 | width: 30px; 5 | margin: 5px; 6 | margin-right: 10px; 7 | margin-top: 3px; 8 | float: left; 9 | } 10 | -------------------------------------------------------------------------------- /share/goodie/latex/latex.css: -------------------------------------------------------------------------------- 1 | .zci--answer .latex--key { 2 | color: #777; 3 | } 4 | 5 | .zci--answer .latex--value { 6 | color: #292929; 7 | } 8 | 9 | .zci--answer .zci__body, .zero_click_answer { 10 | padding-top: 0.5em; 11 | padding-bottom: 0.5em; 12 | } -------------------------------------------------------------------------------- /share/goodie/htmlentities_decode/htmlentities_decode.css: -------------------------------------------------------------------------------- 1 | .zci--answer .zci--htmlentitiesdecode { 2 | padding-top: 0.25em; 3 | padding-bottom: 0.25em; 4 | } 5 | 6 | .zci--answer .zci--htmlentitiesdecode .large { 7 | font-size: 1.5em; 8 | font-weight: 300; 9 | } 10 | -------------------------------------------------------------------------------- /share/goodie/md5/md5.css: -------------------------------------------------------------------------------- 1 | .zci--answer .zci--md5 { 2 | font-weight: 300; 3 | padding: .25em 0; 4 | } 5 | 6 | .zci--md5 .text--primary { 7 | font-size: 1.5em; 8 | word-wrap: break-word; 9 | } 10 | 11 | .zci--md5 .text--secondary { 12 | font-size: 1.1em; 13 | } 14 | -------------------------------------------------------------------------------- /template/t/Example.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | ddg_goodie_test( 9 | [qw( 10 | DDG::Goodie::<: $ia_name :> 11 | )], 12 | 'example query' => test_zci('query') 13 | ); 14 | 15 | done_testing; 16 | -------------------------------------------------------------------------------- /share/goodie/private_network/private_network.css: -------------------------------------------------------------------------------- 1 | .zci--answer .private_network .record__cell__key { 2 | padding: 0.4em; 3 | } 4 | 5 | .zci--answer .private_network .record__cell__value { 6 | padding: 0.4em; 7 | } 8 | 9 | .zci--answer .private_network p { 10 | padding: 0; 11 | } -------------------------------------------------------------------------------- /share/goodie/anagram/anagram.css: -------------------------------------------------------------------------------- 1 | .zci--answer .zci--anagrams { 2 | font-weight: 300; 3 | padding: .25em 0; 4 | } 5 | 6 | .zci--anagrams .text--primary { 7 | font-size: 1.5em; 8 | } 9 | 10 | .zci--anagrams .text--secondary { 11 | font-weight: 400; 12 | font-size: 1.1em; 13 | } 14 | -------------------------------------------------------------------------------- /share/goodie/chinese_zodiac/chinese_zodiac.css: -------------------------------------------------------------------------------- 1 | .zci--answer .zci--chinesezodiac { 2 | padding-top: .25em; 3 | padding-bottom: .25em; 4 | } 5 | 6 | .zci--answer .zci--chinesezodiac .zodiaccharacter { 7 | font-size: 1.7em; 8 | } 9 | 10 | .zci--answer .zci--chinesezodiac .statement { 11 | color: #747474; 12 | } 13 | -------------------------------------------------------------------------------- /share/goodie/weekdays_between/weekdays_between.css: -------------------------------------------------------------------------------- 1 | .zci--answer .zci--weekdaysbetween { 2 | font-weight: 300; 3 | padding: .25em 0; 4 | } 5 | 6 | .zci--weekdaysbetween .text--primary { 7 | font-size: 1.7em; 8 | } 9 | 10 | .zci--weekdaysbetween .text--secondary { 11 | font-weight: 400; 12 | font-size: 1.0em; 13 | } 14 | -------------------------------------------------------------------------------- /share/goodie/blood_donor/blood_donor.css: -------------------------------------------------------------------------------- 1 | .zci--answer .blooddonor 2 | { 3 | font-size: 1.1em; 4 | line-height: 1.5em; 5 | } 6 | 7 | .zci--answer .blooddonor .text--secondary 8 | { 9 | padding-right: 1em; 10 | } 11 | 12 | .zci--answer .blooddonor tr 13 | { 14 | border-top: 1px solid rgba(155,155,155,.15); 15 | } 16 | 17 | .zci--answer .blooddonor tr:nth-of-type(1) 18 | { 19 | border-top: 0px; 20 | } -------------------------------------------------------------------------------- /share/goodie/anagram/prune_words.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | # It would be nice to automate mapping accented letters to "standard" 4 | # letters as well to speed up word file transformation, but for now 5 | # this simply removes apostrophized words. 6 | 7 | open INF, "<", $ARGV[0] or die $!; 8 | open OUTF, ">", "foobitybaz" or die $!; 9 | 10 | while () { 11 | print OUTF unless /'/; 12 | } 13 | 14 | 1; 15 | -------------------------------------------------------------------------------- /share/goodie/reverse_complement/reverse_complement.css: -------------------------------------------------------------------------------- 1 | .zci--answer .zci--reversecomplement { 2 | font-weight: 300; 3 | padding-top: .25em; 4 | padding-bottom: .25em; 5 | } 6 | 7 | .zci--answer .zci--reversecomplement .label { 8 | font-size: 1.1em; 9 | color: #808080; 10 | } 11 | 12 | .zci--answer .zci--reversecomplement .sequence { 13 | font-size: 1.5em; 14 | word-wrap: break-word; 15 | } 16 | -------------------------------------------------------------------------------- /share/goodie/resistor_colors/resistor_colors.css: -------------------------------------------------------------------------------- 1 | .zci--answer .zci--resistor-colors .resistor { 2 | margin-right: 4px; 3 | } 4 | 5 | .zci--answer .zci--resistor-colors .colors { 6 | display: inline-block; 7 | border: 1px solid #c8c8c8; 8 | margin-top: -1px; 9 | padding: 0px 5px 3px; 10 | border-radius: 4px; 11 | } 12 | 13 | .zci--answer .zci--resistor-colors .link { 14 | font-size: 92.8%; 15 | } 16 | -------------------------------------------------------------------------------- /weaver.ini: -------------------------------------------------------------------------------- 1 | [@CorePrep] 2 | 3 | [Name] 4 | [Version] 5 | 6 | [Region / prelude] 7 | 8 | [Generic / SYNOPSIS] 9 | [Generic / DESCRIPTION] 10 | [Generic / OVERVIEW] 11 | 12 | [Collect / EXPORTS FUNCTIONS] 13 | command = keyword 14 | 15 | [Collect / ATTRIBUTES] 16 | command = attr 17 | 18 | [Collect / METHODS] 19 | command = method 20 | 21 | [Leftovers] 22 | 23 | [Region / postlude] 24 | 25 | [Authors] 26 | 27 | [Legal] 28 | 29 | -------------------------------------------------------------------------------- /t/Randagram.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'randagram'; 9 | zci is_cached => 0; 10 | 11 | ddg_goodie_test( 12 | [qw(DDG::Goodie::Randagram)], 13 | 'randagram algorithm' => test_zci(qr/Randagram of "algorithm": [algorithm]/), 14 | 'randagram jazz hands' => test_zci(qr/Randagram of "jazz hands": [jazz hands]/), 15 | ); 16 | 17 | done_testing; 18 | -------------------------------------------------------------------------------- /t/ZappBrannigan.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci is_cached => 0; 9 | zci answer_type => 'zappbrannigan'; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::ZappBrannigan 14 | )], 15 | 'zapp brannigan quote' => test_zci( 16 | qr/Zapp Brannigan: /, 17 | html => qr/Zapp Brannigan: /), 18 | ); 19 | 20 | done_testing; 21 | -------------------------------------------------------------------------------- /t/Unidecode.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | use utf8; 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'convert_to_ascii'; 9 | zci is_cached => 1; 10 | 11 | 12 | ddg_goodie_test( 13 | [qw( 14 | DDG::Goodie::Unidecode 15 | )], 16 | 'unidecode møæp' => test_zci('moaep'), 17 | "unidecode \x{5317}\x{4EB0}" => test_zci('Bei Jing'), 18 | 'unidecode å亰' => test_zci('aaodeg'), 19 | ); 20 | 21 | done_testing; 22 | 23 | -------------------------------------------------------------------------------- /share/goodie/js_keycodes/footer.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 20 | 21 | -------------------------------------------------------------------------------- /t/Password.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'pw'; 9 | zci is_cached => 0; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::Password 14 | )], 15 | 'password weak 5' => test_zci( qr/.{5} \(random password\)/), 16 | 'password 15 average' => test_zci( qr/.{15} \(random password\)/), 17 | 'password strong 25' => test_zci( qr/.{25} \(random password\)/) 18 | ); 19 | done_testing 20 | -------------------------------------------------------------------------------- /t/Rot13.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'rot13'; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::Rot13 14 | )], 15 | 'rot13 This is a test' => test_zci('ROT13: Guvf vf n grfg'), 16 | 'rot13 thirteen' => test_zci('ROT13: guvegrra'), 17 | 'rot13 guvegrra' => test_zci('ROT13: thirteen'), 18 | ); 19 | 20 | done_testing; 21 | -------------------------------------------------------------------------------- /share/goodie/vim_cheat_sheet/README.txt: -------------------------------------------------------------------------------- 1 | SYNOPSIS 2 | 3 | fetch.sh 4 | parser.pl 5 | 6 | 7 | DESCRIPTION 8 | 9 | fetch.sh downloads the cheat sheet data from 10 | https://github.com/rtorr/vim-cheat-sheet 11 | 12 | parser.pl parses the html retrieved by fetch.sh and generates 13 | vim_cheat_sheet.html and vim_cheat_sheet.txt which are used by 14 | DDG::Goodie::VimCheatSheet. 15 | 16 | 17 | REQUIREMENTS 18 | 19 | Text::Xslate v3.1.0 20 | JSON v2.90 21 | Web::Scraper v0.37 22 | 23 | 24 | -------------------------------------------------------------------------------- /t/Rafl.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'rafl'; 9 | zci is_cached => 0; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::Rafl 14 | )], 15 | 'rafl' => test_zci(qr/rafl is so everywhere, .+/), 16 | 'rafl is everywhere' => test_zci(qr/rafl is so everywhere, .+/), 17 | 'where is rafl?' => test_zci(qr/rafl is so everywhere, .+/), 18 | ); 19 | 20 | done_testing; 21 | -------------------------------------------------------------------------------- /t/RandomNumber.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'rand'; 9 | zci is_cached => 0; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::RandomNumber 14 | )], 15 | 'random number between 12 and 45' => test_zci( qr/\d{2} \(random number\)/), 16 | 'random number' => test_zci( qr/\d{1}\.\d+ \(random number\)/), 17 | 'random day' => undef, 18 | 'random access' => undef, 19 | ); 20 | done_testing 21 | -------------------------------------------------------------------------------- /share/goodie/calendar_today/calendar_today.css: -------------------------------------------------------------------------------- 1 | .zci--answer table.calendar { 2 | text-align: center; 3 | } 4 | 5 | .zci--answer .calendar th, .calendar td { 6 | width: 2.5em; 7 | text-align: center; 8 | } 9 | 10 | .zci--answer .calendar__header { 11 | vertical-align: top; 12 | height: 2em; 13 | font-size: 1.25em; 14 | } 15 | 16 | .zci--answer .calendar__today { 17 | color: white; 18 | background-color: #808080; 19 | } 20 | 21 | .zci--answer .calendar .circle{ 22 | padding-left: 0.25em; 23 | padding-right: 0.25em; 24 | } -------------------------------------------------------------------------------- /share/goodie/public_dns/public_dns.css: -------------------------------------------------------------------------------- 1 | .zci--answer table.publicdns { 2 | font-family: Consolas,"Anonymous Pro",Anonymous,"Courier New",monospace; 3 | font-size: 12px; 4 | line-height: 14px; 5 | } 6 | 7 | .zci--answer table.publicdns td { 8 | white-space: nowrap; 9 | padding: 4px 30px 4px 10px; 10 | border: 0px; 11 | } 12 | 13 | .zci--answer table.publicdns th { 14 | font-weight: bold; 15 | text-align: left; 16 | background-color: #aaa; 17 | color: #fff; 18 | border: 0px; 19 | padding: 4px 10px; 20 | } 21 | -------------------------------------------------------------------------------- /share/goodie/regex_cheat_sheet/regex_cheat_sheet.css: -------------------------------------------------------------------------------- 1 | .zci--answer .regex-container { 2 | max-height: 45ex; 3 | overflow-y: scroll; 4 | overflow-x: hidden; 5 | } 6 | 7 | .zci--answer .regex-container .regex-column { 8 | width: 48%; 9 | display: inline-block; 10 | vertical-align: top; 11 | } 12 | 13 | .zci--answer .regex-container table.regex-table { 14 | width: 100%; 15 | margin-bottom: 1ex; 16 | } 17 | 18 | @media (max-width: 380px) { 19 | .zci--answer .regex-container .regex-column { 20 | width: 100%; 21 | } 22 | } -------------------------------------------------------------------------------- /t/PigLatin.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'translation'; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::PigLatin 14 | )], 15 | 'pig latin will this work?' => test_zci('Pig Latin: illway isthay orkway?'), 16 | 'piglatin i love duckduckgo' => test_zci('Pig Latin: iway ovelay uckduckgoday'), 17 | 'pig latin i love duckduckgo' => test_zci('Pig Latin: iway ovelay uckduckgoday'), 18 | ); 19 | 20 | done_testing; 21 | -------------------------------------------------------------------------------- /t/Base64.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'base64_conversion'; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::Base64 14 | )], 15 | 'base64 encode foo' => test_zci('Base64 encoded: Zm9v'), 16 | "base64 encode this text" => test_zci("Base64 encoded: dGhpcyB0ZXh0"), 17 | "base64 decode dGhpcyB0ZXh0" => test_zci("Base64 decoded: this text"), 18 | ); 19 | 20 | done_testing; 21 | -------------------------------------------------------------------------------- /t/ValarMorghulis.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | 6 | use Test::More; 7 | use DDG::Test::Goodie; 8 | 9 | zci answer_type => 'valarmorghulis'; 10 | 11 | ddg_goodie_test( 12 | [ 13 | 'DDG::Goodie::ValarMorghulis' 14 | ], 15 | 'valar morghulis' => 16 | test_zci( 17 | 'Valar dohaeris', 18 | html => 'Valar dohaeris' 19 | ), 20 | 'what is valar morghulis' => undef, 21 | 'valar morghulis meaning' => undef, 22 | ); 23 | 24 | done_testing; 25 | -------------------------------------------------------------------------------- /t/Fortune.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'fortune'; 9 | zci is_cached => 0; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::Fortune 14 | )], 15 | 'gimmie a fortune cookie' => test_zci(qr/.+/), 16 | 'gimmie a unix fortune' => test_zci(qr/.+/), 17 | 'give me a fortune cookie!' => test_zci(qr/.+/), 18 | 'give me a unix fortune!' => test_zci(qr/.+/), 19 | 'unix fortune cookie' => test_zci(qr/.+/), 20 | ); 21 | 22 | done_testing; 23 | 24 | -------------------------------------------------------------------------------- /t/Factors.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => "factors"; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::Factors 14 | )], 15 | '30 factors' => test_zci('Factors of 30: 1 2 3 5 6 10 15 30'), 16 | 'factors of 72' => test_zci('Factors of 72: 1 2 3 4 6 8 9 12 18 24 36 72'), 17 | 'factors of 30' => test_zci('Factors of 30: 1 2 3 5 6 10 15 30'), 18 | '72 factors' => test_zci('Factors of 72: 1 2 3 4 6 8 9 12 18 24 36 72'), 19 | ); 20 | 21 | done_testing; 22 | -------------------------------------------------------------------------------- /t/UltimateAnswer.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | 6 | use Test::More; 7 | use DDG::Test::Goodie; 8 | 9 | zci answer_type => "UltimateAnswer"; 10 | 11 | ddg_goodie_test( 12 | [ 13 | 'DDG::Goodie::UltimateAnswer' 14 | ], 15 | 16 | 'what is the ultimate answer to life the universe and everything'=> 17 | test_zci( 18 | 'Forty-two', html => 'Forty-two' 19 | ), 20 | 'what is the answer to my homework question' => undef, 21 | 'why?' => undef, 22 | ); 23 | 24 | done_testing; 25 | -------------------------------------------------------------------------------- /t/AspectRatio.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'aspect_ratio'; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::AspectRatio 14 | )], 15 | 'aspect ratio 4:3 640:?' => test_zci('Aspect ratio: 640:480 (4:3)'), 16 | 'aspect ratio 4:3 ?:480' => test_zci('Aspect ratio: 640:480 (4:3)'), 17 | 'aspect ratio 1:1.5 20:?' => test_zci('Aspect ratio: 20:30 (1:1.5)'), 18 | 'aspect ratio 1:1.5 ?:15' => test_zci('Aspect ratio: 10:15 (1:1.5)'), 19 | ); 20 | 21 | done_testing; 22 | -------------------------------------------------------------------------------- /t/FlipText.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use utf8; 6 | use Test::More; 7 | use DDG::Test::Goodie; 8 | 9 | zci answer_type => 'flip_text'; 10 | zci is_cached => 1; 11 | 12 | ddg_goodie_test( 13 | [qw( 14 | DDG::Goodie::FlipText 15 | )], 16 | 'flip text test' => test_zci("\x{0287}\x{0073}\x{01DD}\x{0287}"), 17 | 'mirror text test' => test_zci("\x{0287}\x{0073}\x{01DD}\x{0287}"), 18 | 'flip text my sentence' => test_zci('ǝɔuǝʇuǝs ʎɯ'), 19 | 'mirror text text' => test_zci('ʇxǝʇ'), 20 | ); 21 | 22 | done_testing; 23 | -------------------------------------------------------------------------------- /t/RandomName.t: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'rand'; 9 | zci is_cached => 0; 10 | 11 | ddg_goodie_test( 12 | [ 13 | 'DDG::Goodie::RandomName' 14 | ], 15 | 'random Name' => test_zci (qr/\w\w \(random\)/), 16 | 'random name' => test_zci (qr/\w\w \(random\)/), 17 | 'random person' => 18 | test_zci (qr/Name: [\w\s]+\nGender: (?:Male|Female)\nDate of birth: \d{4}\-\d{2}\-\d{2}\nAge: \d+/, 19 | heading => 'Random Person'), 20 | ); 21 | 22 | done_testing; 23 | -------------------------------------------------------------------------------- /t/BirthStone.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => "BirthStone"; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::BirthStone 14 | )], 15 | 'april birth stone' => test_zci('April birthstone: Diamond'), 16 | 'birthstone JUNE' => test_zci('June birthstone: Pearl'), 17 | 'DecEmber birthstone' => test_zci('December birthstone: Turquoise'), 18 | 'birthstone april' => test_zci('April birthstone: Diamond'), 19 | 'may birth stone' => test_zci('May birthstone: Emerald'), 20 | ); 21 | 22 | done_testing; 23 | -------------------------------------------------------------------------------- /t/Uppercase.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'uppercase'; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::Uppercase 14 | )], 15 | 'upper case this' => test_zci('THIS', 16 | html => qr/THIS/), 17 | 'uppercase that' => test_zci('THAT', 18 | html => qr/THAT/), 19 | 'allcaps this string' => test_zci('THIS STRING', 20 | html => qr/THIS STRING/), 21 | 'that string all caps' => undef, 22 | 'is this uppercase, sir?' => undef, 23 | ); 24 | 25 | done_testing; 26 | -------------------------------------------------------------------------------- /t/WhereAmI.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'whereami'; 9 | zci is_cached => 0; 10 | 11 | ddg_goodie_test( 12 | [qw(DDG::Goodie::WhereAmI)], 13 | 'where am I?' => test_zci(qr/^You appear to be near [A-Z]\w+, .+\(Lat: -?\d+\.\d+, Lon: -?\d+\.\d+\)\./, html => qr{^You appear to be near [A-Z]\w+,}), 14 | 'my location' => test_zci(qr/^You appear to be near [A-Z]\w+, .+\(Lat: -?\d+\.\d+, Lon: -?\d+\.\d+\)\./, html => qr{^You appear to be near [A-Z]\w+,}), 15 | 'my location is nowhere!' => undef, 16 | ); 17 | 18 | done_testing; 19 | -------------------------------------------------------------------------------- /share/goodie/vim_cheat_sheet/template.tx: -------------------------------------------------------------------------------- 1 |
2 | 3 | : for $columns -> $tables { 4 |
5 | 6 | : for $tables -> $table { 7 | <: $table.name :> 8 | 9 | 10 | : for $table.rows -> $row { 11 | 12 | 20 | 21 | 22 | : } 23 | 24 |
13 | : for $row.cmds -> $cmd { 14 | <: $cmd :> 15 | : if $~cmd.index != $~cmd.max_index { 16 |
17 | : } 18 | : } 19 |
<: $row.help :>
25 | : } 26 | 27 |
28 | : } 29 | 30 |
31 | -------------------------------------------------------------------------------- /share/goodie/sudoku/sudoku.css: -------------------------------------------------------------------------------- 1 | .zci--answer table.sudoku td { 2 | width: 1.5em; 3 | height: 1.5em; 4 | text-align: center; 5 | vertical-align: middle; 6 | border: 1px solid rgba(136, 136, 136, 0.478); 7 | } 8 | 9 | .zci--answer table.sudoku tr:nth-of-type(3) td, 10 | .zci--answer table.sudoku tr:nth-of-type(6) td 11 | { 12 | border-bottom: 3px solid rgba(136, 136, 136, 0.478); 13 | } 14 | 15 | .zci--answer table.sudoku td:nth-of-type(3), 16 | .zci--answer table.sudoku td:nth-of-type(6) 17 | { 18 | border-right: 3px solid rgba(136, 136, 136, 0.478); 19 | } 20 | 21 | .zci--answer table.sudoku input { 22 | border: 0px; 23 | width: 1em; 24 | text-align: center; 25 | } 26 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/Braille.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::Braille; 2 | # ABSTRACT: Braille <-> ASCII/Unicode 3 | 4 | use DDG::Goodie; 5 | 6 | use Convert::Braille; 7 | 8 | triggers query_raw => qr/\p{Braille}|braille/i; 9 | 10 | zci is_cached => 1; 11 | 12 | handle query_raw => sub { 13 | s/translate to braille |( in)? braille$|^braille //; 14 | return join(" ", map {lc(brailleDotsToAscii($_))} split(/\x{2800}/, $_)) . ' (Braille)' if /\p{Braille}/; 15 | # the space used in this join is not a normal space, it's a braille unicode space (U+2800) 16 | return join("\x{2800}", map {brailleAsciiToUnicode(uc $_)} split(/\s/, $_)) . ' (Braille)' if $_; 17 | return; 18 | }; 19 | 20 | 1; 21 | -------------------------------------------------------------------------------- /t/Fibonacci.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'fibonacci'; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw(DDG::Goodie::Fibonacci)], 13 | 'fib 7' => test_zci('The 7th fibonacci number is 13 (assuming f(0) = 0).', 14 | html => 'The 7th fibonacci number is 13 (assuming f(0) = 0).'), 15 | 'fibonacci 33' => test_zci('The 33rd fibonacci number is 3524578 (assuming f(0) = 0).', 16 | html => 'The 33rd fibonacci number is 3524578 (assuming f(0) = 0).'), 17 | ); 18 | 19 | done_testing; 20 | -------------------------------------------------------------------------------- /share/goodie/private_network/private_network.txt: -------------------------------------------------------------------------------- 1 | Private network IPv4 addresses (rfc1918): 2 | 10.0.0.0 - 10.255.255.255 | 10.0.0.0/8 3 | 172.16.0.0 - 172.31.255.255 | 172.16.0.0/12 4 | 192.168.0.0 - 192.168.255.255 | 192.168.0.0/16 5 | 6 | Carrier NAT IPv4 private addresses (rfc6598): 7 | 100.64.0.0 - 100.127.255.255 | 100.64.0.0/10 8 | 9 | Test Networks (rfc5735): 10 | TEST-NET-1: 192.0.2.0 - 192.0.2.255 | 192.0.2.0/24 11 | TEST-NET-2: 198.51.100.0 - 198.51.100.255 | 198.51.100.0/24 12 | TEST-NET-3: 203.0.113.0 - 203.0.113.255 | 203.0.113.0/24 13 | Benchmarks: 198.18.0.1 - 198.19.255.255 | 198.18.0.0/15 14 | 15 | Private network IPv6 addresses (rfc4193): 16 | Unique local addresses: fd00::/8 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DuckDuckHack Goodies [![Build Status](https://travis-ci.org/duckduckgo/zeroclickinfo-goodies.png?branch=master)](https://travis-ci.org/duckduckgo/zeroclickinfo-goodies) 2 | 3 | This repository contains all the Goodie instant answers. If you are developing a Goodie instant answer you will need to fork this repository. 4 | 5 | **If you would like to contribute to DuckDuckHack, please start by reading the [DuckDuckHack Documentation](https://dukgo.com/duckduckhack/ddh-intro).** 6 | 7 | ------ 8 | 9 | ### Goodie Instant Answer Example 10 | 11 | ![Unit Conversion Example](https://raw.githubusercontent.com/duckduckgo/duckduckgo-documentation/master/duckduckhack/assets/goodie_readme_example.png) 12 | -------------------------------------------------------------------------------- /t/EmToPx.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'conversion'; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::EmToPx 14 | )], 15 | '10 px to em' => test_zci('There are 0.625 em in 10 px (assuming a 16px font size)'), 16 | '10 px to em' => test_zci(qr/0\.625/), 17 | '12.2 px in em assuming a 12.2px font size' => test_zci("There is 1 em in 12.2 px (assuming a 12.2px font size)"), 18 | '12.2 px in em assuming a 12.2 font size' => test_zci('There are 0.7625 em in 12.2 px (assuming a 16px font size)'), 19 | ); 20 | 21 | done_testing; 22 | -------------------------------------------------------------------------------- /t/LeetSpeak.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | 6 | use Test::More; 7 | use DDG::Test::Goodie; 8 | 9 | zci answer_type => 'leetspeak'; 10 | zci is_cached => 1; 11 | 12 | ddg_goodie_test( 13 | [ 14 | 'DDG::Goodie::LeetSpeak' 15 | ], 16 | 'leetspeak hello world !' => test_zci('Leet Speak: |-|3|_|_0 \^/0|2|_|) !'), 17 | 'l33tsp34k hElLo WORlD !' => test_zci('Leet Speak: |-|3|_|_0 \^/0|2|_|) !'), 18 | 'what is l33t' => test_zci("Leet Speak: \\^/|-|/-\\'][' 15"), 19 | 'leet speak leetspeak' => test_zci("Leet Speak: |_33']['5|D3/-\\|<"), 20 | 'l33t sp34k /!§ ;€' => test_zci("Leet Speak: /!§ ;€"), 21 | 'l33tsp34k' => undef, 22 | ); 23 | 24 | done_testing; 25 | -------------------------------------------------------------------------------- /t/Braille.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | use Convert::Braille; 8 | use utf8; 9 | 10 | zci is_cached => 1; 11 | zci answer_type => 'braille'; 12 | 13 | ddg_goodie_test( 14 | [qw( 15 | DDG::Goodie::Braille 16 | )], 17 | 'hello in braille' => test_zci("⠓⠑⠇⠇⠕ (Braille)"), 18 | '⠓⠑⠇⠇⠕' => test_zci("hello (Braille)"), 19 | 'translate to braille translate to braille' => test_zci("⠞⠗⠁⠝⠎⠇⠁⠞⠑⠀⠞⠕⠀⠃⠗⠁⠊⠇⠇⠑ (Braille)"), 20 | '⠞⠗⠁⠝⠎⠇⠁⠞⠑⠀⠞⠕⠀⠃⠗⠁⠊⠇⠇⠑' => test_zci("translate to braille (Braille)"), 21 | 'braille asdf k' => test_zci("⠁⠎⠙⠋⠀⠅ (Braille)"), 22 | '⠁⠎⠙⠋⠀⠅' => test_zci("asdf k (Braille)") 23 | ); 24 | 25 | done_testing; 26 | -------------------------------------------------------------------------------- /t/Reverse.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'reverse'; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::Reverse 14 | )], 15 | 'reverse text bla' => test_zci('Reversed "bla": alb'), 16 | 'reverse text blabla' => test_zci('Reversed "blabla": albalb'), 17 | 'reverse text esrever' => test_zci('Reversed "esrever": reverse'), 18 | 'reverse' => undef, 19 | 20 | #Should not trigger on a request for DNA/RNA reverse complement 21 | 'reverse complement of ATG-CTA-GGG-GCT' => undef, 22 | 'reverse complement gacuacgaucgagkmanscuag' => undef 23 | ); 24 | 25 | done_testing; 26 | 27 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/Ascii.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::Ascii; 2 | # ABSTRACT: ASCII 3 | 4 | use DDG::Goodie; 5 | 6 | triggers end => "ascii"; 7 | 8 | primary_example_queries '0110100001100101011011000110110001101111 to ascii'; 9 | description 'convert binary data to readable characters'; 10 | name 'Ascii'; 11 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/Binary.pm'; 12 | category 'transformations'; 13 | topics 'cryptography'; 14 | 15 | zci answer_type => "ascii_conversion"; 16 | zci is_cached => 1; 17 | 18 | handle remainder => sub { 19 | my $ascii = pack("B*", $1) if /^(([0-1]{8})*)\s+(in|to)$/; 20 | return "$1 in binary is \"$ascii\" in ASCII" if $ascii; 21 | return; 22 | }; 23 | 24 | 1; 25 | 26 | -------------------------------------------------------------------------------- /share/goodie/figlet/figlet.css: -------------------------------------------------------------------------------- 1 | #zero_click_wrapper #figlet-wrapper pre { 2 | display: block; 3 | word-wrap: normal; 4 | white-space: pre; 5 | overflow: auto; 6 | font-family: monospace; 7 | background-color: inherit; 8 | border: 0; 9 | height: auto; 10 | width: 100%; 11 | padding-left: 0px; 12 | outline: none; 13 | } 14 | 15 | #zero_click_wrapper #figlet-wrapper #figlet-font { 16 | font-family: monospace; 17 | } 18 | 19 | @media screen and (max-width:768px) { 20 | #zero_click_wrapper #figlet-wrapper pre { 21 | font-size: 10px; 22 | } 23 | } 24 | 25 | @media screen and (max-width:500px) { 26 | #zero_click_wrapper #figlet-wrapper pre { 27 | font-size: 5px; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /t/Atbash.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'atbash'; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::Atbash 14 | )], 15 | 'atbash test' => test_zci('Atbash: gvhg'), 16 | 'atbash This is a test' => test_zci('Atbash: Gsrh rh z gvhg'), 17 | 'atbash Gonna party like it\'s 1999!' => test_zci('Atbash: Tlmmz kzigb orpv rg\'h 1999!'), 18 | 'Atbash abcdefghijklmnopqrstuvwxyz' => test_zci('Atbash: zyxwvutsrqponmlkjihgfedcba'), 19 | 'atbash hello' => test_zci('Atbash: svool'), 20 | 'atbash svool' => test_zci('Atbash: hello'), 21 | ); 22 | 23 | done_testing; 24 | -------------------------------------------------------------------------------- /t/TitleCase.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'title_case'; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::TitleCase 14 | )], 15 | 'titlecase test this out' => test_zci('Test This Out'), 16 | 'titlecase this is a walk in the park' => test_zci('This Is a Walk in the Park'), 17 | 'titlecase a good day to die hard' => test_zci('A Good Day to Die Hard'), 18 | 'titlecase here i am testing-hyphenated-words' => test_zci('Here I Am Testing-Hyphenated-Words'), 19 | 'capitalize this should be capitalized' => test_zci('This Should Be Capitalized'), 20 | 'titlecase test' => test_zci('Test'), 21 | ); 22 | 23 | done_testing; 24 | -------------------------------------------------------------------------------- /t/CalcRoots.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'root'; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::CalcRoots 14 | )], 15 | '2nd root of 100' => test_zci("The 2-root of 100 is 10 (10 times the 2-root of 1).", html => qq(2√100 = 10 (10⋅2√1))), 16 | 'cube root of 33' => test_zci("The 3-root of 33 is 3.20753432999583.", html => qq(3√33 = 3.20753432999583)) 17 | ); 18 | done_testing; 19 | -------------------------------------------------------------------------------- /t/Tips.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'tip'; 9 | zci is_cached => 0; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::Tips 14 | )], 15 | '20% tip on $20' => test_zci('Tip: $4.00; Total: $24.00'), 16 | '20% tip on $20 bill' => test_zci('Tip: $4.00; Total: $24.00'), 17 | '20% tip for a $20 bill' => test_zci('Tip: $4.00; Total: $24.00'), 18 | '20 percent tip on $20' => test_zci('Tip: $4.00; Total: $24.00'), 19 | '20% tip on $21.63' => test_zci('Tip: $4.33; Total: $25.96'), 20 | '20 percent tip for a $20 bill' => test_zci('Tip: $4.00; Total: $24.00'), 21 | ); 22 | 23 | done_testing; 24 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/Factors.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::Factors; 2 | # ABSTRACT: Returns the factors of the entered number 3 | 4 | use DDG::Goodie; 5 | 6 | use Math::Prime::Util 'divisors'; 7 | 8 | zci answer_type => "factors"; 9 | zci is_cached => 1; 10 | 11 | triggers startend => 'factors', 'factors of'; 12 | 13 | primary_example_queries 'factors of 30'; 14 | secondary_example_queries '72 factors'; 15 | description 'Returns the factors of the entered number'; 16 | name 'Factors'; 17 | topics 'math'; 18 | category 'calculations'; 19 | attribution github => [ 'https://github.com/austinheimark', 'austin_heimark' ]; 20 | 21 | handle remainder => sub { 22 | return unless /^\d+$/; 23 | my @factors = divisors($_); 24 | return "Factors of $_: @factors"; 25 | }; 26 | 27 | 1; 28 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | before_install: 3 | - export HARNESS_OPTIONS=j10:c HARNESS_TIMER=1 4 | - rm .travis.yml 5 | - git config --global user.name "Dist Zilla Plugin TravisCI" 6 | - git config --global user.email $HOSTNAME":not-for-mail@travis-ci.org" 7 | - sudo apt-get update -qq 8 | - sudo apt-get install -y libmpfr-dev 9 | install: 10 | - cpanm --quiet --notest --skip-installed Dist::Zilla 11 | - dzil authordeps | grep -ve '^\W' | xargs -n 5 -P 10 cpanm --quiet --notest --skip-installed 12 | - dzil listdeps | grep -ve '^\W' | cpanm --quiet --notest --skip-installed 13 | - cpanm --quiet --notest App::DuckPAN autodie 14 | - duckpan DDG 15 | language: perl 16 | perl: 17 | - 5.16 18 | - 5.18 19 | script: 20 | - dzil smoke --release --author 21 | -------------------------------------------------------------------------------- /share/goodie/public_dns/providers.yml: -------------------------------------------------------------------------------- 1 | --- 2 | Comodo Secure DNS: 3 | info_url: http://www.comodo.com/secure-dns/ 4 | ip4: 5 | - 8.26.56.26 6 | - 8.20.247.20 7 | ip6: [] 8 | DNS Advantage: 9 | info_url: http://dnsadvantage.com 10 | ip4: 11 | - 156.154.70.1 12 | - 156.154.71.1 13 | ip6: [] 14 | Google Public DNS: 15 | info_url: http://code.google.com/speed/public-dns/ 16 | ip4: 17 | - 8.8.8.8 18 | - 8.8.4.4 19 | ip6: 20 | - 2001:4860:4860::8888 21 | - 2001:4860:4860::8844 22 | Norton DNS: 23 | info_url: http://dns.norton.com 24 | ip4: 25 | - 198.153.192.1 26 | - 198.153.194.1 27 | ip6: [] 28 | OpenDNS: 29 | info_url: http://opendns.com/ 30 | ip4: 31 | - 208.67.222.222 32 | - 208.67.220.220 33 | ip6: [] 34 | -------------------------------------------------------------------------------- /t/PublicDNS.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => "public_dns"; 9 | zci is_cached => 1; 10 | 11 | # We don't want to test too specifically on the included data, so just confirm 12 | # we got an answer with something approaching the correct form. 13 | # Hopefully, some one has eyeballed the output to make sure its got the right data. 14 | my $text_table = qr#^\+-+.*-+\+#m; 15 | my $html_table = qr#.*
$#m; 16 | my $heading = 'Public DNS Servers'; 17 | 18 | ddg_goodie_test([qw( DDG::Goodie::PublicDNS)], 19 | map { ("$_" => test_zci($text_table, html => $html_table, heading => $heading,)) } ('public dns', 'dns servers',)); 20 | 21 | done_testing; 22 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/Rot13.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::Rot13; 2 | # ABSTRACT: Rotate chars by 13 letters 3 | 4 | use DDG::Goodie; 5 | 6 | primary_example_queries 'rot13 thirteen'; 7 | secondary_example_queries 'rot13 guvegrra'; 8 | description 'rotate all the letters in your query by 13'; 9 | name 'Rot13'; 10 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/Rot13.pm'; 11 | category 'transformations'; 12 | topics 'cryptography'; 13 | 14 | attribution github => ['https://github.com/unlisted', 'unlisted']; 15 | 16 | triggers start => 'rot13'; 17 | 18 | zci is_cached => 1; 19 | 20 | handle remainder => sub { 21 | if ($_) { 22 | $_ =~ tr[a-zA-Z][n-za-mN-ZA-M]; 23 | return "ROT13: $_"; 24 | }; 25 | return; 26 | }; 27 | 28 | 1; 29 | -------------------------------------------------------------------------------- /t/LaserShip.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'lasership'; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( DDG::Goodie::LaserShip )], 13 | 'LL12345678' => test_zci( 14 | "LL12345678", 15 | heading => 'Lasership Shipment Tracking', 16 | html => qq(Track this shipment at Lasership.) 17 | ), 18 | 'LL 12345678' => test_zci( 19 | "LL12345678", 20 | heading => 'Lasership Shipment Tracking', 21 | html => qq(Track this shipment at Lasership.) 22 | ), 23 | ); 24 | 25 | done_testing; 26 | 27 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/Rafl.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::Rafl; 2 | # ABSTRACT: rafl is so everywhere, there's a DuckDuckGo.com "!rafl" bang syntax 3 | 4 | use DDG::Goodie; 5 | 6 | use Acme::rafl::Everywhere; 7 | 8 | primary_example_queries 'rafl is everywhere'; 9 | secondary_example_queries 'where is rafl?'; 10 | description 'rafl is everywhere!'; 11 | name 'rafl'; 12 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/.pm'; 13 | category 'ids'; 14 | topics 'social'; 15 | 16 | attribution 17 | web => 'http://stephen.scaffidi.net', 18 | github => ['https://github.com/Hercynium', 'Hercynium']; 19 | 20 | triggers any => 'rafl'; 21 | 22 | handle remainder => sub { 23 | return Acme::rafl::Everywhere->new->fact 24 | }; 25 | 26 | 1 && "rafl"; # everywhere 27 | -------------------------------------------------------------------------------- /t/Regexp.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'regexp'; 9 | 10 | ddg_goodie_test( 11 | [qw( DDG::Goodie::Regexp )], 12 | 'regexp /(hello\s)/ hello probably' => test_zci( 13 | "hello ", 14 | heading => 'Regexp Result', 15 | ), 16 | 'regexp /(dd)/ ddg' => test_zci( 17 | "dd", 18 | heading => 'Regexp Result', 19 | ), 20 | 'regex /(poss)/ many possibilities' => test_zci( 21 | "poss", 22 | heading => 'Regexp Result', 23 | ), 24 | 'regexp /(.*)/ ddg' => test_zci( 25 | 'ddg', 26 | heading => 'Regexp Result' 27 | ), 28 | ); 29 | 30 | done_testing; 31 | 32 | -------------------------------------------------------------------------------- /t/MakeMeASandwich.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | 6 | use Test::More; 7 | use DDG::Test::Goodie; 8 | 9 | zci answer_type => 'makemeasandwich'; 10 | 11 | ddg_goodie_test( 12 | [ 13 | 'DDG::Goodie::MakeMeASandwich' 14 | ], 15 | 'make me a sandwich' => 16 | test_zci( 17 | 'What? Make it yourself.', 18 | html => 'What? Make it yourself.
More at xkcd' 19 | ), 20 | 'sudo make me a sandwich' => 21 | test_zci( 22 | 'Okay.', 23 | html => 'Okay.
More at xkcd' 24 | ), 25 | 'blahblah make me a sandwich' => undef, 26 | '0 make me a sandwich' => undef, 27 | ); 28 | 29 | done_testing; 30 | -------------------------------------------------------------------------------- /share/goodie/currency_in/README.txt: -------------------------------------------------------------------------------- 1 | parser.py generates currencies.txt for 'CurrencyIn.pm' module. 2 | 3 | Currencies for each country are from: 4 | http://en.wikipedia.org/wiki/List_of_circulating_currencies 5 | 6 | First run: 'fetch.sh' to fetch wikipedia page used by parser, 7 | then run: 'parse.sh' or just 'python parse.py' 8 | 9 | 10 | DETAILS: 11 | Output is the file (currencies.txt) with list of countries and currencies with iso code in () 12 | For example: 13 | slovakia 14 | Euro (EUR) 15 | 16 | If there is more than one currency used by each country then each currency is separated by comma 17 | For example: 18 | zimbabwe 19 | Botswana pula (BWP),British pound (GBP) 20 | 21 | Country name is lowercased for better comparison with user input. But it gets capitalized in search results. 22 | -------------------------------------------------------------------------------- /t/NLetterWords.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'nletterwords'; 9 | zci is_cached => 0; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::NLetterWords 14 | )], 15 | '1 letter words' => test_zci('Random 1 letter words: a, I.'), 16 | '1 char words' => test_zci('Random 1 letter words: a, I.'), 17 | '1 character word' => test_zci('Random 1 letter words: a, I.'), 18 | 'one letter words' => test_zci('Random 1 letter words: a, I.'), 19 | '5 letter words' => test_zci(qr/Random 5 letter words: ((\w){5},? ?){30}/), 20 | '12 character word' => test_zci(qr/Random 12 letter words: ((\w){12},? ?){30}/), 21 | ); 22 | 23 | done_testing; 24 | -------------------------------------------------------------------------------- /t/Phonetic.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'phonetic'; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::Phonetic 14 | )], 15 | 'phonetic what duck' => test_zci('Phonetic: Whiskey-Hotel-Alfa-Tango Delta-Uniform-Charlie-Kilo'), 16 | 'phonetic through yonder' => test_zci('Phonetic: Tango-Hotel-Romeo-Oscar-Uniform-Golf-Hotel Yankee-Oscar-November-Delta-Echo-Romeo'), 17 | 'phonetic window quacks' => test_zci('Phonetic: Whiskey-India-November-Delta-Oscar-Whiskey Quebec-Uniform-Alfa-Charlie-Kilo-Sierra'), 18 | 'phonetic Who are you?' => test_zci('Phonetic: Whiskey-Hotel-Oscar Alfa-Romeo-Echo Yankee-Oscar-Uniform') 19 | ); 20 | 21 | done_testing; 22 | -------------------------------------------------------------------------------- /t/ParseCron.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'parsecron'; 9 | zci is_cached => 0; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::ParseCron 14 | )], 15 | 'crontab * */3 * * *' => test_zci(qr/^Cron will schedule the job at this frequency:\s*\n\s*\d{1,2}:\d{1,2}:\d{1,2} on \d{1,2} [a-zA-Z]{3}, \d{4}\s*\n\s*\d{1,2}:\d{1,2}:\d{1,2} on \d{1,2} [a-zA-Z]{3}, \d{4}\s*\n\s*\d{1,2}:\d{1,2}:\d{1,2} on \d{1,2} [a-zA-Z]{3}, \d{4}$/), 16 | 'crontab 42 12 3 Feb Sat' => test_zci(qr/^Cron will schedule the job at this frequency:\s*\n\s*\d{1,2}:\d{1,2}:\d{1,2} on \d{1,2} [a-zA-Z]{3}, \d{4}\s*\n\s*\d{1,2}:\d{1,2}:\d{1,2} on \d{1,2} [a-zA-Z]{3}, \d{4}\s*\n\s*\d{1,2}:\d{1,2}:\d{1,2} on \d{1,2} [a-zA-Z]{3}, \d{4}$/), 17 | ); 18 | 19 | done_testing; 20 | 21 | 22 | -------------------------------------------------------------------------------- /share/goodie/vim_cheat_sheet/vim_cheat_sheet.css: -------------------------------------------------------------------------------- 1 | .zci--answer .zero_click_wrapper .zero_click { 2 | padding-left: 0px !important; 3 | margin-left: 0px !important; 4 | margin-right: 0px !important; 5 | } 6 | 7 | .zci--answer .vim-container { 8 | max-height: 45ex; 9 | overflow-y: scroll; 10 | overflow-x: hidden; 11 | } 12 | 13 | .zci--answer .vim-column { 14 | width: 48%; 15 | display: inline-block; 16 | vertical-align: top; 17 | } 18 | 19 | .zci--answer table.vim-table { 20 | width: 100%; 21 | margin-bottom: 1ex; 22 | } 23 | 24 | .zci--answer table.vim-table td { 25 | padding-right: 1ex; 26 | vertical-align: top; 27 | } 28 | .zci--answer table.vim-table td code { 29 | white-space: nowrap; 30 | } 31 | 32 | @media (max-width: 380px) { 33 | .zci--answer .vim-column { 34 | width: 100%; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/PigLatin.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::PigLatin; 2 | # ABSTRACT: convert a given string to pig latin 3 | 4 | use DDG::Goodie; 5 | use Lingua::PigLatin 'piglatin'; 6 | 7 | triggers startend => 'pig latin', 'piglatin'; 8 | 9 | zci is_cached => 1; 10 | zci answer_type => "translation"; 11 | 12 | attribution github => ['http://github.com/nospampleasemam', 'nospampleasemam'], 13 | web => ['http://github.com/nospampleasemam', 'nospampleasemam']; 14 | 15 | primary_example_queries 'pig latin i love duckduckgo'; 16 | name 'PigLatin'; 17 | description 'translate a phrase into pig latin'; 18 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/PigLatin.pm'; 19 | category 'conversions'; 20 | topics 'words_and_games'; 21 | 22 | handle remainder => sub { 23 | return "Pig Latin: " . piglatin($_) 24 | }; 25 | 26 | 1; 27 | -------------------------------------------------------------------------------- /t/HKDK.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'hkdk'; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( DDG::Goodie::HKDK )], 13 | 'CU123456789DK' => test_zci( 14 | "CU123456789DK", 15 | heading => 'Post Norden Shipment Tracking', 16 | html => qq(Track this shipment at Post Norden.) 17 | ), 18 | 'EE123456789HK' => test_zci( 19 | "EE123456789HK", 20 | heading => 'Hongkong Post Shipment Tracking', 21 | html => qq(Track this shipment at Hongkong Post.) 22 | ), 23 | ); 24 | 25 | done_testing; 26 | 27 | -------------------------------------------------------------------------------- /t/IDN.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | use utf8; 8 | 9 | zci answer_type => 'idn'; 10 | zci is_cached => 1; 11 | 12 | ddg_goodie_test( 13 | [qw( 14 | DDG::Goodie::IDN 15 | )], 16 | 'idn exämple.com' => 17 | test_zci('Encoded IDN: xn--exmple-cua.com'), 18 | ######### 19 | 'internationalize domain exämple.com' => 20 | test_zci('Encoded internationalized domain: xn--exmple-cua.com'), 21 | 'idn xn--exmple-cua.com' => 22 | test_zci('Decoded IDN: exämple.com'), 23 | 'international domain xn--exmple-cua.com' => 24 | test_zci('Decoded international domain: exämple.com'), 25 | 'internationalized domain xn--exmple-cua.com' => 26 | test_zci('Decoded internationalized domain: exämple.com'), 27 | ); 28 | 29 | done_testing; 30 | 31 | -------------------------------------------------------------------------------- /t/Sort.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'sort'; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::Sort 14 | )], 15 | 'sort -1, +4, -3, 5.7' => test_zci('-3, -1, 4, 5.7 (Sorted ascendingly)'), 16 | 'sort [-1, +4, -3, 5.7]' => test_zci('-3, -1, 4, 5.7 (Sorted ascendingly)'), 17 | 'sort (-1, +4, -3, 5.7)' => test_zci('-3, -1, 4, 5.7 (Sorted ascendingly)'), 18 | 'sort desc -4.4 .5 1 66 15 -55' => test_zci('66, 15, 1, 0.5, -4.4, -55 (Sorted descendingly)'), 19 | 'sort -3 -10 56 10' => test_zci('-10, -3, 10, 56 (Sorted ascendingly)'), 20 | 'sort descending 10, -1, +5.3, -95, 1' => test_zci('10, 5.3, 1, -1, -95 (Sorted descendingly)'), 21 | ); 22 | 23 | done_testing; 24 | -------------------------------------------------------------------------------- /t/Teredo.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | 6 | use Test::More; 7 | use DDG::Test::Goodie; 8 | 9 | zci answer_type => 'teredo'; 10 | 11 | ddg_goodie_test( 12 | [ 13 | 'DDG::Goodie::Teredo' 14 | ], 15 | 16 | # Sample queries 17 | 'teredo 2001:0000:4136:e378:8000:63bf:3fff:fdd2' => 18 | test_zci("Teredo Server IPv4: 65.54.227.120\nNAT Public IPv4: 192.0.2.45\nClient Port: 40000", html => qr/.*/), 19 | 20 | 'teredo 2001:0000:4136:E378:8000:EC77:7C94:FFFE' => 21 | test_zci("Teredo Server IPv4: 65.54.227.120\nNAT Public IPv4: 131.107.0.1\nClient Port: 5000", html => qr/.*/), 22 | 23 | 'teredo 2001::CE49:7601:E866:EFFF:62C3:FFFE' => 24 | test_zci("Teredo Server IPv4: 206.73.118.1\nNAT Public IPv4: 157.60.0.1\nClient Port: 4096", html => qr/.*/) 25 | ); 26 | 27 | 28 | done_testing; 29 | -------------------------------------------------------------------------------- /t/USPS.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'usps'; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( DDG::Goodie::USPS )], 13 | 'EA 000 000 000 US' => test_zci( 14 | "EA000000000US", 15 | heading => 'USPS Shipment Tracking', 16 | html => qq(Track this shipment at USPS.) 17 | ), 18 | 'usps 7000 0000 0000 0000 0000' => test_zci( 19 | "70000000000000000000", 20 | heading => 'USPS Shipment Tracking', 21 | html => qq(Track this shipment at USPS.) 22 | ), 23 | ); 24 | 25 | done_testing; 26 | 27 | -------------------------------------------------------------------------------- /t/SigFigs.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'sig_figs'; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::SigFigs 14 | )], 15 | 'sf 78' => test_zci('Significant figures: 2'), 16 | "sigfigs 10.12404" => test_zci("Significant figures: 7"), 17 | "sigdigs 3030." => test_zci("Significant figures: 4"), 18 | "significant figures 0.0100235" => test_zci("Significant figures: 6"), 19 | "sf 302.056" => test_zci("Significant figures: 6"), 20 | "sd 045.30" => test_zci("Significant figures: 4"), 21 | 'sigfigs 01.1234000' => test_zci('Significant figures: 8'), 22 | 'significant figures 000123000' => test_zci('Significant figures: 3'), 23 | ); 24 | 25 | done_testing; 26 | -------------------------------------------------------------------------------- /t/GimpCheatSheet.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | 6 | use Test::More; 7 | use DDG::Test::Goodie; 8 | 9 | zci answer_type => "gimp_cheat"; 10 | 11 | # This goodie always returns the same answer whenever its triggered 12 | my $test_zci = test_zci( 13 | qr/^Help.*Tools.*File.*Edit.*Zoom tool.*/s, 14 | heading => "GIMP Shortcut Cheat Sheet", 15 | html => qr#$#s, 16 | ); 17 | 18 | ddg_goodie_test( 19 | [ 'DDG::Goodie::GimpCheatSheet' ], 20 | "gimp cheat sheet" => $test_zci, 21 | "gimp cheatsheet" => $test_zci, 22 | "gimp help" => $test_zci, 23 | "gimp quick reference" => $test_zci, 24 | "gimp reference" => $test_zci, 25 | "gimp shortcut" => $test_zci, 26 | "gimp shortcuts" => $test_zci 27 | ); 28 | 29 | done_testing; 30 | 31 | -------------------------------------------------------------------------------- /t/CurrencyIn.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'currency_in'; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::CurrencyIn 14 | )], 15 | 'currency in australia' => test_zci('The currency in Australia is the Australian dollar (AUD)', html => 'The currency in Australia is the Australian dollar (AUD)'), 16 | 'currency in AU' => test_zci('The currency in Australia is the Australian dollar (AUD)', html => 'The currency in Australia is the Australian dollar (AUD)'), 17 | 'currency In Alderney' => test_zci("Currencies in Alderney are: \nAlderney pound\nBritish pound (GBP)\nGuernsey pound", html => "Currencies in Alderney are:
Alderney pound
British pound (GBP)
Guernsey pound") 18 | ); 19 | 20 | done_testing; 21 | -------------------------------------------------------------------------------- /t/Ascii.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'ascii_conversion'; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::Ascii 14 | )], 15 | '01101010 to ascii' => test_zci('01101010 in binary is "j" in ASCII'), 16 | '00111001 to ascii' => test_zci('00111001 in binary is "9" in ASCII'), 17 | '01110100011010000110100101110011 in ascii' => test_zci('01110100011010000110100101110011 in binary is "this" in ASCII'), 18 | '01110100011010000110000101110100 to ascii' => test_zci('01110100011010000110000101110100 in binary is "that" in ASCII'), 19 | '0110100001100101011011000110110001101111 to ascii' => test_zci('0110100001100101011011000110110001101111 in binary is "hello" in ASCII'), 20 | ); 21 | 22 | done_testing; 23 | 24 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/Unidecode.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::Unidecode; 2 | # ABSTRACT: return an ASCII version of the search query 3 | 4 | use DDG::Goodie; 5 | use Text::Unidecode; 6 | use utf8; 7 | 8 | triggers startend => "unidecode"; 9 | 10 | zci is_cached => 1; 11 | zci answer_type => "convert_to_ascii"; 12 | 13 | attribution github => ['https://github.com/moritz', 'moritz']; 14 | primary_example_queries 'unidecode møæp'; 15 | secondary_example_queries "unidecode å亰"; 16 | description 'decode special non-latin characters'; 17 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/Unidecode.pm'; 18 | category 'computing_tools'; 19 | topics 'programming'; 20 | 21 | handle remainder => sub { 22 | my $u = unidecode $_; 23 | # unidecode output sometimes contains trailing spaces 24 | $u =~ s/\s+$//; 25 | return $u; 26 | }; 27 | 28 | 1; 29 | -------------------------------------------------------------------------------- /t/Unicornify.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | use Unicornify::URL; 8 | 9 | 10 | zci answer_type => 'unicornify'; 11 | zci is_cached => 1; 12 | ddg_goodie_test( 13 | [qw( 14 | DDG::Goodie::Unicornify 15 | )], 16 | 'unicornify example@example.com' => 17 | test_zci('This is a unique unicorn for example@example.com:' . "\n" . 'Learn more at unicornify.appspot.com', 18 | heading => 'example@example.com (Unicornify)', 19 | html => 'This is a unique unicorn for example@example.com:' 20 | .'
' 21 | .'' 22 | . 'Learn more at unicornify.appspot.com')); 23 | 24 | done_testing; 25 | -------------------------------------------------------------------------------- /t/Latex.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'Latex'; 9 | zci is_cached => 0; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::Latex 14 | )], 15 | "latex integral" => test_zci('LaTeX command: \int_lowerbound^upperbound 16 | Example: $\int_a^b f(x)dx$', 17 | html => qr/\\int_lowerbound\^upperbound/, 18 | heading => 'Integral (LaTeX)'), 19 | 20 | "tex integral" => test_zci('LaTeX command: \int_lowerbound^upperbound 21 | Example: $\int_a^b f(x)dx$', 22 | html => qr/\\int_lowerbound\^upperbound/, 23 | heading => 'Integral (LaTeX)'), 24 | 'latex summation' => test_zci('LaTeX command: \sum_{lower}^{upper} 25 | Example: $\sum{i=0}^{10} x^{2}$', 26 | html => qr/\\sum_\{lower\}\^\{upper\}/, 27 | heading => 'Summation (LaTeX)'), 28 | ); 29 | 30 | done_testing; 31 | -------------------------------------------------------------------------------- /t/Paper.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'paper'; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::Paper 14 | )], 15 | 'a0 paper size' => test_zci('841mm x 1189mm (33.11in x 46.81in)'), 16 | 'c10 paper dimension' => test_zci('28mm x 40mm (1.10in x 1.57in)'), 17 | 'b10 paper dimensions' => test_zci('31mm x 44mm (1.22in x 1.73in)'), 18 | 'letter paper size' => test_zci('210mm x 279mm (8.27in x 11in)'), 19 | 'legal paper dimensions' => test_zci('216mm x 356mm (8.5in x 14in)'), 20 | 'junior legal paper dimensions' => test_zci('203mm x 127mm (8in x 5in)'), 21 | 'ledger paper dimensions' => test_zci('432mm x 279mm (17in x 11in)'), 22 | 'tabloid paper size' => test_zci('279mm x 432mm (11in x 17in)'), 23 | ); 24 | 25 | done_testing; 26 | -------------------------------------------------------------------------------- /t/UnixTime.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'time_conversion'; 9 | zci is_cached => 0; 10 | 11 | ddg_goodie_test([qw( 12 | DDG::Goodie::UnixTime 13 | ) 14 | ], 15 | 'unix time 0000000000000' => test_zci('Unix Time: Thu Jan 01 00:00:00 1970 +0000'), 16 | 'epoch 0' => test_zci('Unix Time: Thu Jan 01 00:00:00 1970 +0000'), 17 | 'epoch 2147483647' => test_zci('Unix Time: Tue Jan 19 03:14:07 2038 +0000'), 18 | #'epoch' => test_zci(qr/Unix Time: [^\+]+\+0000/), # Now in UTC. 19 | #'timestamp' => test_zci(qr/Unix Time: [^\+]+\+0000/), # Now in UTC. 20 | #'datetime' => test_zci(qr/Unix Time: [^\+]+\+0000/), # Now in UTC. 21 | ); 22 | 23 | done_testing; 24 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/ValarMorghulis.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::ValarMorghulis; 2 | # ABSTRACT: A Game of Thrones / A Song of Ice and Fire easter egg. 3 | 4 | use DDG::Goodie; 5 | 6 | triggers start => 'valar morghulis'; 7 | primary_example_queries 'valar morghulis'; 8 | 9 | name 'Valar Morghulis'; 10 | description 'Game of Thrones / A Song of Ice and Fire easter egg.'; 11 | category 'special'; 12 | topics 'geek'; 13 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/ValarMorghulis.pm'; 14 | attribution 15 | web => ['http://engvik.nu', 'Lars Jansøn Engvik'], 16 | github => [ 'larseng', 'Lars Jansøn Engvik']; 17 | 18 | zci answer_type => 'valarmorghulis'; 19 | 20 | handle remainder => sub { 21 | if($_ eq '') { 22 | return 'Valar dohaeris', 23 | html => 'Valar dohaeris'; 24 | } 25 | return; 26 | }; 27 | 28 | 1; 29 | -------------------------------------------------------------------------------- /t/Roman.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'roman_numeral_conversion'; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::Roman 14 | )], 15 | 'roman 155' => test_zci('CLV (roman numeral conversion)'), 16 | "roman xii" => test_zci("12 (roman numeral conversion)"), 17 | "roman mmcml" => test_zci("2950 (roman numeral conversion)"), 18 | "roman 2344" => test_zci("MMCCCXLIV (roman numeral conversion)"), 19 | "arabic cccxlvi" => test_zci("346 (roman numeral conversion)"), 20 | 'roman numeral MCCCXXXVII' => test_zci('1337 (roman numeral conversion)'), 21 | 'roman 1337' => test_zci('MCCCXXXVII (roman numeral conversion)'), 22 | 'roman IV' => test_zci('4 (roman numeral conversion)'), 23 | ); 24 | 25 | done_testing; 26 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/PrivateNetwork.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::PrivateNetwork; 2 | # ABSTRACT: show non-Internet routable IP addresses. 3 | 4 | use DDG::Goodie; 5 | 6 | triggers start => "private network", "private ip", "private networks", "private ips"; 7 | 8 | zci is_cached => 1; 9 | zci answer_type => "private_network"; 10 | 11 | primary_example_queries 'private networks'; 12 | secondary_example_queries 'private ips'; 13 | description 'show private IP blocks'; 14 | name 'PrivateNetwork'; 15 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/PrivateNetwork.pm'; 16 | category 'cheat_sheets'; 17 | topics 'sysadmin'; 18 | attribution twitter => 'crazedpsyc', 19 | cpan => 'CRZEDPSYC' ; 20 | 21 | my $text = scalar share('private_network.txt')->slurp, 22 | my $html = scalar share('private_network.html')->slurp; 23 | 24 | handle sub { 25 | $text, html => $html 26 | }; 27 | 28 | 1; 29 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/Fortune.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::Fortune; 2 | # ABSTRACT: UNIX fortune quips. 3 | 4 | use DDG::Goodie; 5 | use Fortune; 6 | 7 | triggers any => 'unix fortune','unix fortune!','fortune cookie','fortune cookie!'; 8 | 9 | primary_example_queries 'unix fortune cookie'; 10 | name 'Fortune'; 11 | description 'get a random phrase from the original fortunes file'; 12 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/Fortune.pm'; 13 | category 'random'; 14 | topics 'words_and_games'; 15 | attribution github => ['https://github.com/frncscgmz', 'frncscgmz']; 16 | 17 | zci is_cached => 0; 18 | zci answer_type => "fortune"; 19 | 20 | my $ffile = share('fortunes'); 21 | my $fortune_file = Fortune->new($ffile); 22 | $fortune_file->read_header(); 23 | 24 | handle remainder => sub { 25 | my $output = $fortune_file->get_random_fortune(); 26 | $output =~ s/\n//g; 27 | return $output; 28 | }; 29 | 30 | 1; 31 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/Morse.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::Morse; 2 | # ABSTRACT: Converts to/from Morse code 3 | 4 | use DDG::Goodie; 5 | use Convert::Morse qw(is_morse as_ascii as_morse); 6 | 7 | primary_example_queries 'morse ... --- ...'; 8 | secondary_example_queries 'morse SOS'; 9 | description 'convert to and from morse code'; 10 | name 'Morse'; 11 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/Morse.pm'; 12 | category 'conversions'; 13 | topics 'special_interest'; 14 | attribution 15 | web => 'http://und3f.com', 16 | twitter => 'und3f', 17 | github => 'und3f', 18 | cpan => 'UNDEF'; 19 | 20 | triggers startend => 'morse', 'morse code'; 21 | 22 | zci is_cached => 1; 23 | zci answer_type => 'chars'; 24 | 25 | handle remainder => sub { 26 | return unless $_; 27 | 28 | my $convertor = is_morse($_) ? \&as_ascii : \&as_morse; 29 | return "Morse code: " . $convertor->($_); 30 | }; 31 | 32 | 1; 33 | -------------------------------------------------------------------------------- /t/Morse.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use utf8; 6 | use Test::More; 7 | use DDG::Test::Goodie; 8 | 9 | zci answer_type => 'chars'; 10 | zci is_cached => 1; 11 | 12 | ddg_goodie_test( 13 | [qw( 14 | DDG::Goodie::Morse 15 | )], 16 | 'morse ... --- ...' => test_zci('Morse code: SOS'), 17 | 'morse SOS' => 18 | test_zci('Morse code: ... --- ...'), 19 | 'morse code SOS' => 20 | test_zci('Morse code: ... --- ...'), 21 | 'SOS morse' => 22 | test_zci('Morse code: ... --- ...'), 23 | 'SOS morse code' => 24 | test_zci('Morse code: ... --- ...'), 25 | 'morse hello, duck' => 26 | test_zci('Morse code: .... . .-.. .-.. --- --..-- -.. ..- -.-. -.-'), 27 | 'morse code hello, duck' => 28 | test_zci('Morse code: .... . .-.. .-.. --- --..-- -.. ..- -.-. -.-'), 29 | ); 30 | 31 | done_testing; 32 | -------------------------------------------------------------------------------- /t/Palindrome.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'palindrome'; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::Palindrome 14 | )], 15 | 'is foo a palindrome?' => test_zci('"foo" is not a palindrome.'), 16 | 'foo a palindrome?' => test_zci('"foo" is not a palindrome.'), 17 | 'is foof a palindrome?' => test_zci('"foof" is a palindrome.'), 18 | 'foof a palindrome?' => test_zci('"foof" is a palindrome.'), 19 | 'is A dank, sad nap. Eels sleep and ask nada. a palindrome?' => test_zci('"A dank, sad nap. Eels sleep and ask nada." is a palindrome.'), 20 | 'is a dank, sad nap. eels sleep and ask nada. a palindrome?' => test_zci('"a dank, sad nap. eels sleep and ask nada." is a palindrome.'), 21 | 'is dad a palindrome?' => test_zci('"dad" is a palindrome.'), 22 | ); 23 | 24 | done_testing; 25 | 26 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/FlipText.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::FlipText; 2 | # ABSTRACT: appear to flip text upside down via UNICODE. 3 | 4 | use DDG::Goodie; 5 | 6 | use Text::UpsideDown; 7 | 8 | triggers startend => "flip text", "mirror text", "spin text", "rotate text"; 9 | 10 | zci is_cached => 1; 11 | zci answer_type => "flip_text"; 12 | 13 | primary_example_queries 'flip text sentence'; 14 | secondary_example_queries 'mirror text hello'; 15 | description 'flip and mirror text'; 16 | name 'FlipText'; 17 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/FlipText.pm'; 18 | category 'transformations'; 19 | topics 'words_and_games'; 20 | attribution web => [ 'robert.io', 'Robert Picard' ], 21 | github => [ 'http://github.com/rpicard', 'rpicard'], 22 | twitter => ['http://twitter.com/__rlp', '__rlp']; 23 | 24 | handle remainder => sub { 25 | return unless $_; 26 | return upside_down( $_ ); 27 | }; 28 | 29 | 1; 30 | -------------------------------------------------------------------------------- /t/Chess960.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'chess960_position'; 9 | zci is_cached => 0; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::Chess960 14 | )], 15 | map { 16 | $_ => test_zci(qr/^Position \d{1,3}: 17 | White: ([BKNQRP] ?){1,8} 18 | ([BKNQRP] ?){0,8} 19 | Black: ([BKNQRP] ?){1,8} 20 | ([BKNQRP] ?){0,8} 21 | 22 | \(where B is for bishop, 23 | K is for king, 24 | N is for knight, 25 | Q is for queen, 26 | R is for rook, and 27 | P is for pawn\)$/, 28 | html => qr|^$|, 29 | heading => qr/^Position \d+ \(Chess960\)$/, 30 | ) 31 | } ('random chess960 position', 'chess960 random') 32 | ); 33 | 34 | done_testing; 35 | 36 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/Reverse.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::Reverse; 2 | # ABSTRACT: Reverse the order of chars in the remainder 3 | 4 | use DDG::Goodie; 5 | 6 | primary_example_queries 'reverse esrever'; 7 | description 'reverse the order of the characters in your query'; 8 | name 'Reverse'; 9 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/Reverse.pm'; 10 | category 'transformations'; 11 | topics 'words_and_games'; 12 | 13 | attribution github => ['https://github.com/Getty', 'Getty'], cpan => 'GETTY'; 14 | 15 | triggers startend => "reverse text"; 16 | 17 | zci is_cached => 1; 18 | zci answer_type => "reverse"; 19 | 20 | handle remainder => sub { 21 | 22 | return unless $_; # Guard against empty query. 23 | #Filter out requests for DNA/RNA reverse complements, handled 24 | # by the ReverseComplement goodie 25 | return if $_ =~ /^complement\s(of )?[ATCGURYKMSWBVDHN\s-]+$/i; 26 | 27 | return qq|Reversed "$_": | . scalar reverse; 28 | }; 29 | 30 | 1; 31 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/MakeMeASandwich.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::MakeMeASandwich; 2 | # ABSTRACT: XKCD #149 Easter Egg 3 | 4 | use DDG::Goodie; 5 | 6 | name 'Make Me A Sandwich'; 7 | source 'http://xkcd.com/149/'; 8 | description 'Responds in accordance with xkcd #149'; 9 | primary_example_queries 'make me a sandwich', 'sudo make me a sandwich'; 10 | category 'special'; 11 | topics 'geek'; 12 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/MakeMeASandwich.pm'; 13 | attribution twitter => 'mattr555', 14 | github => ['https://github.com/mattr555/', 'Matt Ramina']; 15 | 16 | triggers end => 'make me a sandwich'; 17 | 18 | handle remainder => sub { 19 | return 'Okay.', 20 | html => 'Okay.
More at xkcd' if $_ eq 'sudo'; 21 | return 'What? Make it yourself.', 22 | html => 'What? Make it yourself.
More at xkcd' if $_ eq ''; 23 | return; 24 | }; 25 | 26 | 1; 27 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/LaserShip.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::LaserShip; 2 | # ABSTRACT: Track a package through Lasership 3 | 4 | use DDG::Goodie; 5 | 6 | zci is_cached => 1; 7 | zci answer_type => "lasership"; 8 | 9 | primary_example_queries 'LL12345678'; 10 | description 'Track a package from Lasership'; 11 | name 'Lasership'; 12 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/LaserShip.pm'; 13 | category 'ids'; 14 | topics 'special_interest'; 15 | attribution web => [ 'https://www.duckduckgo.com', 'DuckDuckGo' ], 16 | github => [ 'https://github.com/duckduckgo', 'duckduckgo'], 17 | twitter => ['http://twitter.com/duckduckgo', 'duckduckgo']; 18 | 19 | triggers query_nowhitespace_nodash => qr/(l[a-z]\d{8})/i; 20 | 21 | handle query_nowhitespace_nodash => sub { 22 | return $1, heading => "Lasership Shipment Tracking", html => qq(Track this shipment at Lasership.) if $1; 23 | return; 24 | }; 25 | 26 | 1; 27 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/UltimateAnswer.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::UltimateAnswer; 2 | # ABSTRACT: A Hitchhiker's Guide to the Galaxy easter egg. 3 | 4 | use DDG::Goodie; 5 | 6 | triggers start => 'what is the ultimate answer', 'what is the ultimate answer to life the universe and everything'; 7 | primary_example_queries 'what is the ultimate answer to the life universe and everything'; 8 | 9 | name 'Ultimate Answer'; 10 | description 'Hichhiker\'s Guide to the Galaxy reference.'; 11 | category 'special'; 12 | topics 'entertainment'; 13 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/UltimateAnswer.pm'; 14 | attribution github => ['https://github.com/exoWM/', 'exoWM'], 15 | twitter => ['https://twitter.com/jfeeneywm', 'jfeeneywm']; 16 | 17 | zci answer_type => 'UltimateAnswer'; 18 | 19 | handle remainder => sub { 20 | return unless ($_ eq '' || $_ eq '?'); 21 | return 'Forty-two', html => 'Forty-two'; 22 | 23 | }; 24 | 25 | 1; 26 | -------------------------------------------------------------------------------- /share/goodie/js_keycodes/header.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JavaScript Character Codes 6 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/Roman.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::Roman; 2 | # ABSTRACT: Convert between Roman and Arabic numeral systems. 3 | 4 | use DDG::Goodie; 5 | 6 | use Roman; 7 | 8 | primary_example_queries 'roman numeral MCCCXXXVII'; 9 | secondary_example_queries 'roman 1337', 'roman IV'; 10 | description 'convert between Roman and Arabic numerals'; 11 | name 'Roman Numerals'; 12 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/Roman.pm'; 13 | category 'conversions'; 14 | topics 'cryptography'; 15 | 16 | attribution github => ['https://github.com/mrshu', 'mrshu']; 17 | 18 | triggers any => "roman", "arabic"; 19 | 20 | zci is_cached => 1; 21 | zci answer_type => "roman_numeral_conversion"; 22 | 23 | handle remainder => sub { 24 | s/\s*(?:numeral|number)\s*//i; 25 | return uc(roman($_)) . ' (roman numeral conversion)' if /^\d+$/ && roman($_); 26 | return arabic($_) . ' (roman numeral conversion)' if lc($_) =~ /^[mdclxvi]+$/ && arabic($_); 27 | return; 28 | }; 29 | 30 | 1; 31 | -------------------------------------------------------------------------------- /t/SumOfNaturalNumbers.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci is_cached => 1; 9 | zci answer_type => 'sum'; 10 | 11 | ddg_goodie_test( 12 | [ 13 | 'DDG::Goodie::SumOfNaturalNumbers' 14 | ], 15 | 'sum 1 to 10' => test_zci('Sum of natural numbers from 1 to 10 is 55.'), 16 | 'sum 55 to 63' => test_zci('Sum of natural numbers from 55 to 63 is 531.'), 17 | 'add 33 to 100' => test_zci('Sum of natural numbers from 33 to 100 is 4,522.'), 18 | 'sum 1-10' => test_zci('Sum of natural numbers from 1 to 10 is 55.'), 19 | 'sum from 1 to 10' => test_zci('Sum of natural numbers from 1 to 10 is 55.'), 20 | '1-10 sum' => test_zci('Sum of natural numbers from 1 to 10 is 55.'), 21 | 'add from 1 to 100' => test_zci('Sum of natural numbers from 1 to 100 is 5,050.'), 22 | 23 | # Invalid Input 24 | 'sum 1 --- 10' => undef, 25 | 'sum 100 - 10' => undef, 26 | 'add ten to twenty' => undef, 27 | ); 28 | 29 | done_testing; 30 | -------------------------------------------------------------------------------- /t/Sudoku.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | 6 | use Test::More; 7 | use DDG::Test::Goodie; 8 | 9 | zci answer_type => 'sudoku'; 10 | zci is_cached => 0; 11 | 12 | ddg_goodie_test( 13 | [ 14 | 'DDG::Goodie::Sudoku' 15 | ], 16 | "sudoku" => test_zci( 17 | qr/^[0-9_].*[0-9_]$/s, 18 | html => qr/.*\.*/s, 19 | ), 20 | "play sudoku" => test_zci( 21 | qr/^[0-9_].*[0-9_]$/s, 22 | html => qr/.*\.*/s, 23 | ), 24 | "easy sudoku" => test_zci( 25 | qr/^[0-9_].*[0-9_]$/s, 26 | html => qr/.*\.*/s, 27 | ), 28 | "sudoku hard" => test_zci( 29 | qr/^[0-9_].*[0-9_]$/s, 30 | html => qr/.*\.*/s, 31 | ), 32 | "generate sudoku" => test_zci( 33 | qr/^[0-9_].*[0-9_]$/s, 34 | html => qr/.*\.*/s, 35 | ), 36 | "sudoku party" => undef, 37 | "sudoku toys" => undef, 38 | 'sudoku easy' => test_zci( 39 | qr/[0-9_].*[0-9_]$/s, 40 | html => qr/.*\.*/s, 41 | ), 42 | ); 43 | 44 | done_testing; 45 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/Randagram.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::Randagram; 2 | # ABSTRACT: Take a query and spit it out randomly. 3 | 4 | use DDG::Goodie; 5 | use List::Util 'shuffle'; 6 | 7 | triggers start => "randagram"; 8 | 9 | zci is_cached => 0; 10 | zci answer_type => "randagram"; 11 | 12 | primary_example_queries "randagram jazz hands"; 13 | description "mix up the letters of your query"; 14 | name "Randagram"; 15 | code_url "https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/Randagram.pm"; 16 | category "transformations"; 17 | topics "words_and_games"; 18 | 19 | attribution github => ["https://github.com/crazedpsyc", "crazedpsyc"]; 20 | 21 | handle remainder => sub { 22 | s/^of\s(.*)/$1/i; 23 | my @chars = split(//, $_); #convert each character of the query to an array element 24 | my @garbledChars = shuffle(@chars); #randomly reorder the array 25 | my $garbledAnswer = join('',@garbledChars); #convert array to string 26 | return "Randagram of \"$_\": $garbledAnswer"; 27 | }; 28 | 29 | zci is_cached => 0; 30 | 31 | 1; 32 | -------------------------------------------------------------------------------- /t/Base.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'conversion'; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::Base 14 | )], 15 | 16 | '255 in hex' => test_zci('255 in base 16 is FF'), 17 | '255 in base 16' => test_zci('255 in base 16 is FF'), 18 | '42 in binary' => test_zci('42 in base 2 is 101010'), 19 | '42 in base 2' => test_zci('42 in base 2 is 101010'), 20 | '42 to hex', => test_zci('42 in base 16 is 2A'), 21 | '10 in base 3' => test_zci('10 in base 3 is 101'), 22 | '18442240474082181119 to hex' => test_zci('18442240474082181119 in base 16 is FFEFFFFFFFFFFFFF'), 23 | '999999999999999999999999 to hex' => test_zci('999999999999999999999999 in base 16 is D3C21BCECCEDA0FFFFFF') 24 | 25 | ); 26 | 27 | done_testing; 28 | 29 | -------------------------------------------------------------------------------- /template/lib/DDG/Goodie/Example.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::<: $ia_name :>; 2 | # ABSTRACT: Write and abstract here 3 | # Start at https://dukgo.com/duckduckhack/goodie_overview if you are new 4 | # to instant answer development 5 | 6 | use DDG::Goodie; 7 | 8 | #Attribution 9 | primary_example_queries "first example query", "second example query"; 10 | secondary_example_queries "optional -- demonstrate any additional triggers"; 11 | description "Succinct explanation of what this instant answer does"; 12 | name "<: $ia_name :>"; 13 | icon_url ""; 14 | source ""; 15 | code_url "https://github.com/duckduckgo/zeroclickinfo-spice/blob/master/lib/DDG/Spice/<: $ia_name :>.pm"; 16 | category ""; 17 | topics ""; 18 | attribution github => ["https://github.com/", ""], 19 | twitter => ["https://twitter.com/", ""]; 20 | 21 | # Triggers 22 | triggers any => "triggerWord", "trigger phrase"; 23 | 24 | # Handle statement 25 | handle remainder => sub { 26 | 27 | # optional - regex guard 28 | # return unless qr/^\w+/; 29 | 30 | return $_ if $_; 31 | return; 32 | }; 33 | 34 | 1; 35 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/ZappBrannigan.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::ZappBrannigan; 2 | # ABSTRACT: Zapp Brannigan quotes. 3 | 4 | use DDG::Goodie; 5 | 6 | triggers any => "zapp", "brannigan"; 7 | zci is_cached => 0; 8 | 9 | attribution github => ['http://github.com/nospampleasemam', 'nospampleasemam'], 10 | web => ['http://github.com/nospampleasemam', 'nospampleasemam']; 11 | 12 | primary_example_queries 'zapp brannigan quote'; 13 | name 'Zapp Brannigan'; 14 | description 'retrieve a quote from the famous Zapp Brannigan'; 15 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/ZappBrannigan.pm'; 16 | category 'entertainment'; 17 | topics 'entertainment'; 18 | 19 | my @quotes = share('quotes.txt')->slurp; 20 | 21 | handle query => sub { 22 | # Ensure rand is seeded for each process 23 | srand(); 24 | 25 | return if $_ !~ m/quotes?/; 26 | my $rand = int(rand(scalar(@quotes))); 27 | my $quote = $quotes[$rand]; 28 | chomp $quote; 29 | (my $text = $quote) =~ s/
/\n/g; 30 | return $text, html => $quote; 31 | }; 32 | 33 | 1; 34 | -------------------------------------------------------------------------------- /t/Lowercase.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | 6 | use Test::More; 7 | use DDG::Test::Goodie; 8 | 9 | zci answer_type => 'lowercase'; 10 | zci is_cached => 1; 11 | 12 | ddg_goodie_test( 13 | [ 14 | 'DDG::Goodie::Lowercase' 15 | ], 16 | 'lowercase foo' => 17 | test_zci('foo', 18 | html => qr/foo/), 19 | 'lower case foO' => 20 | test_zci('foo', 21 | html => qr/foo/), 22 | 'lowercase john Doe' => 23 | test_zci('john doe', 24 | html => qr/john doe/), 25 | 'lowercase GitHub' => 26 | test_zci('github', 27 | html => qr/github/), 28 | 'lower case GitHub' => 29 | test_zci('github', 30 | html => qr/github/), 31 | 'lc GitHub' => 32 | test_zci('github', 33 | html => qr/github/), 34 | 'strtolower GitHub' => 35 | test_zci('github', 36 | html => qr/github/), 37 | 'tolower GitHub' => 38 | test_zci('github', 39 | html => qr/github/), 40 | 'how to lowercase text' => undef 41 | ); 42 | 43 | done_testing; 44 | -------------------------------------------------------------------------------- /t/MoonPhases.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci is_cached => 0; 9 | zci answer_type => 'moonphases'; 10 | 11 | my $space_plus = qr/(?:\s|\+)/; 12 | my $wax_wane = qr/(?:Waxing|Waning)$space_plus(?:Gibbous|Crescent)/; 13 | my $quarter = qr/(?:First|Third)$space_plus(?:Quarter)/; 14 | my $named = qr/(?:New|Full)$space_plus(?:Moon)/; 15 | my $phases = qr/$wax_wane|$quarter|$named/; 16 | 17 | my $ascii_answer = qr/^The current lunar phase is: $phases$/; 18 | my $html_answer = qr%^The current lunar phase is: $phases$%; 19 | 20 | ddg_goodie_test( 21 | [qw( DDG::Goodie::MoonPhases)], 22 | 'moon phase' => test_zci($ascii_answer, html => $html_answer,), 23 | 'lunar phase' => test_zci($ascii_answer, html => $html_answer,), 24 | 'phase of the moon' => test_zci($ascii_answer, html => $html_answer,), 25 | 'what is the current lunar phase' => test_zci($ascii_answer, html => $html_answer,), 26 | ); 27 | 28 | done_testing; 29 | -------------------------------------------------------------------------------- /t/PrivateNetwork.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'private_network'; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::PrivateNetwork 14 | )], 15 | map { ("$_" => test_zci( 16 | 'Private network IPv4 addresses (rfc1918): 17 | 10.0.0.0 - 10.255.255.255 | 10.0.0.0/8 18 | 172.16.0.0 - 172.31.255.255 | 172.16.0.0/12 19 | 192.168.0.0 - 192.168.255.255 | 192.168.0.0/16 20 | 21 | Carrier NAT IPv4 private addresses (rfc6598): 22 | 100.64.0.0 - 100.127.255.255 | 100.64.0.0/10 23 | 24 | Test Networks (rfc5735): 25 | TEST-NET-1: 192.0.2.0 - 192.0.2.255 | 192.0.2.0/24 26 | TEST-NET-2: 198.51.100.0 - 198.51.100.255 | 198.51.100.0/24 27 | TEST-NET-3: 203.0.113.0 - 203.0.113.255 | 203.0.113.0/24 28 | Benchmarks: 198.18.0.1 - 198.19.255.255 | 198.18.0.0/15 29 | 30 | Private network IPv6 addresses (rfc4193): 31 | Unique local addresses: fd00::/8 32 | ', 33 | html => qr#.*# 34 | )) } ( 'private network', 'private networks', 'private ips' ) 35 | ); 36 | 37 | done_testing; 38 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/WhereAmI.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::WhereAmI; 2 | # ABSTRACT: Display the user's perceived location from GeoIP 3 | 4 | use DDG::Goodie; 5 | 6 | zci is_cached => 0; 7 | 8 | triggers start => 'where am i', 'my location', 'current location', 'my current location'; 9 | 10 | primary_example_queries 'Where am I?'; 11 | secondary_example_queries 'my location'; 12 | description 'display your perceived location'; 13 | name 'WhereAmI'; 14 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/WhereAmI.pm'; 15 | category 'computing_tools'; 16 | topics 'travel'; 17 | attribution twitter => 'crazedpsyc', 18 | cpan => 'CRZEDPSYC' ; 19 | 20 | handle remainder => sub { 21 | return if length($_) or !$loc or !$loc->city; 22 | 23 | my $answer = 'You appear to be near ' . 24 | $loc->city.', '. 25 | ($loc->region_name ? $loc->region_name.', ' : ''). 26 | $loc->country_name 27 | ; 28 | my $coords = 'Lat: '.$loc->latitude.', Lon: '.$loc->longitude; 29 | 30 | return $answer . " ($coords).", html => $answer . ".
$coords."; 31 | }; 32 | 33 | 1; 34 | -------------------------------------------------------------------------------- /share/goodie/find_anagrams/generate_word_json.pl: -------------------------------------------------------------------------------- 1 | #!/usr/local/bin/perl 2 | # 3 | # Anagram Generator 4 | # 5 | 6 | use utf8; 7 | use JSON::XS qw(encode_json decode_json); 8 | use File::Slurp qw(read_file write_file); 9 | 10 | # open file 11 | open(FILE, "/usr/share/dict/words") or die("Unable to open file"); 12 | 13 | # read file into an array 14 | my %dict = (); 15 | 16 | while (my $line = ) { 17 | chomp $line; 18 | 19 | # get last two letters of word. the unix words file has man duplicated possessive words with the 's appended which do not serve our purpose for anagram finding. 20 | $amt = substr($line, -2); 21 | 22 | unless ($amt eq '\'s'){ 23 | 24 | $lcline = lc($line); 25 | 26 | ## Spliting the string with no delimeter. 27 | $sorted_string = join("",sort(split("",$lcline))); 28 | 29 | if (exists $dict{$sorted_string}) { 30 | push @{$dict{$sorted_string}}, $line; 31 | } 32 | else { 33 | push @{$dict{$sorted_string}}, $line; 34 | } 35 | } 36 | } 37 | 38 | # close file 39 | close(FILE); 40 | 41 | my $json = encode_json \%dict; 42 | write_file('words.json', { binmode => ':raw' }, $json); 43 | -------------------------------------------------------------------------------- /t/DHL.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'dhl'; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( DDG::Goodie::DHL )], 13 | 'dhl 123456789' => test_zci( 14 | "123456789", 15 | heading => 'DHL Shipment Tracking', 16 | html => qq(Track this shipment at DHL.) 17 | ), 18 | 'tracking 1234567891' => test_zci( 19 | "1234567891", 20 | heading => 'DHL Shipment Tracking', 21 | html => qq(Track this shipment at DHL.) 22 | ), 23 | 'DHL 123456789' => test_zci( 24 | '123456789', 25 | heading => 'DHL Shipment Tracking', 26 | html => "Track this shipment at DHL.", 27 | ), 28 | ); 29 | 30 | done_testing; 31 | 32 | -------------------------------------------------------------------------------- /t/EmailValidator.t: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'emailvalidator'; 9 | zci is_cached => 0; 10 | 11 | ddg_goodie_test( 12 | [ 13 | 'DDG::Goodie::EmailValidator' 14 | ], 15 | 'validate foo' => undef, 16 | 'validate my email foo@example.com' => test_zci (qr/is valid/), 17 | 'validate my email foo+abc@example.com' => test_zci (qr/is valid/), 18 | 'validate my email foo.bar@example.com' => test_zci (qr/is valid/), 19 | 'validate user@exampleaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.com' => test_zci (qr/Please check the address/), 20 | 'validate foo@example.com' => test_zci (qr/is valid/), 21 | 'validate foo@!!!.com' => test_zci(qr/Please check the fully qualified domain name/), 22 | 'validate foo@example.lmnop' => test_zci(qr/Please check the top-level domain/), 23 | ); 24 | 25 | done_testing; 26 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/Lowercase.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::Lowercase; 2 | # ABSTRACT: Convert a string into lowercase. 3 | 4 | use DDG::Goodie; 5 | 6 | name "Lowercase"; 7 | description "Convert a string into lowercase."; 8 | primary_example_queries "lowercase GitHub"; 9 | secondary_example_queries "lower case GitHub"; 10 | category 'conversions'; 11 | topics 'programming'; 12 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/Lowercase.pm'; 13 | attribution github => ["DavidMascio"]; 14 | 15 | zci is_cached => 1; 16 | zci answer_type => "lowercase"; 17 | 18 | triggers start => 'lowercase', 'lower case', 'lc', 'strtolower', 'tolower'; 19 | 20 | handle remainder => sub { 21 | return unless $_; 22 | my $lower = lc $_; 23 | my $text = $lower; 24 | 25 | # Encode the variable before putting it in HTML. 26 | # There's no need to encode the $text variable because that gets encoded internally. 27 | $lower = html_enc($lower); 28 | 29 | my $html = qq(
$lower
); 30 | 31 | return $text, html => $html; 32 | }; 33 | 34 | 1; 35 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/GreatestCommonFactor.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::GreatestCommonFactor; 2 | # ABSTRACT: Returns the greatest common factor of the two numbers entered 3 | 4 | use DDG::Goodie; 5 | 6 | zci answer_type => "greatest_common_factor"; 7 | zci is_cached => 1; 8 | 9 | triggers startend => 'greatest common factor', 'GCF', 'gcf'; 10 | 11 | primary_example_queries 'GCF 121 11'; 12 | secondary_example_queries '99 9 greatest common factor'; 13 | description 'returns the greatest common factor of the two entered numbers'; 14 | name 'GreatestCommonFactor'; 15 | topics 'math'; 16 | category 'calculations'; 17 | attribution github => [ 'https://github.com/austinheimark', 'austin_heimark' ]; 18 | 19 | handle remainder => sub { 20 | sub gcf { 21 | my ($x, $y) = @_; 22 | ($x, $y) = ($y, $x % $y) while $y; 23 | return $x; 24 | } 25 | 26 | my $result = 'Greatest common factor of ' . $1 . ' and ' . $2 . ' is ' . gcf($1,$2) . '.' if /^(\d+)\s(\d+)$/; 27 | my $link = qq(More at Wikipedia.); 28 | 29 | return $result, 'html' => "$result $link" if $result; 30 | return; 31 | }; 32 | 33 | 1; 34 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/Unicornify.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::Unicornify; 2 | # ABSTRACT: Return Gravatar image given an email address 3 | 4 | use DDG::Goodie; 5 | use CGI qw/img/; 6 | use Email::Valid; 7 | use Unicornify::URL; 8 | 9 | triggers start => 'unicornify'; 10 | attribution github => ['https://github.com/flaming-toast', 'flaming-toast']; 11 | 12 | handle remainder => sub { 13 | my $link = 'http://unicornify.appspot.com/'; 14 | if (Email::Valid->address($_)) { 15 | s/[\s\t]+//g; # strip whitespace from the remainder, we just need the email address. 16 | my $answer = 'This is a unique unicorn for ' . $_ . ':' . "\nLearn more at unicornify.appspot.com"; 17 | my $heading = $_ . ' (Unicornify)'; 18 | my $html = 'This is a unique unicorn for ' . $_ . ':' 19 | .'
' 20 | .'' 21 | . 'Learn more at unicornify.appspot.com'; 22 | 23 | return $answer, heading => $heading, html => $html; 24 | } 25 | return; 26 | }; 27 | 28 | zci is_cached => 1; 29 | 30 | 1; 31 | 32 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/GenerateMAC.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::GenerateMAC; 2 | # ABSTRACT: generates a random network MAC address 3 | 4 | use DDG::Goodie; 5 | 6 | triggers startend => "generate mac addr", 7 | "generate mac address", 8 | "random mac addr", 9 | "random mac address", 10 | "mac address generator", 11 | "mac address random"; 12 | 13 | zci answer_type => "MAC Address"; 14 | zci is_cached => 0; 15 | 16 | primary_example_queries 'please generate mac address'; 17 | description 'generates a MAC address'; 18 | name "GenerateMAC"; 19 | 20 | attribution github => [ 'https://github.com/UnGround', 'Charlie Belmer' ], 21 | web => ['http://www.charliebelmer.com','Charlie Belmer']; 22 | 23 | handle remainder => sub { 24 | # Ensure rand is seeded for each process 25 | srand(); 26 | 27 | my $address = join(':', map {sprintf '%0.2X', rand(255)}(1..6)); 28 | 29 | my $text_response = "Here's a random MAC address: $address"; 30 | my $html_response = "Here's a random MAC address: $address"; 31 | return $text_response, html => $html_response; 32 | }; 33 | 34 | 1; 35 | -------------------------------------------------------------------------------- /t/MD5.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'md5'; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::MD5 14 | )], 15 | 'md5 digest this!' => test_zci('3838c8fb10a114e6d21203359ef147ad', html=>qr/.*/), 16 | 'duckduckgo md5' => test_zci('96898bb8544fa56b03c08cdc09886c6c', html=>qr/.*/), 17 | 'md5sum the sum of a string' => test_zci('a704c8833f9850cd342ead27207ca1a1', html=>qr/.*/), 18 | 'md5 of password' => test_zci('5f4dcc3b5aa765d61d8327deb882cf99', html=>qr/.*/), 19 | 'md5sum of "this"' => test_zci('9e925e9341b490bfd3b4c4ca3b0c1ef2', html=>qr/.*/), 20 | 'md5 of "this' => test_zci('53d3e72f097a74f6d439fa88b91d5a71', html=>qr/.*/), 21 | 'md5 hash' => test_zci('0800fc577294c34e0b28ad2839435945', html=>qr/.*/), 22 | 'md5 hash ' => test_zci('0800fc577294c34e0b28ad2839435945', html=>qr/.*/), 23 | 'md5 hash of' => test_zci('8bf8854bebe108183caeb845c7676ae4', html=>qr/.*/), 24 | 'md5 hash of password ' => test_zci('5f4dcc3b5aa765d61d8327deb882cf99', html=>qr/.*/), 25 | ); 26 | 27 | done_testing; 28 | -------------------------------------------------------------------------------- /t/Parcelforce.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'parcelforce'; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( DDG::Goodie::Parcelforce )], 13 | 'parcelforce track PBTM8041434001' => test_zci( 14 | "PBTM8041434001", 15 | heading => 'Parcelforce Tracking', 16 | html => 17 | qq(Track this parcel at Parcelforce.) 18 | ), 19 | 'royal mail track parcel QE001331410GB' => test_zci( 20 | "QE001331410GB", 21 | heading => 'Parcelforce Tracking', 22 | html => 23 | qq(Track this parcel at Parcelforce.) 24 | ), 25 | 'track PBTM8237263001' => test_zci( 26 | "PBTM8237263001", 27 | heading => 'Parcelforce Tracking', 28 | html => 29 | qq(Track this parcel at Parcelforce.) 30 | ) 31 | ); 32 | 33 | done_testing; 34 | 35 | -------------------------------------------------------------------------------- /t/IPS.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'ips'; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( DDG::Goodie::IPS )], 13 | 'EM999999999IN' => test_zci( 14 | "EM999999999IN", 15 | heading => 'IPS Shipment Tracking', 16 | html => qq(Track this shipment at IPS.) 17 | ), 18 | 'em123456789hr' => test_zci( 19 | "em123456789hr", 20 | heading => 'IPS Shipment Tracking', 21 | html => qq(Track this shipment at IPS.) 22 | ), 23 | 'EM 999 999 999 IN' => test_zci( 24 | "EM999999999IN", 25 | heading => 'IPS Shipment Tracking', 26 | html => qq(Track this shipment at IPS.) 27 | ) 28 | ); 29 | 30 | done_testing; 31 | 32 | -------------------------------------------------------------------------------- /t/ISO639.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | use utf8; 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci is_cached => 1; 9 | 10 | ddg_goodie_test( 11 | ["DDG::Goodie::ISO639"], 12 | "iso639 ab" => test_zci( 13 | qq(ISO 639: Abkhazian - ab), 14 | html => qq(ISO 639: Abkhazian - ab), 15 | answer_type => "iso639" 16 | ), 17 | "iso639 english" => test_zci( 18 | qq(ISO 639: English - en), 19 | html => qq(ISO 639: English - en), 20 | answer_type => "iso639" 21 | ), 22 | "iso639 eng" => test_zci( 23 | qq(ISO 639: English - en), 24 | html => qq(ISO 639: English - en), 25 | answer_type => "iso639" 26 | ), 27 | "iso-639 en" => test_zci( 28 | qq(ISO 639: English - en), 29 | html => qq(ISO 639: English - en), 30 | answer_type => "iso639" 31 | ), 32 | "iso639 xyz" => undef, 33 | ); 34 | 35 | done_testing; 36 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/BirthStone.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::BirthStone; 2 | # ABSTRACT: Returns the birthstone of the queried month 3 | 4 | use DDG::Goodie; 5 | 6 | triggers startend => 'birthstone', 'birth stone'; 7 | 8 | zci answer_type => "BirthStone"; 9 | zci is_cached => 1; 10 | 11 | primary_example_queries 'birthstone april'; 12 | secondary_example_queries 'may birth stone'; 13 | description 'returns the birth stone of the specified month'; 14 | name 'BirthStone'; 15 | topics 'special_interest', 'entertainment'; 16 | category 'random'; 17 | attribution github => [ 'https://github.com/austinheimark', 'austin_heimark' ]; 18 | 19 | my %birthstones = ( 20 | "january" => "Garnet", 21 | "february" => "Amethyst", 22 | "march" => "Aquamarine", 23 | "april" => "Diamond", 24 | "may" => "Emerald", 25 | "june" => "Pearl", 26 | "july" => "Ruby", 27 | "august" => "Peridot", 28 | "september" => "Sapphire", 29 | "october" => "Opal", 30 | "november" => "Topaz", 31 | "december" => "Turquoise" 32 | ); 33 | 34 | handle remainder => sub { 35 | my $month = lc $_; 36 | my $stone = $birthstones{$month}; 37 | return ucfirst $month . " birthstone: $stone" if $stone; 38 | return; 39 | }; 40 | 41 | 1; 42 | -------------------------------------------------------------------------------- /t/VimCheatSheet.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | 6 | use Test::More; 7 | use DDG::Test::Goodie; 8 | 9 | zci answer_type => 'vim_cheat'; 10 | 11 | # This goodie always returns the same answer whenever its triggered 12 | my $test_zci = test_zci( 13 | qr/^Cursor movement.*Insert mode.*Editing.*Marking text.*/s, 14 | heading => 'Vim Cheat Sheet', 15 | html => qr#$#s, 16 | ); 17 | 18 | ddg_goodie_test( 19 | [ 'DDG::Goodie::VimCheatSheet' ], 20 | 'vi cheat sheet' => $test_zci, 21 | 'vi cheatsheet' => $test_zci, 22 | 'vi commands' => $test_zci, 23 | 'vi guide' => $test_zci, 24 | 'vi help' => $test_zci, 25 | 'vi quick reference' => $test_zci, 26 | 'vi reference' => $test_zci, 27 | 'vim cheat sheet' => $test_zci, 28 | 'vim cheatsheet' => $test_zci, 29 | 'vim commands' => $test_zci, 30 | 'vim guide' => $test_zci, 31 | 'vim help' => $test_zci, 32 | 'vim quick reference' => $test_zci, 33 | 'vim reference' => $test_zci, 34 | ); 35 | 36 | done_testing; 37 | -------------------------------------------------------------------------------- /t/Shortcut.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use utf8; 4 | use strict; 5 | use warnings; 6 | use Test::More; 7 | use DDG::Test::Goodie; 8 | 9 | zci answer_type => 'shortcut'; 10 | 11 | my $start = 'The shortcut for '; 12 | my $first = 'Show desktop in Windows is ⊞Win+D or ⊞Win+M (then use ⊞Win+⇧Shift+M to bring back all windows)'; 13 | my $second = 'New folder in KDE/GNOME is Ctrl+⇧Shift+N'; 14 | my $third = 'Redo in Mac OS is ⇧Shift+⌘Cmd+Z'; 15 | my $fourth = 'Paste special in KDE/GNOME is Ctrl+⇧Shift+V'; 16 | my $br = '
'; 17 | my $link = 'More at Wikipedia'; 18 | 19 | ddg_goodie_test( 20 | [qw( DDG::Goodie::Shortcut 21 | )], 22 | 'windows show desktop shortcut' => test_zci($start . $first, html => $start . $first . $br . $link), 23 | 'ubuntu shortcut new folder' => test_zci($start . $second, html => $start . $second . $br . $link), 24 | 'redo shortcut mac' => test_zci($start . $third, html => $start . $third . $br . $link), 25 | 'paste special shortcut' => undef #test_zci($start . $fourth, html => $start . $fourth . $br . $link) 26 | ); 27 | 28 | done_testing; 29 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/RandomName.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::RandomName; 2 | # ABSTRACT: Return random first and last name 3 | 4 | use DDG::Goodie; 5 | 6 | use Data::RandomPerson; 7 | 8 | triggers start => 'random'; 9 | zci answer_type => 'rand'; 10 | 11 | name 'RandomName'; 12 | description 'returns a random and fictive title, first- and lastname and day of birth'; 13 | category 'random'; 14 | topics 'words_and_games'; 15 | primary_example_queries 'random name'; 16 | secondary_example_queries 'random person'; 17 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/RandomName.pm'; 18 | attribution github => ['https://github.com/stelim', 'Stefan Limbacher'], 19 | twitter => ['http://twitter.com/stefanlimbacher', 'Stefan Limbacher']; 20 | 21 | handle remainder => sub { 22 | return unless /name|person/i; 23 | my $person = Data::RandomPerson->new()->create(); 24 | my $name = "$person->{firstname} $person->{lastname}"; 25 | my %genders = (m => 'Male', f => 'Female'); 26 | return "Name: $name\nGender: $genders{$person->{gender}}\nDate of birth: $person->{dob}\nAge: $person->{age}", 27 | heading => "Random Person" if /person/i; 28 | return "$name (random)"; 29 | }; 30 | 31 | 32 | 1; 33 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/Regexp.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::Regexp; 2 | # ABSTRACT: Parse a regexp. 3 | 4 | use DDG::Goodie; 5 | 6 | use Safe; 7 | 8 | zci answer_type => "regexp"; 9 | 10 | primary_example_queries 'regexp /(.*)/ ddg'; 11 | description 'Regular expressions'; 12 | name 'regexp'; 13 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/Regexp.pm'; 14 | category 'computing_tools'; 15 | topics 'programming', 'sysadmin'; 16 | attribution web => [ 'https://www.duckduckgo.com', 'DuckDuckGo' ], 17 | github => [ 'https://github.com/duckduckgo', 'duckduckgo'], 18 | twitter => ['http://twitter.com/duckduckgo', 'duckduckgo']; 19 | 20 | triggers query_lc => qr/^regex[p]? [\/\\](.+?)[\/\\] (.+)$/i; 21 | 22 | handle query => sub { 23 | my $regexp = $1; 24 | my $str = $2; 25 | 26 | my $compiler = Safe->new->reval(q{ sub { qr/$_[0]/ } }); 27 | 28 | sub compile_re { 29 | my ( $re, $compiler ) = @_; 30 | $compiler->($re); 31 | } 32 | 33 | my @results = (); 34 | eval { 35 | @results = $str =~ compile_re($regexp, $compiler); 36 | }; 37 | 38 | return join( ' | ', @results ), heading => 'Regexp Result' if @results; 39 | return; 40 | }; 41 | 42 | 1; 43 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/Coin.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::Coin; 2 | # ABSTRACT: flip a (fair) coin. 3 | 4 | use DDG::Goodie; 5 | 6 | zci is_cached => 0; 7 | 8 | triggers start => 'flip', 'toss', 'coin', 'heads'; 9 | 10 | primary_example_queries 'flip a coin', 'toss a coin'; 11 | secondary_example_queries 'flip 4 coins', 'heads or tails'; 12 | 13 | description 'flip a coin'; 14 | name 'Coin Flip'; 15 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/Coin.pm'; 16 | topics 'trivia'; 17 | category 'random'; 18 | attribution github => [ 'http://github.com/mattlehning', 'mattlehning' ]; 19 | 20 | handle query_lc => sub { 21 | # Ensure rand is seeded for each process 22 | srand(); 23 | 24 | my $flips; 25 | if ($_ =~ /^(heads or tails[ ]?[\?]?)|((flip|toss) a coin)$/) { 26 | $flips = 1; 27 | } 28 | elsif ($_ =~ /^(?:flip|toss) (\d{0,2}) coins?$/) { 29 | $flips = $1; 30 | } 31 | 32 | return unless ($flips); 33 | 34 | my @output; 35 | my @ht = ("heads", "tails"); 36 | 37 | for (1..$flips) { 38 | my $flip = $ht[int rand @ht]; 39 | push @output, $flip; 40 | } 41 | 42 | my $result = join(', ', @output) . ' (random)' if @output; 43 | return ($result, html => $result) if @output; 44 | return; 45 | }; 46 | 47 | 1; 48 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/Palindrome.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::Palindrome; 2 | # ABSTRACT: Return if the a string is a palindrome, formatted requests: 3 | # 'is a[n] palindrome[?]' or 'isPalindrome ' 4 | 5 | use DDG::Goodie; 6 | 7 | triggers any => 'palindrome'; 8 | 9 | zci is_cached => 1; 10 | 11 | primary_example_queries 'is a dank, sad nap. eels sleep and ask nada. a palindrome?'; 12 | secondary_example_queries 'is foo a palindrome?', 'is dad a palindrome?'; 13 | description 'check if a given string is a palindrome'; 14 | name 'Palindrome'; 15 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/Palindrome.pm'; 16 | category 'language'; 17 | topics 'words_and_games'; 18 | 19 | handle query => sub { 20 | #Remove the trigger text from the query. 21 | return unless /^(?:is\s+|)(.*?)\s+an?\s*palindrome\??$/i; 22 | 23 | my $palindrome = $1; 24 | 25 | my $is_palindrome = 0; 26 | 27 | # Clean up. 28 | my $clean_palindrome = lc $palindrome; 29 | $clean_palindrome =~ s/[^a-z0-9]+//g; 30 | 31 | $is_palindrome = 1 if $clean_palindrome eq scalar reverse $clean_palindrome; 32 | 33 | #Check to see if it is a palindrome. 34 | return $is_palindrome ? qq("$palindrome" is a palindrome.) : qq("$palindrome" is not a palindrome.); 35 | }; 36 | 37 | 1; 38 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/Tips.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::Tips; 2 | # ABSTRACT: calculate a tip on a bill 3 | 4 | use DDG::Goodie; 5 | 6 | triggers any => 'tip', 'tips', '%'; 7 | 8 | primary_example_queries '20% tip on $21.63'; 9 | secondary_example_queries '20 percent tip for a $20 bill'; 10 | description 'calculate a total including a percentage tip'; 11 | name 'Tips'; 12 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/Tips.pm'; 13 | category 'calculations'; 14 | topics 'everyday'; 15 | attribution github => [ 'http://github.com/mattlehning', 'mattlehning' ]; 16 | 17 | handle query_lc => sub { 18 | return unless my ($p, $is_tip, $sign,$num) = $_ =~/^(\d{1,3})(?: ?%| percent) (?:(tip (?:on|for|of))|of)(?: an?)? ([\$\-]?)(\d+(\.?)(?(5)\d+))(?: bill)?$/; 19 | $p /= 100; 20 | my $t = $p*$num; 21 | my $tot; 22 | 23 | if ($is_tip) { 24 | $tot = $num + $t; 25 | } 26 | 27 | $t = sprintf "%.2f", $t; 28 | $tot = sprintf "%.2f", $tot if $tot; 29 | 30 | if ($tot) { 31 | zci answer_type => 'tip'; 32 | return "Tip: \$$t; Total: \$$tot"; 33 | } 34 | $t = $sign . $t; 35 | $tot = $sign . $tot if $tot; 36 | zci answer_type => 'percentage'; 37 | return "$t is ".($p*100)." percent of $sign$num"; 38 | 39 | }; 40 | 41 | 1; 42 | -------------------------------------------------------------------------------- /t/PrimeFactors.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use utf8; 6 | 7 | use Test::More; 8 | use DDG::Test::Goodie; 9 | 10 | zci answer_type => "prime_factors"; 11 | zci is_cached => 1; 12 | 13 | ddg_goodie_test( 14 | [qw( 15 | DDG::Goodie::PrimeFactors 16 | )], 17 | '72 prime factors' => test_zci('The prime factorization of 72 is 2^3 × 3^2', 18 | html => 'The prime factorization of 72 is 23 × 32'), 19 | 'prime factors of 111' => test_zci('The prime factorization of 111 is 3 × 37', 20 | html => 'The prime factorization of 111 is 3 × 37'), 21 | 'prime factors of 30' => test_zci('The prime factorization of 30 is 2 × 3 × 5', 22 | html => 'The prime factorization of 30 is 2 × 3 × 5'), 23 | 'prime factorization of 45' => test_zci('The prime factorization of 45 is 3^2 × 5', 24 | html => 'The prime factorization of 45 is 32 × 5'), 25 | 'factorize 128' => test_zci('The prime factorization of 128 is 2^7', 26 | html => 'The prime factorization of 128 is 27'), 27 | '42 prime factorize' => test_zci('The prime factorization of 42 is 2 × 3 × 7', 28 | html => 'The prime factorization of 42 is 2 × 3 × 7'), 29 | 'optimus prime 45' => undef, 30 | ); 31 | 32 | done_testing; 33 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/UnixTime.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::UnixTime; 2 | # ABSTRACT: epoch -> human readable time 3 | 4 | use DDG::Goodie; 5 | 6 | use DateTime; 7 | 8 | triggers startend => "unixtime", "time", "timestamp", "datetime", "epoch", "unix time", "unix timestamp", "unix time stamp", "unix epoch"; 9 | 10 | zci answer_type => "time_conversion"; 11 | zci is_cached => 0; 12 | 13 | attribution github => ['https://github.com/codejoust', 'codejoust']; 14 | 15 | primary_example_queries 'unix time 0000000000000'; 16 | secondary_example_queries 'epoch 0', 'epoch 2147483647'; 17 | description 'convert a unix epoch to human-readable time'; 18 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/UnixTime.pm'; 19 | category 'calculations'; 20 | topics 'sysadmin'; 21 | 22 | handle remainder => sub { 23 | return unless defined $_; 24 | 25 | my $time_input = shift; 26 | my $time_utc; 27 | eval { 28 | $time_input = int(length($time_input) >= 13 ? ($time_input / 1000) : ($time_input + 0)); 29 | $time_utc = DateTime->from_epoch( 30 | epoch => $time_input, 31 | time_zone => "UTC" 32 | )->strftime("%a %b %d %T %Y %z"); 33 | }; 34 | 35 | return unless $time_utc; 36 | return "Unix Time: " . $time_utc; 37 | }; 38 | 39 | 1; 40 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/AspectRatio.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::AspectRatio; 2 | # ABSTRACT: Calculates aspect ratio based on previously defined one 3 | 4 | use DDG::Goodie; 5 | 6 | triggers start => "aspect ratio"; 7 | 8 | zci is_cached => 1; 9 | zci answer_type => "aspect_ratio"; 10 | 11 | primary_example_queries 'aspect ratio 4:3 640:?'; 12 | description 'complete the missing value with a given ratio'; 13 | name 'AspectRatio'; 14 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/AspectRatio.pm'; 15 | category 'calculations'; 16 | topics 'math'; 17 | attribution github => [ 'https://github.com/mrshu', 'mrshu' ], 18 | twitter => [ 'https://twitter.com/mr__shu', 'mr__shu' ]; 19 | 20 | handle remainder => sub { 21 | my $input = $_; 22 | my $result = 0; 23 | my $ratio = 0; 24 | 25 | if ($input =~ /^(\d+(?:\.\d+)?)\s*\:\s*(\d+(?:\.\d+)?)\s*(?:(?:(\?)\s*:\s*(\d+(?:\.\d+)?))|(?:(\d+(?:\.\d+)?)\s*:\s*(\?)))$/){ 26 | $ratio = $1 / $2; 27 | 28 | if ($6 && $6 eq "?") { 29 | $result = $5 / $ratio; 30 | return "Aspect ratio: $5:$result ($1:$2)"; 31 | } elsif ($3 && $3 eq "?") { 32 | $result = $4 * $ratio; 33 | return "Aspect ratio: $result:$4 ($1:$2)"; 34 | } 35 | } 36 | return; 37 | }; 38 | 39 | 1; 40 | -------------------------------------------------------------------------------- /share/goodie/crontab_cheat_sheet/crontab_cheat_sheet.txt: -------------------------------------------------------------------------------- 1 | # Commands are executed by cron when the minute, hour, and month of year 2 | # fields match the current time, and at least one of the two day fields 3 | # (day of month, or day of week) match the current time. A field may be 4 | # an asterisk (*), which will always match. 5 | # 6 | # Fields in order: 7 | # minute (0-59) 8 | # hour (0-23) 9 | # day of month (1-31) 10 | # month (1-12 or first three letters) 11 | # day of week (0-7 or first three letters; 0 or 7 is Sunday) 12 | 13 | # Run every Tuesday at 2:30am 14 | 30 2 * * tue /path/to/command 15 | # or 16 | 30 2 * * 2 /path/to/command 17 | 18 | # Run every 10 minutes 19 | */10 * * * * /path/to/command 20 | 21 | # Run every 2 hours, on the half-hour 22 | 30 */2 * * * /path/to/command 23 | 24 | # Run every 2 hours on the half hour, but only on weekdays 25 | 30 */2 * * 1-5 /path/to/command 26 | 27 | # Run at 12:05, 13:05, ..., and 18:05 28 | 5 12-18 * * * /path/to/command 29 | 30 | # Run at 12:05, 14:05, 16:05, and 18:05 31 | 5 12-18/2 * * * /path/to/command 32 | 33 | # Run on the first day of every month, at 12:00am 34 | 0 0 1 * * /path/to/command 35 | 36 | # Run on the first day of every third month, at 12:00am 37 | 0 0 1 */3 * /path/to/command 38 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/UN.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::UN; 2 | # ABSTRACT: Gives a description for a given UN number 3 | 4 | use DDG::Goodie; 5 | use Number::UN 'get_un'; 6 | 7 | attribution github => ['https://github.com/tantalor', 'tantalor']; 8 | 9 | primary_example_queries 'UN Number 0009'; 10 | description 'gives a description for a given UN number'; 11 | name 'UN Number'; 12 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/UN.pm'; 13 | category 'facts'; 14 | topics 'everyday'; 15 | 16 | use constant WPHREF => "http://en.wikipedia.org/wiki/List_of_UN_numbers_%04d_to_%04d"; 17 | 18 | triggers start => 'un'; 19 | 20 | zci is_cached => 1; 21 | zci answer_type => 'united_nations'; 22 | 23 | handle remainder => sub { 24 | my $num = shift or return; 25 | $num =~ s/^number\s+//gi; 26 | return unless $num =~ /^\d+$/; 27 | 28 | my %un = get_un($num) or return; 29 | $un{description} =~ s/\.$//; 30 | return (sprintf qq(UN Number %04d - %s.), $num, $un{description}), html => sprintf qq(UN Number %04d - %s.), wphref($num), $num, $un{description}; 31 | }; 32 | 33 | # Wikipedia attribution per CC-BY-SA 34 | sub wphref { 35 | my $num = shift; 36 | my $lower = int($num / 100) * 100 + 1; 37 | my $upper = $lower + 99; 38 | return sprintf WPHREF, $lower, $upper; 39 | } 40 | 41 | 1; 42 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/GUID.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::GUID; 2 | # ABSTRACT: Generated a GUID on-demand. 3 | 4 | use DDG::Goodie; 5 | use Data::GUID; 6 | 7 | triggers start => 'globally', 'universally', 'rfc', 'guid', 'uuid'; 8 | 9 | zci answer_type => "guid"; 10 | zci is_cached => 0; 11 | 12 | primary_example_queries 'guid'; 13 | secondary_example_queries 'uuid'; 14 | description 'generate a unique indentifier'; 15 | name 'GUID'; 16 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/GUID.pm'; 17 | category 'computing_tools'; 18 | topics 'programming'; 19 | attribution twitter => 'crazedpsyc', 20 | cpan => 'CRZEDPSYC' , 21 | twitter => 'loganmccamon', 22 | github => 'loganom'; 23 | 24 | my %guid = ( 25 | 'guid' => 0, 26 | 'uuid' => 1, 27 | 'globally unique identifier' => 0, 28 | 'universally unique identifier' => 1, 29 | 'rfc 4122' => 0, 30 | ); 31 | 32 | handle query_lc => sub { 33 | return unless exists $guid{$_}; 34 | if (my $guid = Data::GUID->new) { 35 | my $guid_string = $guid->as_string; 36 | 37 | return answer => $guid_string, 38 | html => qq(), 39 | heading => 'Random GUID'; 40 | } 41 | return; 42 | }; 43 | 1; 44 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/GoldenRatio.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::GoldenRatio; 2 | # ABSTRACT: find number related to the given number by the Golden Ratio. 3 | 4 | use DDG::Goodie; 5 | 6 | zci answer_type => "golden_ratio"; 7 | 8 | zci is_cached => 1; 9 | 10 | triggers start => "golden ratio"; 11 | 12 | primary_example_queries 'golden ratio 900:?'; 13 | secondary_example_queries 'golden ratio ?:123.345'; 14 | description 'find the number in the golden ratio with a number'; 15 | name 'GoldenRatio'; 16 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/GoldenRatio.pm'; 17 | category 'calculations'; 18 | topics 'math'; 19 | attribution twitter => 'crazedpsyc', 20 | cpan => 'CRZEDPSYC' ; 21 | 22 | handle remainder => sub { 23 | my $input = $_; 24 | my $golden_ratio = (1 + sqrt(5)) / 2; 25 | my $result = 0; 26 | 27 | if ($input =~ /^(?:(?:(\?)\s*:\s*(\d+(?:\.\d+)?))|(?:(\d+(?:\.\d+)?)\s*:\s*(\?)))$/) { 28 | if ($1 && $1 eq "?") { 29 | # ? : x 30 | $result = $2 / $golden_ratio; 31 | return "Golden ratio: $result : $2"; 32 | } elsif ($4 && $4 eq "?") { 33 | # x : ? 34 | $result = $3 * $golden_ratio; 35 | return "Golden ratio: $3 : $result"; 36 | } 37 | } 38 | return; 39 | }; 40 | 1; 41 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/Base.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::Base; 2 | # ABSTRACT: convert numbers between arbitrary bases 3 | 4 | use DDG::Goodie; 5 | 6 | use Math::Int2Base qw/int2base/; 7 | use 5.010; 8 | use bigint; 9 | 10 | my %base_map = ( 11 | hex => 16, 12 | hexadecimal => 16, 13 | oct => 8, 14 | octal => 8, 15 | binary => 2, 16 | ); 17 | 18 | triggers any => 'base', keys %base_map; 19 | 20 | zci answer_type => "conversion"; 21 | zci is_cached => 1; 22 | 23 | primary_example_queries '255 in hex'; 24 | secondary_example_queries '255 in base 16', '42 in binary'; 25 | description 'convert a number to an arbitrary base'; 26 | name 'Base'; 27 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/Base.pm'; 28 | category 'conversions'; 29 | topics 'math'; 30 | attribution web => [ 'http://perlgeek.de/blog-en', 'Moritz Lenz' ], 31 | github => [ 'http://github.com/moritz', 'moritz']; 32 | 33 | 34 | handle query_clean => sub { 35 | return unless /^([0-9]+)\s*(?:(?:in|as|to)\s+)?(hex|hexadecimal|octal|oct|binary|base\s*([0-9]+))$/; 36 | my $number = $1; 37 | my $base = $3 // $base_map{$2}; 38 | return if $base < 2 || $base > 36; 39 | my $based = int2base($number, $base); 40 | return "$number in base $base is $based"; 41 | }; 42 | 43 | 1; 44 | -------------------------------------------------------------------------------- /t/Frequency.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci is_cached => 1; 9 | zci answer_type => 'frequency'; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::Frequency 14 | )], 15 | 'frequency of all in test' => test_zci('Frequency: e:1/4 s:1/4 t:2/4'), 16 | 'frequency of all letters in test' => test_zci('Frequency: e:1/4 s:1/4 t:2/4'), 17 | 'frequency of letters in test' => test_zci('Frequency: e:1/4 s:1/4 t:2/4'), 18 | 'frequency of all characters in test' => test_zci('Frequency: e:1/4 s:1/4 t:2/4'), 19 | 'frequency of all chars in test' => test_zci('Frequency: e:1/4 s:1/4 t:2/4'), 20 | 'frequency of all in testing 1234 ABC!' => test_zci('Frequency: a:1/10 b:1/10 c:1/10 e:1/10 g:1/10 i:1/10 n:1/10 s:1/10 t:2/10'), 21 | 'frequency of all in Assassins!' => test_zci('Frequency: a:2/9 i:1/9 n:1/9 s:5/9'), 22 | 'frequency of a in Atlantic Ocean' => test_zci('Frequency: a:3/13'), 23 | 'freq of B in battle' => test_zci('Frequency: b:1/6'), 24 | 'freq of s in Spoons' => test_zci('Frequency: s:2/6'), 25 | 'frequency of all characters in testing' => test_zci('Frequency: e:1/7 g:1/7 i:1/7 n:1/7 s:1/7 t:2/7'), 26 | 'frequency of B in battle' => test_zci('Frequency: b:1/6'), 27 | ); 28 | 29 | done_testing; 30 | -------------------------------------------------------------------------------- /t/Average.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'average'; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::Average 14 | )], 15 | '1 2 3 avg' => test_zci("Mean: 2; Median: 2; Root Mean Square: 2.16024689946929", html => qr/Mean:/), 16 | 'mean 1, 2, 3' => test_zci("Mean: 2; Median: 2; Root Mean Square: 2.16024689946929", html => qr/Mean:/), 17 | 'root mean square 1,2,3' => test_zci("Mean: 2; Median: 2; Root Mean Square: 2.16024689946929", html => qr/Mean:/), 18 | "average 12 45 78 1234.12" => test_zci("Mean: 342.28; Median: 61.5; Root Mean Square: 618.72958034993", html => qr/Mean:/), 19 | "average 12, 45, 78, 1234.12" => test_zci("Mean: 342.28; Median: 61.5; Root Mean Square: 618.72958034993", html => qr/Mean:/), 20 | "average 12;45;78;1234.12" => test_zci("Mean: 342.28; Median: 61.5; Root Mean Square: 618.72958034993", html => qr/Mean:/), 21 | 'average 12, 45, 78, 1234' => test_zci('Mean: 342.25; Median: 61.5; Root Mean Square: 618.669742269654', html => qr/Mean:/), 22 | 'avg 1,2,3' => test_zci('Mean: 2; Median: 2; Root Mean Square: 2.16024689946929', html => qr/Mean:/), 23 | 24 | #Should not trigger 25 | 'average temperature philadelphia 2012 january' => undef, 26 | ); 27 | 28 | done_testing; 29 | 30 | -------------------------------------------------------------------------------- /t/LeapYear.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'leap_year'; 9 | zci is_cached => 1; 10 | ddg_goodie_test( 11 | [qw( 12 | DDG::Goodie::LeapYear 13 | )], 14 | 'was 2012 a leap year' => test_zci('2012 CE was a leap year'), 15 | 'will 3012 be a leap year' => test_zci('3012 CE will be a leap year'), 16 | 'was 1 bce a leap year' => test_zci('1 BCE was not a leap year'), 17 | 'leap years after 2005' => test_zci('The 5 leap years after 2005 CE are 2008 CE, 2012 CE, 2016 CE, 2020 CE, 2024 CE, 2028 CE'), 18 | 'leap years before 2 bc' => test_zci('The 5 leap years before 2 BCE are 4 BCE, 8 BCE, 12 BCE, 16 BCE, 20 BCE, 24 BCE'), 19 | 'is it a leap year' => test_zci('2014 CE is not a leap year'), 20 | 'when were the last 50 leap years' => test_zci('The last 50 leap years were 2012 CE, 2008 CE, 2004 CE, 2000 CE, 1996 CE, 1992 CE, 1988 CE, 1984 CE, 1980 CE, 1976 CE, 1972 CE, 1968 CE, 1964 CE, 1960 CE, 1956 CE, 1952 CE, 1948 CE, 1944 CE, 1940 CE, 1936 CE, 1932 CE, 1928 CE, 1924 CE, 1920 CE, 1916 CE, 1912 CE, 1908 CE, 1904 CE, 1896 CE, 1892 CE, 1888 CE, 1884 CE, 1880 CE, 1876 CE, 1872 CE, 1868 CE, 1864 CE, 1860 CE, 1856 CE, 1852 CE, 1848 CE, 1844 CE, 1840 CE, 1836 CE, 1832 CE, 1828 CE, 1824 CE, 1820 CE, 1816 CE, 1812 CE, 1808 CE'), 21 | ); 22 | 23 | done_testing(); 24 | -------------------------------------------------------------------------------- /t/HexToASCII.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'ascii'; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( DDG::Goodie::HexToASCII )], 13 | 'ascii 0x7465ff7374' => undef, 14 | 'ascii 0x7465007374' => test_zci('test (ASCII)', html => 'te[NUL]st (ASCII)'), 15 | 'ascii 0x74657374' => test_zci('test (ASCII)', html => 'test (ASCII)'), 16 | 'ascii 0x5468697320697320612074657374' => test_zci('This is a test (ASCII)', html => 'This is a test (ASCII)'), 17 | 'ascii 0x466f7220736f6d6520726561736f6e2c2049206465636964656420746f2061736b20612073656172636820656e67696e6520746f20636f6e766572742068657820746f2041534349492e0d0a436f6f6c2c20746869732073656172636820656e67696e6520646f65732069742c20756e74696c20492072756e206f7574206f662073706163652e' 18 | => test_zci('For some reason, I decided to ask a search engine to convert hex to ASCII.Cool, this search engine does it, until I run out of ... (ASCII)', html => 'For some reason, I decided to ask a search engine to convert hex to ASCII.[CR][LF]Cool, this search engine does it, until I run out of … (ASCII)'), 19 | ); 20 | 21 | done_testing; 22 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/EmToPx.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::EmToPx; 2 | # ABSTRACT: em <-> px for font sizes. 3 | 4 | use DDG::Goodie; 5 | 6 | triggers any => "em", "px"; 7 | 8 | zci is_cached => 1; 9 | zci answer_type => "conversion"; 10 | 11 | primary_example_queries '10 px to em'; 12 | secondary_example_queries '12.2 px in em assuming a 12.2 font size'; 13 | description 'convert from px to em'; 14 | name 'EmToPx'; 15 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/EmToPx.pm'; 16 | category 'conversions'; 17 | topics 'programming'; 18 | attribution twitter => 'crazedpsyc', 19 | cpan => 'CRZEDPSYC' ; 20 | 21 | handle query_raw => sub { 22 | s/(?![\.\s])\W//g; 23 | return unless /^(?:convert|change|what\s*(?:s|is|are)\s+)?(\d+\.\d*|\d*\.\d+|\d+)\s*(em|px)\s+(?:in|to)\s+(em|px)(?:\s+(?:with|at|using|assuming)(?:\s+an?)?\s+(\d+\.\d*|\d*\.\d+|\d+)\s*px)?/i; 24 | my $target = lc($3); 25 | my $num = $1; 26 | my $source = lc($2); 27 | 28 | my $fontsize = ( defined $4 ) ? $4 : 16; 29 | 30 | my $result; 31 | $result = $num * $fontsize if $target eq 'px' && $source eq 'em'; 32 | $result = $num / $fontsize if $target eq 'em' && $source eq 'px'; 33 | my $plur = $result == 1 ? "is" : "are"; 34 | 35 | return "There $plur $result $target in $num $source (assuming a ${fontsize}px font size)"; 36 | return; 37 | }; 38 | 39 | 1; 40 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/Base64.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::Base64; 2 | # ABSTRACT: Base64 <-> Unicode 3 | 4 | use DDG::Goodie; 5 | 6 | use MIME::Base64; 7 | use Encode; 8 | 9 | triggers startend => "base64"; 10 | 11 | zci answer_type => "base64_conversion"; 12 | 13 | zci is_cached => 1; 14 | 15 | primary_example_queries 'base64 encode foo'; 16 | secondary_example_queries 'base64 decode dGhpcyB0ZXh0'; 17 | description 'encode to and decode from base64'; 18 | name 'Base64'; 19 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/Base64.pm'; 20 | category 'conversions'; 21 | topics 'programming'; 22 | attribution web => [ 'robert.io', 'Robert Picard' ], 23 | github => [ 'http://github.com/rpicard', 'rpicard'], 24 | twitter => ['http://twitter.com/__rlp', '__rlp']; 25 | 26 | handle remainder => sub { 27 | return unless $_ =~ /^(encode|decode|)\s*(.*)$/i; 28 | 29 | my $command = $1 || ''; 30 | my $str = $2 || ''; 31 | 32 | if ($str) { 33 | 34 | if ( $command && $command eq 'decode' ) { 35 | 36 | $str = decode_base64($str); 37 | $str = decode( "UTF-8", $str ); 38 | chomp $str; 39 | 40 | return "Base64 decoded: $str"; 41 | } 42 | else { 43 | $str = encode_base64( encode( "UTF-8", $str ) ); 44 | chomp $str; 45 | 46 | return "Base64 encoded: $str"; 47 | } 48 | 49 | } 50 | 51 | return; 52 | }; 53 | 54 | 1; 55 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/PercentError.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::PercentError; 2 | # ABSTRACT: find the percent error given accepted and experimental values 3 | 4 | use DDG::Goodie; 5 | 6 | triggers start => "percent error", "% error", "%err", "%error", "percenterror", "percent err", "%-error"; 7 | 8 | zci answer_type => "percent_error"; 9 | zci is_cached => 1; 10 | 11 | primary_example_queries 'percent-error 34.5 35'; 12 | secondary_example_queries '%err 41 43', '%-error 2.88 2.82'; 13 | description 'find the percent error given accepted and experimental values'; 14 | name 'PercentError'; 15 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/PercentError.pm'; 16 | category 'calculations'; 17 | topics 'math'; 18 | attribution twitter => 'crazedpsyc', 19 | cpan => 'CRZEDPSYC' ; 20 | 21 | handle remainder => sub { 22 | my $length = length($_); 23 | #return unless $length == 2; 24 | 25 | my ( $acc, $exp ) = split /\s*[\s;,]\s*/, $_; 26 | return unless $acc =~ /^-?\d+?(?:\.\d+|)$/ && $exp =~ /^-?\d+?(?:\.\d+|)$/; 27 | 28 | my $diff = abs $acc - $exp; 29 | my $per = abs ($diff/$acc); 30 | my $err = $per*100; 31 | 32 | my $html = qq(Accepted: $acc Experimental: $exp Error: $err%); 33 | 34 | return "Accepted: $acc Experimental: $exp Error: $err%", html => $html; 35 | }; 36 | 37 | 1; 38 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/Uppercase.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::Uppercase; 2 | # ABSTRACT: uppercase a provided string. 3 | 4 | use DDG::Goodie; 5 | 6 | triggers start => 'uppercase', 'upper case', 'allcaps', 'all caps', 'strtoupper', 'toupper'; 7 | # leaving out 'uc' because of queries like "UC Berkley", etc 8 | # 2014-08-10: triggers to "start"-only to make it act more like a "command" 9 | # resolves issue with queries like "why do people type in all caps" 10 | 11 | zci is_cached => 1; 12 | zci answer_type => "uppercase"; 13 | 14 | primary_example_queries 'uppercase this'; 15 | secondary_example_queries 'upper case that'; 16 | 17 | name 'Uppercase'; 18 | description 'Make a string uppercase.'; 19 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/Uppercase.pm'; 20 | category 'conversions'; 21 | topics 'programming'; 22 | 23 | attribution twitter => 'crazedpsyc', 24 | cpan => 'CRZEDPSYC' ; 25 | 26 | handle remainder => sub { 27 | return unless $_; 28 | my $upper = uc $_; 29 | my $text = $upper; 30 | 31 | # Encode the variable before putting it in HTML. 32 | # There's no need to encode the $text variable because that gets encoded internally. 33 | $upper = html_enc($upper); 34 | 35 | my $html = qq(
$upper
); 36 | 37 | return $text, html => $html; 38 | }; 39 | 40 | 1; 41 | -------------------------------------------------------------------------------- /t/ABC.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'rand'; 9 | zci is_cached => 0; 10 | 11 | ddg_goodie_test( 12 | [qw( DDG::Goodie::ABC )], 13 | 'choose' => undef, 14 | 'i choose' => undef, 15 | 'choose or' => undef, 16 | 'choose my house or your house' => undef, 17 | 'choose his or her house' => undef, 18 | 'choose his or or her house' => undef, 19 | 'choose from products like turkey or venison' => undef, 20 | 'choose pick or axe' => test_zci(qr/(pick|axe) \(random\)/), 21 | 'choose yes or no' => test_zci(qr/(yes|no) \(random\)/), 22 | 'choose this or that or none' => test_zci(qr/(this|that|none) \(random\)/), 23 | 'pick this or that or none' => test_zci(qr/(this|that|none) \(random\)/), 24 | 'select heads or tails' => test_zci(qr/(heads|tails) \(random\)/), 25 | 'choose heads or tails' => test_zci(qr/(heads|tails) \(random\)/), 26 | 'choose duckduckgo or google or bing or something' => test_zci("duckduckgo (not random)", answer_type => 'egg'), 27 | 'choose DuckDuckGo OR Google OR Bing OR SOMETHING' => test_zci("DuckDuckGo (not random)", answer_type => 'egg'), 28 | ); 29 | 30 | done_testing; 31 | 32 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/Atbash.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::Atbash; 2 | # ABSTRACT: A simple substitution cipher using a reversed alphabet 3 | 4 | use DDG::Goodie; 5 | 6 | primary_example_queries 'atbash hello'; 7 | secondary_example_queries 'atbash svool'; 8 | description 'A simple substitution cipher using a reversed alphabet'; 9 | name 'Atbash'; 10 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/Atbash.pm'; 11 | category 'transformations'; 12 | topics 'cryptography'; 13 | 14 | attribution web => ['http://kyokodaniel.com/tech/', 'Daniel Davis'], 15 | github => ['https://github.com/tagawa', 'tagawa'], 16 | twitter => ['https://twitter.com/ourmaninjapan', 'ourmaninjapan']; 17 | 18 | triggers start => 'atbash'; 19 | 20 | zci is_cached => 1; 21 | 22 | handle remainder => sub { 23 | if ($_) { 24 | my $char; 25 | my $result; 26 | 27 | while (/(.)/g) { 28 | if ($1 =~ /([a-z])/) { 29 | # Substitute lowercase characters 30 | $char = chr(219 - ord $1); 31 | } 32 | elsif ($1 =~ /([A-Z])/) { 33 | # Substitute uppercase characters 34 | $char = chr(155 - ord $1); 35 | } 36 | else { $char = $1; } 37 | $result .= $char; 38 | } 39 | 40 | return "Atbash: $result"; 41 | } 42 | return; 43 | }; 44 | 45 | 1; 46 | -------------------------------------------------------------------------------- /t/BloodDonor.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => "blood_donor"; 9 | 10 | ddg_goodie_test( 11 | ['DDG::Goodie::BloodDonor'], 12 | 'donor A+' => test_zci("Ideal donor: A+\nOther donors: A+ or O+\nOnly if no Rh(+) found: A- or O-\n", 13 | html => qr"
KeyCharacter Code
.*
"s, 14 | heading => "Donors for blood type A+" 15 | ), 16 | 'donors for A+' => test_zci("Ideal donor: A+\nOther donors: A+ or O+\nOnly if no Rh(+) found: A- or O-\n", 17 | html => qr".*
"s, 18 | heading => "Donors for blood type A+" 19 | ), 20 | 'blood donor A+' => test_zci("Ideal donor: A+\nOther donors: A+ or O+\nOnly if no Rh(+) found: A- or O-\n", 21 | html => qr".*
"s, 22 | heading => "Donors for blood type A+" 23 | ), 24 | 'blood donors for A+' => test_zci("Ideal donor: A+\nOther donors: A+ or O+\nOnly if no Rh(+) found: A- or O-\n", 25 | html => qr".*
"s, 26 | heading => "Donors for blood type A+" 27 | ), 28 | 'donor o+' => test_zci("Ideal donor: O+\nOther donors: O+\nOnly if no Rh(+) found: O-\n", 29 | html => qr".*
"s, 30 | heading => "Donors for blood type O+" 31 | ), 32 | ); 33 | 34 | done_testing; 35 | -------------------------------------------------------------------------------- /t/Coin.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'coin'; 9 | zci is_cached => 0; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::Coin 14 | )], 15 | 'flip a coin' => test_zci( 16 | qr/(heads|tails) \(random\)/, 17 | html => qr/(heads|tails) \(random\)/, 18 | ), 19 | 'flip 1 coin' => test_zci( 20 | qr/(heads|tails) \(random\)/, 21 | html => qr/(heads|tails) \(random\)/, 22 | ), 23 | 'flip 2 coins' => test_zci( 24 | qr/(heads|tails), (heads|tails) \(random\)/, 25 | html => qr/(heads|tails) \(random\)/, 26 | ), 27 | 'toss a coin' => test_zci( 28 | qr/(heads|tails) \(random\)/, 29 | html => qr/(heads|tails) \(random\)/, 30 | ), 31 | 'toss 1 coin' => test_zci( 32 | qr/(heads|tails) \(random\)/, 33 | html => qr/(heads|tails) \(random\)/, 34 | ), 35 | 'toss 2 coins' => test_zci( 36 | qr/(heads|tails), (heads|tails) \(random\)/, 37 | html => qr/(heads|tails) \(random\)/, 38 | ), 39 | 'heads or tails' => test_zci( 40 | qr/(heads|tails) \(random\)/, 41 | html => qr/(heads|tails) \(random\)/, 42 | ), 43 | 'heads or tails?' => test_zci( 44 | qr/(heads|tails) \(random\)/, 45 | html => qr/(heads|tails) \(random\)/, 46 | ), 47 | 'flip 4 coins' => test_zci( 48 | qr/((heads|tails),? ){4}\(random\)/, 49 | html => qr/(heads|tails) \(random\)/, 50 | ), 51 | ); 52 | 53 | done_testing; 54 | -------------------------------------------------------------------------------- /t/GreatestCommonFactor.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => "greatest_common_factor"; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::GreatestCommonFactor 14 | )], 15 | 'gcf 9 81' => test_zci('Greatest common factor of 9 and 81 is 9.', html => 'Greatest common factor of 9 and 81 is 9. More at Wikipedia.'), 16 | '1000 100 greatest common factor' => test_zci ('Greatest common factor of 1000 and 100 is 100.', html => 'Greatest common factor of 1000 and 100 is 100. More at Wikipedia.'), 17 | 'GCF 12 76' => test_zci('Greatest common factor of 12 and 76 is 4.', html => 'Greatest common factor of 12 and 76 is 4. More at Wikipedia.'), 18 | 'GCF 121 11' => test_zci('Greatest common factor of 121 and 11 is 11.', html => 'Greatest common factor of 121 and 11 is 11. More at Wikipedia.'), 19 | '99 9 greatest common factor' => test_zci('Greatest common factor of 99 and 9 is 9.', html => 'Greatest common factor of 99 and 9 is 9. More at Wikipedia.'), 20 | ); 21 | 22 | done_testing; 23 | -------------------------------------------------------------------------------- /t/GenerateMAC.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => "MAC Address"; 9 | zci is_cached => 0; 10 | 11 | my $mac_regxp = "([0-9A-F]{2}[:-]){5}([0-9A-F]{2})"; 12 | my $text_start = "Here's a random MAC address: "; 13 | my $text_end=""; 14 | my $html_start = "Here's a random MAC address: "; 15 | 16 | #regexp from http://stackoverflow.com/questions/4260467/what-is-a-regular-expression-for-a-mac-address 17 | ddg_goodie_test ( 18 | [ 19 | 'DDG::Goodie::GenerateMAC' 20 | ], 21 | 'generate mac address' => 22 | test_zci( 23 | qr/^$text_start$mac_regxp$/, 24 | html => qr/^$html_start$mac_regxp$/, 25 | ), 26 | 'generate mac addr' => 27 | test_zci( 28 | qr/^$text_start$mac_regxp$/, 29 | html => qr/^$html_start$mac_regxp$/, 30 | ), 31 | 'random mac address' => 32 | test_zci( 33 | qr/^$text_start$mac_regxp$/, 34 | html => qr/^$html_start$mac_regxp$/, 35 | ), 36 | 'random mac addr' => 37 | test_zci( 38 | qr/^$text_start$mac_regxp$/, 39 | html => qr/^$html_start$mac_regxp$/, 40 | ), 41 | 'please generate mac address' => 42 | test_zci( 43 | qr/^$text_start$mac_regxp$/, 44 | html => qr/^$html_start$mac_regxp$/, 45 | ), 46 | ); 47 | 48 | done_testing; 49 | -------------------------------------------------------------------------------- /t/HexToDec.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'conversion'; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( DDG::Goodie::HexToDec )], 13 | '0xd1038d2e07b42569' => test_zci( 14 | 'd1038d2e07b42569 base 16 = 15061036807694329193 base 10 = 01504034322700755022551 base 8', 15 | html => "
Decimal: 15061036807694329193
Octal: 01504034322700755022551
"), 16 | '0x44696f21' => test_zci( 17 | '44696f21 base 16 = 1147760417 base 10 = 010432267441 base 8', 18 | html => "
Decimal: 1147760417
Octal: 010432267441
"), 19 | '0xffffffffffffffffffffff' => test_zci('ffffffffffffffffffffff base 16 = 309485009821345068724781055 base 10 = 0177777777777777777777777777777 base 8', 20 | html => "
Decimal: 309485009821345068724781055
Octal: 0177777777777777777777777777777
"), 21 | '0x44696f2Z' => undef, 22 | ); 23 | 24 | done_testing; 25 | 26 | -------------------------------------------------------------------------------- /t/SubnetCalc.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | 6 | use Test::More; 7 | use DDG::Test::Goodie; 8 | 9 | zci answer_type => 'subnet_info'; 10 | zci is_cached => 1; 11 | 12 | ddg_goodie_test( 13 | [ 14 | # This is the name of the goodie that will be loaded to test. 15 | 'DDG::Goodie::SubnetCalc' 16 | ], 17 | "10.0.0.0/24" => test_zci( 18 | "Network: 10.0.0.0/24 (Class A)\nNetmask: 255.255.255.0\nSpecified: Network\nHost Address Range: 10.0.0.1-10.0.0.254 (254 hosts)\nBroadcast: 10.0.0.255\n", html => qr/.*/), 19 | 20 | "192.168.0.0/24" => test_zci( 21 | "Network: 192.168.0.0/24 (Class C)\nNetmask: 255.255.255.0\nSpecified: Network\nHost Address Range: 192.168.0.1-192.168.0.254 (254 hosts)\nBroadcast: 192.168.0.255\n",html => qr/.*/), 22 | 23 | "8.8.8.8 255.255.224.0" => test_zci( 24 | "Network: 8.8.0.0/19 (Class A)\nNetmask: 255.255.224.0\nSpecified: Host #2056\nHost Address Range: 8.8.0.1-8.8.31.254 (8190 hosts)\nBroadcast: 8.8.31.255\n", html => qr/.*/), 25 | 26 | '46.51.197.88/255.255.254.0' => test_zci( 27 | "Network: 46.51.196.0/23 (Class A)\nNetmask: 255.255.254.0\nSpecified: Host #344\nHost Address Range: 46.51.196.1-46.51.197.254 (510 hosts)\nBroadcast: 46.51.197.255\n", html => qr/.*/), 28 | 29 | '176.34.131.233/32' => test_zci( 30 | "Network: 176.34.131.233/32 (Class B)\nNetmask: 255.255.255.255\nSpecified: Host Only\n", html => qr/.*/), 31 | ); 32 | 33 | done_testing; 34 | -------------------------------------------------------------------------------- /t/Anagram.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'anagram'; 9 | zci is_cached => 0; 10 | 11 | ddg_goodie_test( 12 | [qw(DDG::Goodie::Anagram)], 13 | 'Anagram filter' => test_zci('trifle', html => qr/.*/), 14 | 'anagrams events' => test_zci('Steven', html => qr/.*/), 15 | 'anagram of algorithm' => test_zci('logarithm', html => qr/.*/), 16 | 'anagrams of favorite' => test_zci(qr/[favorite]{8}/, html => qr/.*/), 17 | 'anagram of' => test_zci(qr/(of|fo)/, html => qr/.*/), 18 | 'anagram filter 5' => test_zci('filet, flier, flirt, lifer, liter, refit, rifle', html => qr/.*/), 19 | 'anagram times' => test_zci('emits, items, mites, smite', html => qr/.*/), 20 | 'anagram Mixing it up' => test_zci(qr/[ Mixngtup]{12}/, html => qr/.*/), 21 | 'anagram algorithm 14' => test_zci('logarithm', html => qr/.*/), 22 | 'anagrams stop' => test_zci('Post, opts, post, pots, spot, tops', html => qr/.*/), 23 | 'anagram stop' => test_zci('Post, opts, post, pots, spot, tops', html => qr/.*/), 24 | 'anagrams lost' => test_zci('lots, slot', html => qr/.*/), 25 | 'anagram lost' => test_zci('lots, slot', html => qr/.*/), 26 | 'anagram of lost' => test_zci('lots, slot', html => qr/.*/), 27 | 'anagram of filter' => test_zci('trifle', html => qr/.*/), 28 | 'anagram of Filter' => test_zci('trifle', html => qr/.*/), 29 | ); 30 | 31 | done_testing; 32 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/ISO639.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::ISO639; 2 | # ABSTRACT: ISO 639 language names and codes 3 | 4 | use DDG::Goodie; 5 | use Locale::Language; 6 | 7 | use constant WPHREF => "https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes"; 8 | 9 | triggers start => "iso 639", "iso639"; 10 | 11 | zci answer_type => "iso639"; 12 | zci is_cached => 1; 13 | 14 | primary_example_queries 'iso639 english'; 15 | secondary_example_queries 'iso639 ab'; 16 | description 'lookup ISO639 language names and codes'; 17 | name 'ISO639'; 18 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/ISO639.pm'; 19 | category 'reference'; 20 | topics 'programming'; 21 | attribution github => [ 'http://github.com/tantalor', 'tantalor' ], 22 | web => [ 'http://johntantalo.com/blog', 'John Tantalo' ]; 23 | 24 | 25 | handle remainder => sub { 26 | my ($lang, $code) = langpair(shift) or return; 27 | my $text = sprintf qq(ISO 639: %s - %s), $lang, $code; 28 | my $html = sprintf qq(ISO 639: %s - %s), WPHREF, $lang, $code; 29 | return $text, html => $html; 30 | }; 31 | 32 | sub langpair { 33 | 34 | if (my $lang = code2language($_)) { 35 | return ($lang, language2code($lang)); 36 | } 37 | if (my $lang = code2language($_,'alpha-3')) { 38 | return ($lang, language2code($lang)); 39 | } 40 | if (my $code = language2code($_)) { 41 | return (code2language($code), $code); 42 | } 43 | return; 44 | } 45 | 46 | 1; 47 | -------------------------------------------------------------------------------- /t/VIN.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'vin'; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( DDG::Goodie::VIN )], 13 | '1g8gg35m1g7123101' => test_zci( 14 | "1G8GG35M1G7123101", 15 | heading => 'Vehicle Identification Number', 16 | html => "Check the automobile's VIN at Decode This." 17 | ), 18 | 'vin 1g8gg35m1g7123101' => test_zci( 19 | "1G8GG35M1G7123101", 20 | heading => 'Vehicle Identification Number', 21 | html => "Check the automobile's VIN at Decode This." 22 | ), 23 | '1g8gg35m1g7123101 vehicle identification number' => test_zci( 24 | "1G8GG35M1G7123101", 25 | heading => 'Vehicle Identification Number', 26 | html => "Check the automobile's VIN at Decode This." 27 | ), 28 | '1g8gg35m1g7123101 tracking' => test_zci( 29 | "1G8GG35M1G7123101", 30 | heading => 'Vehicle Identification Number', 31 | html => "Check the automobile's VIN at Decode This." 32 | ), 33 | ); 34 | 35 | done_testing; 36 | 37 | -------------------------------------------------------------------------------- /t/GUID.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'guid'; 9 | zci is_cached => 0; 10 | 11 | my $heading = 'Random GUID'; 12 | 13 | ddg_goodie_test( 14 | [qw( 15 | DDG::Goodie::GUID 16 | )], 17 | 18 | # Check that the trigger kicks in. 19 | 'guid' => test_zci(qr/^([a-zA-Z]|\d){8}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){12}$/, 20 | html => qr/./, 21 | heading => $heading 22 | ), 23 | 'uuid' => test_zci(qr/^([a-zA-Z]|\d){8}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){12}$/, 24 | html => qr/./, 25 | heading => $heading 26 | ), 27 | 'globally unique identifier' => test_zci(qr/^([a-zA-Z]|\d){8}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){12}$/, 28 | html => qr/./, 29 | heading => $heading 30 | ), 31 | 'rfc 4122' => test_zci(qr/^([a-zA-Z]|\d){8}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){12}$/, 32 | html => qr/./, 33 | heading => $heading 34 | ), 35 | 36 | # Check the HTML. Just once. 37 | 'guid' => test_zci(qr/^([a-zA-Z]|\d){8}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){4}-([a-zA-Z]|\d){12}$/, 38 | html => qr/^$/, 39 | heading => $heading 40 | ), 41 | ); 42 | 43 | done_testing; 44 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/HKDK.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::HKDK; 2 | # ABSTRACT: Track a package through HKDK. 3 | 4 | use DDG::Goodie; 5 | 6 | zci is_cached => 1; 7 | zci answer_type => "hkdk"; 8 | 9 | primary_example_queries 'CU123456789DK'; 10 | secondary_example_queries 'EE123456789HK'; 11 | description 'Track a package from Hongkong Post or Post Danmark'; 12 | name 'HK/DK'; 13 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/HKDK.pm'; 14 | category 'ids'; 15 | topics 'special_interest'; 16 | attribution web => [ 'https://www.duckduckgo.com', 'DuckDuckGo' ], 17 | github => [ 'https://github.com/duckduckgo', 'duckduckgo'], 18 | twitter => ['http://twitter.com/duckduckgo', 'duckduckgo']; 19 | 20 | triggers query_nowhitespace_nodash => qr/([a-z]{2}\d{9}(?:hk|dk))/i; 21 | 22 | handle query_nowhitespace_nodash => sub { 23 | my $package_number = $1; 24 | 25 | if ( $package_number =~ /hk$/i ) { 26 | return $package_number, heading => 'Hongkong Post Shipment Tracking', html => qq(Track this shipment at Hongkong Post.); 27 | } 28 | elsif ( $package_number =~ /dk$/i ) { 29 | return $package_number, heading => 'Post Norden Shipment Tracking', html => qq(Track this shipment at Post Norden.); 30 | } 31 | 32 | return; 33 | }; 34 | 35 | 1; 36 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/Fibonacci.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::Fibonacci; 2 | # ABSTRACT: n-th Fibonacci number 3 | 4 | use strict; 5 | 6 | use DDG::Goodie; 7 | use Lingua::EN::Numbers::Ordinate qw(ordsuf); 8 | 9 | triggers any => 'fib', 'fibonacci'; 10 | zci is_cached => 1; 11 | zci answer_type => 'fibonacci'; 12 | 13 | primary_example_queries 'fib 7'; 14 | secondary_example_queries 'fibonacci 33'; 15 | description 'Returns the n-th element of Fibonacci sequence'; 16 | attribution github => ['https://github.com/koosha--', 'koosha--'], 17 | twitter => ['https://github.com/_koosha_', '_koosha_']; 18 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/Fibonacci.pm'; 19 | topics 'math'; 20 | category 'calculations'; 21 | 22 | handle remainder => sub { 23 | s/^\s+//; 24 | s/\s+$//; 25 | return unless /^(?:what(?:'s| is) the )?(\d+)(?:th|rd|st)?(?: number)?(?: in the (?:series|sequence))?\??$/ && $1 <= 1470; 26 | my @fib; 27 | my $n = $1; 28 | $#fib = $n; 29 | $fib[0] = 0; 30 | $fib[1] = 1; 31 | # Instead of calling a typical recursive function, 32 | # use simple dynamic programming to improve performance 33 | for my $i (2..$#fib) { 34 | $fib[$i] = $fib[$i - 1] + $fib[$i - 2]; 35 | } 36 | my $suf = ordsuf($_); 37 | return "The $n$suf fibonacci number is ${fib[$n]} (assuming f(0) = 0).", 38 | html => "The $n$suf fibonacci number is ${fib[$n]} (assuming f(0) = 0)."; 39 | }; 40 | 41 | 1; 42 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/HexToDec.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::HexToDec; 2 | # ABSTRACT: Convert hexidecimal to decimal 3 | 4 | use DDG::Goodie; 5 | use Math::BigInt; 6 | 7 | triggers query_raw => qr/\b0x[0-9a-fA-F]+\b/; 8 | 9 | zci answer_type => 'conversion'; 10 | zci is_cached => 1; 11 | 12 | primary_example_queries '0x44696f21'; 13 | description 'convert hexidecimal to decimal'; 14 | name 'HexToDec'; 15 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/HexToDec.pm'; 16 | category 'conversions'; 17 | topics 'math', 'programming'; 18 | attribution cpan => 'majuscule', 19 | github => 'nospampleasemam', 20 | web => ['https://dylansserver.com', 'Dylan Lloyd'] ; 21 | 22 | sub wrap_html { 23 | my ($decimal, $octal) = @_; 24 | return "
" . 25 | "
" . 26 | "Decimal: $decimal" . 27 | "
" . 28 | "
" . 29 | "Octal: $octal" . 30 | "
" . 31 | "
"; 32 | } 33 | 34 | handle query_raw => sub { 35 | m/\b0x([0-9a-fA-F]+)\b/; 36 | my $hex = $1; 37 | my $decimal = Math::BigInt->from_hex($hex); 38 | my $octal = $decimal->as_oct; 39 | return "$hex base 16 = $decimal base 10 = $octal base 8", 40 | html => wrap_html($decimal, $octal); 41 | }; 42 | 43 | 0x41414141; 44 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/LeetSpeak.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::LeetSpeak; 2 | # ABSTRACT: Translate the query into leet speak. 3 | 4 | use DDG::Goodie; 5 | 6 | triggers startend => 'leetspeak', 'l33tsp34k', 'l33t', 'leet speak', 'l33t sp34k'; 7 | primary_example_queries 'leetspeak hello world !'; 8 | description 'Translate the query into leet speak.'; 9 | topics 'geek'; 10 | category 'conversions'; 11 | name 'LeetSpeak'; 12 | code_url 'https://github.com/antoine-vugliano/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/LeetSpeak.pm'; 13 | attribution github => ['https://github.com/antoine-vugliano', 'antoine-vugliano'], 14 | web => ['http://antoine.vugliano.free.fr', 'Antoine Vugliano']; 15 | 16 | zci is_cached => 1; 17 | 18 | my %alphabet = ( 19 | a => '/-\\', 20 | b => '|3', 21 | c => '(', 22 | d => '|)', 23 | e => '3', 24 | f => '|=', 25 | g => '6', 26 | h => '|-|', 27 | i => '1', 28 | j => '_|', 29 | k => '|<', 30 | l => '|_', 31 | m => '|\/|', 32 | n => '|\|', 33 | o => '0', 34 | p => '|D', 35 | q => '(,)', 36 | r => '|2', 37 | s => '5', 38 | t => "']['", 39 | u => '|_|', 40 | v => '\/', 41 | w => '\^/', 42 | x => '><', 43 | y => "`/", 44 | z => '2' 45 | ); 46 | 47 | handle remainder => sub { 48 | return unless $_; 49 | 50 | my $translation = join '', map { 51 | exists $alphabet{$_} ? $alphabet{$_} : $_ 52 | } split //, lc; 53 | 54 | return "Leet Speak: $translation"; 55 | }; 56 | 57 | 1; 58 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/Frequency.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::Frequency; 2 | # ABSTRACT: Displays frequency of alphabet character (a-z) 3 | 4 | use DDG::Goodie; 5 | 6 | triggers start => 'frequency', 'freq'; 7 | 8 | primary_example_queries 'frequency of all characters in testing'; 9 | secondary_example_queries 'frequency of B in battle', 'frequency of all in testing 1234 ABC!'; 10 | description 'calculate the frequency of characters in a string'; 11 | name 'Frequency'; 12 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/Frequency.pm'; 13 | category 'calculations'; 14 | topics 'geek'; 15 | attribution github => [ 'http://github.com/unlisted', 'Morgan' ]; 16 | 17 | handle remainder => sub { 18 | if ($_ =~ /^of ([a-z]|(?:all ?|)(?:letters|characters|chars|)) in (.+)/i) 19 | { 20 | 21 | my $collect = lc $1; 22 | my $target_str = lc $2; 23 | 24 | # warn qq($collect\t$target_str\n); 25 | 26 | my $count = 0; 27 | my %freq; 28 | my @chars = split //, $target_str; 29 | 30 | foreach (@chars) 31 | { 32 | if ($_ =~ /[a-z]/) 33 | { 34 | if ($collect =~ /all|letters|characters|chars/) { ++$freq{$_}; } 35 | else { ++$freq{$_} if $_ eq $collect; } 36 | 37 | ++$count; 38 | }; 39 | }; 40 | 41 | my @out; 42 | foreach my $key (keys %freq) 43 | { 44 | push @out, join ":", $key, $freq{$key} . "/" . $count; 45 | }; 46 | 47 | return "Frequency: " . join ' ',sort(@out) if @out; 48 | }; 49 | 50 | return; 51 | }; 52 | 53 | zci is_cached => 1; 54 | 55 | 1; 56 | -------------------------------------------------------------------------------- /t/Jira.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'jira'; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | 13 | [qw( DDG::Goodie::Jira)], 14 | 'ACE-230' => test_zci( 15 | undef, 16 | html => qq(ACE (Apache JIRA Bugtracker): see ticket ACE-230.) 17 | ), 18 | 'ace-230' => test_zci( 19 | undef, 20 | html => qq(ACE (Apache JIRA Bugtracker): see ticket ACE-230.) 21 | ), 22 | 'jira random AJLIB-230 bug random' => test_zci( 23 | undef, 24 | html => qq(ajlib incubator (Codehaus JIRA Bugtracker): see ticket AJLIB-230.) 25 | ), 26 | 'jira random ajlib-230 bug random' => test_zci( 27 | undef, 28 | html => qq(ajlib incubator (Codehaus JIRA Bugtracker): see ticket AJLIB-230.) 29 | ), 30 | 'SOLR-4530' => test_zci( 31 | undef, 32 | html => 'Solr (Apache JIRA Bugtracker): see ticket SOLR-4530.' 33 | ), 34 | 'IdentityHtmlMapper solr-4530' => test_zci( 35 | undef, 36 | html => 'Solr (Apache JIRA Bugtracker): see ticket SOLR-4530.' 37 | ), 38 | ); 39 | 40 | done_testing; 41 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/GimpCheatSheet.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::GimpCheatSheet; 2 | # ABSTRACT: Some GIMP keyboard and mouse shortcuts 3 | 4 | # Adapted from CrontabCheatSheet.pm 5 | 6 | use DDG::Goodie; 7 | 8 | zci answer_type => "gimp_cheat"; 9 | 10 | name "GimpCheatSheet"; 11 | description "GIMP shortcut cheat sheet"; 12 | code_url "https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/GimpCheatSheet.pm"; 13 | category "cheat_sheets"; 14 | topics "computing"; 15 | 16 | primary_example_queries "gimp help", "gimp cheat sheet", "gimp shortcuts"; 17 | 18 | triggers startend => ( 19 | "gimp cheat sheet", "cheat sheet gimp", 20 | "gimp cheatsheet", "cheatsheet gimp", 21 | "gimp help", "help gimp", 22 | "gimp quick reference", "quick reference gimp", 23 | "gimp reference", "reference gimp", 24 | "gimp shortcut", "shortcut gimp", 25 | "gimp shortcuts", "shortcuts gimp" 26 | ); 27 | 28 | attribution github => ["elebow", "Eddie Lebow"]; 29 | 30 | handle remainder => sub { 31 | return 32 | heading => "GIMP Shortcut Cheat Sheet", 33 | html => html_cheat_sheet(), 34 | answer => text_cheat_sheet(), 35 | }; 36 | 37 | my $HTML; 38 | 39 | sub html_cheat_sheet { 40 | $HTML //= share("gimp_cheat_sheet.html") 41 | ->slurp(iomode => "<:encoding(UTF-8)"); 42 | return $HTML; 43 | } 44 | 45 | my $TEXT; 46 | 47 | sub text_cheat_sheet { 48 | $TEXT //= share("gimp_cheat_sheet.txt") 49 | ->slurp(iomode => "<:encoding(UTF-8)"); 50 | return $TEXT; 51 | } 52 | 53 | 1; 54 | 55 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/IPS.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::IPS; 2 | # ABSTRACT: track a package through IPS. 3 | 4 | use DDG::Goodie; 5 | 6 | zci is_cached => 1; 7 | zci answer_type => "ips"; 8 | 9 | primary_example_queries 'EM999999999IN'; 10 | description 'Track a package from IPS'; 11 | name 'IPS'; 12 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/IPS.pm'; 13 | category 'ids'; 14 | topics 'special_interest'; 15 | attribution web => [ 'https://www.duckduckgo.com', 'DuckDuckGo' ], 16 | github => [ 'https://github.com/duckduckgo', 'duckduckgo'], 17 | twitter => ['http://twitter.com/duckduckgo', 'duckduckgo']; 18 | 19 | triggers query_nowhitespace_nodash => qr/(E[MA]\d{9})(IN|HR|)/xi; 20 | 21 | handle query_nowhitespace_nodash => sub { 22 | my $package_number = $1 . $2; 23 | my $country = lc $2 || ''; 24 | 25 | my $tmp_link = ''; 26 | 27 | if ( $country eq 'in' ) { 28 | $tmp_link = "http://ipsweb.ptcmysore.gov.in/ipswebtracking/IPSWeb_item_events.asp?itemid=$package_number&Submit=Submit"; 29 | } 30 | elsif ( $country eq 'hr' ) { 31 | $tmp_link = "http://ips.posta.hr/IPSWeb_item_events.asp?itemid=$package_number&Submit=Submit"; 32 | } 33 | else { 34 | $tmp_link = "http://mailtracking.gov.bm/IPSWeb_item_events.asp?itemid=$package_number&Submit=Submit+Query"; 35 | } 36 | if ($tmp_link) { 37 | return $package_number, heading => "IPS Shipment Tracking", html => qq(Track this shipment at IPS.); 38 | } 39 | 40 | return; 41 | }; 42 | 43 | 1; 44 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/URLEncode.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::URLEncode; 2 | # ABSTRACT: Displays the percent-encoded url. 3 | 4 | use DDG::Goodie; 5 | use URI::Escape::XS qw(encodeURIComponent); 6 | use warnings; 7 | use strict; 8 | 9 | triggers startend => 'url encode', 'encode url', 'urlencode', 'encodeurl', 'url escape', 'escape url', 'urlescape', 'escapeurl'; 10 | 11 | primary_example_queries 'url encode https://duckduckgo.com/' , 'encode url xkcd.com/blag'; 12 | secondary_example_queries 'http://arstechnica.com/ url escape', 'apple.com/mac/ escape url'; 13 | 14 | zci answer_type => 'encoded_url'; 15 | 16 | name 'URLEncode'; 17 | description 'Displays the percent-encoded url'; 18 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/URLEncode.pm'; 19 | category 'computing_tools'; 20 | topics 'programming', 'web_design'; 21 | attribution twitter => ['nshanmugham', 'Nishanth Shanmugham'], 22 | web => ['http://nishanths.github.io', 'Nishanth Shanmugham'], 23 | github => ['https://github.com/nishanths', 'Nishanth Shanmugham']; 24 | 25 | 26 | handle remainder => sub { 27 | my $encoded_url = encodeURIComponent($_); 28 | 29 | my $text = "Percent-encoded URL: $encoded_url"; 30 | my $html = qq(
Percent-encoded URL: $encoded_url
); 31 | 32 | return $text, html => $html; 33 | }; 34 | 35 | 1; 36 | -------------------------------------------------------------------------------- /t/DaysBetween.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'days_between'; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::DaysBetween 14 | )], 15 | 'days between 01/01/2000 01/01/2001' => test_zci('There are 366 days between 01 Jan 2000 and 01 Jan 2001.'), 16 | 'days between 1/1/2000 and 1/1/2001 inclusive' => test_zci('There are 367 days between 01 Jan 2000 and 01 Jan 2001, inclusive.'), 17 | 'daysbetween 03/4/2005 and 11/8/2020' => test_zci('There are 5728 days between 04 Mar 2005 and 08 Nov 2020.'), 18 | 'days_between 3/14/2005 and 1/2/2003' => test_zci('There are 802 days between 02 Jan 2003 and 14 Mar 2005.'), 19 | 'days between 01/31/2000 01/31/2001' => test_zci('There are 366 days between 31 Jan 2000 and 31 Jan 2001.'), 20 | 'days between 01/31/2000 01/31/2001 inclusive' => test_zci('There are 367 days between 31 Jan 2000 and 31 Jan 2001, inclusive.'), 21 | 'days between January 31st, 2000 and 31-Jan-2001 inclusive' => test_zci('There are 367 days between 31 Jan 2000 and 31 Jan 2001, inclusive.'), 22 | 'days between jan 1 2012 and jan 1 123456' => undef, 23 | 'days between jan 1 2012 and jan 1 1234' => test_zci("There are 284158 days between 01 Jan 1234 and 01 Jan 2012."), 24 | 'days between jan 1 and jan 15 inclusive' => test_zci(qr/^There are 15 days between.+inclusive\.$/), 25 | 'days between jan 1 and 15th feb' => test_zci(qr/^There are 45 days between.+and 15 Feb [0-9]{4}\.$/), 26 | ); 27 | 28 | done_testing; 29 | -------------------------------------------------------------------------------- /t/FedEx.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'fedex'; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( DDG::Goodie::FedEx )], 13 | 'fedex 9241990100130206401644' => test_zci( 14 | "9241990100130206401644", 15 | heading => 'FedEx Shipment Tracking', 16 | html => qq(Track this shipment at FedEx.) 17 | ), 18 | 'federal express 9241990100130206401644' => test_zci( 19 | "9241990100130206401644", 20 | heading => 'FedEx Shipment Tracking', 21 | html => qq(Track this shipment at FedEx.) 22 | ), 23 | '178440515632684' => test_zci( 24 | "178440515632684", 25 | heading => 'FedEx Shipment Tracking', 26 | html => qq(Track this shipment at FedEx.) 27 | ), 28 | '178440515682684' => undef, # Transcription error turns a 3 into an 8. Fails checksum; not a tracking number. 29 | '9612804882227378545377' => test_zci( 30 | "9612804882227378545377", 31 | heading => 'FedEx Shipment Tracking', 32 | html => qq(Track this shipment at FedEx.) 33 | ) 34 | ); 35 | 36 | done_testing; 37 | 38 | -------------------------------------------------------------------------------- /lib/DDG/Goodie/TitleCase.pm: -------------------------------------------------------------------------------- 1 | package DDG::Goodie::TitleCase; 2 | # ABSTRACT: Convert a string to title case. 3 | 4 | use DDG::Goodie; 5 | 6 | triggers startend => 'titlecase', 'ucfirst', 'title case', 'capitalize'; 7 | 8 | primary_example_queries 'titlecase test'; 9 | description 'return the query in title case'; 10 | name 'Title Case'; 11 | code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/TitleCase.pm'; 12 | category 'transformations'; 13 | topics 'words_and_games'; 14 | 15 | attribution github => ['https://github.com/moollaza', 'moollaza'], 16 | github => ['https://github.com/maxluzuriaga', 'Max Luzuriaga']; 17 | 18 | zci is_cached => 1; 19 | zci answer_type => "title_case"; 20 | 21 | # http://blog.apastyle.org/apastyle/2012/03/title-case-and-sentence-case-capitalization-in-apa-style.html 22 | my @exceptions = ("a", "an", "and", "the", "by", "but", "for", "or", "nor", "yet", "so", "as", "at", "in", "of", "on", "per", "to"); 23 | 24 | handle remainder => sub { 25 | return unless $_; 26 | 27 | my @words = split(/ /, $_); 28 | 29 | @words = map { 30 | my $word = $words[$_]; 31 | if ($_ == 0) { 32 | ucfirst $word # Capitalize first word 33 | } else { 34 | if (grep { $_ eq $word } @exceptions) { 35 | $word # Don't capitalize minor words 36 | } else { 37 | join('-', map { ucfirst $_ } split(/-/, $word) ) # Capitalize every part of a hyphenated word 38 | } 39 | } 40 | } 0 .. $#words; 41 | 42 | return join(' ', @words); 43 | }; 44 | 45 | 1; 46 | -------------------------------------------------------------------------------- /t/GoldenRatio.t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use Test::More; 6 | use DDG::Test::Goodie; 7 | 8 | zci answer_type => 'golden_ratio'; 9 | zci is_cached => 1; 10 | 11 | ddg_goodie_test( 12 | [qw( 13 | DDG::Goodie::GoldenRatio 14 | )], 15 | 'golden ratio 1:?' => test_zci('Golden ratio: 1 : 1.61803398874989'), 16 | "golden ratio 2.5:?" => test_zci("Golden ratio: 2.5 : 4.04508497187474"), 17 | "golden ratio 450:?" => test_zci("Golden ratio: 450 : 728.115294937453"), 18 | "golden ratio 900:?" => test_zci("Golden ratio: 900 : 1456.23058987491"), 19 | "golden ratio 1024.56:?" => test_zci("Golden ratio: 1024.56 : 1657.77290351359"), 20 | "golden ratio ?:900" => test_zci("Golden ratio: 556.230589874905 : 900"), 21 | "golden ratio ?:768.5" => test_zci("Golden ratio: 474.959120354294 : 768.5"), 22 | "golden ratio ?:1680.12345678" => test_zci("Golden ratio: 1038.37340158601 : 1680.12345678"), 23 | "golden ratio 1 : ?" => test_zci("Golden ratio: 1 : 1.61803398874989"), 24 | "golden ratio 1 :?" => test_zci("Golden ratio: 1 : 1.61803398874989"), 25 | "golden ratio 1: ?" => test_zci("Golden ratio: 1 : 1.61803398874989"), 26 | "golden ratio ? : 9" => test_zci("Golden ratio: 5.56230589874905 : 9"), 27 | "golden ratio ? :9" => test_zci("Golden ratio: 5.56230589874905 : 9"), 28 | "golden ratio ?: 9" => test_zci("Golden ratio: 5.56230589874905 : 9"), 29 | 'golden ratio ?:123.345' => test_zci('Golden ratio: 76.2314023423558 : 123.345'), 30 | ); 31 | 32 | done_testing; 33 | --------------------------------------------------------------------------------