PageRenderTime 152ms CodeModel.GetById 4ms RepoModel.GetById 0ms app.codeStats 0ms

/lib/DDG/Spice/CodeSearch.pm

https://github.com/tarnfeld/zeroclickinfo-spice
Perl | 35 lines | 25 code | 10 blank | 0 comment | 1 complexity | fcbfd5554dac375329e9f3777c924636 MD5 | raw file
  1. package DDG::Spice::CodeSearch;
  2. use DDG::Spice;
  3. triggers startend => "code", "example";
  4. spice to => 'http://searchco.de/api/jsonp_codesearch_I/?q=$1&callback={{callback}}';
  5. primary_example_queries => "cobol sin";
  6. secondary_example_queries => "string php";
  7. description "Code search";
  8. name "CodeSearch";
  9. icon_url "/i/searchco.de.ico";
  10. source "search[code]";
  11. code_url "https://github.com/duckduckgo/zeroclickinfo-spice/blob/master/lib/DDG/Spice/CodeSearch.pm";
  12. topics => "sysadmin", "programming";
  13. category => "programming reference";
  14. attribution github => ['https://github.com/boyter','Ben Boyter'],
  15. twitter => ['http://twitter.com/boyter','boyter'];
  16. handle remainder => sub {
  17. if ($_ =~ m/\b(yaml|yacc|xslt|xsd|xml|xaml|visualbasic|vimscript|vhdl|teamcentermth|teamcentermet|teamcenterdef|tcl\/tk|sqldata|sql|softbridgebasic|smarty|skill|sed|scala|rubyhtml|ruby|rexx|python|php|perl|patrancommandlanguage|pascal|oraclereports|oracleforms|octave|ocaml|objectivec\+\+|objectivec|nantscripts|mxml|mumps|msbuildscripts|modula3|matlab|make|m4|lua|lisp|lex|kornshell|kermit|jsp|javascript|java|idl|html|haskell|groovy|go|fortran95|fortran90|fortran77|expect|erlang|dtd|dosbatch|dart|dal|d|cython|css|cshell|coldfusion|cobol|cmake|c#?|c\+\+|bourneshell|bourneagainshell|bc|awk|assembly|asp.net|as|ada|actionscript)\b/) {
  18. my $match = $1;
  19. $match =~ s/\+/\\+/g;
  20. s/\s*$match\s*//i;
  21. return "lang:".$match." ".$_;
  22. }
  23. return;
  24. };
  25. 1;