forked from duckduckgo/zeroclickinfo-spice
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
grep -rl $'\r' | xargs dos2unix
- Loading branch information
Showing
4 changed files
with
264 additions
and
264 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
package DDG::Spice::HackerNews; | ||
|
||
use DDG::Spice; | ||
|
||
triggers startend => "hn", "hackernews", "hacker news", "news.yc", "news.ycombinator.com", "hn search", "hnsearch", "hacker news search", "hackernews search"; | ||
|
||
spice to => 'http://api.thriftdb.com/api.hnsearch.com/items/_search?q=$1&limit=50&weights[title]=1.1&weights[text]=0.7&weights[domain]=2.0&weights[username]=0.1&weights[type]=0.0&weights[points]=1.25&boosts[fields][points]=0.15&boosts[fields][num_comments]=0.15&boosts[functions][pow%282,div%28div%28ms%28create_ts,NOW%29,3600000%29,72%29%29]=200.0&callback={{callback}}'; | ||
|
||
primary_example_queries "hn postgresql"; | ||
description "Search the Hacker News database for related stories/comments"; | ||
name "HackerNews"; | ||
code_url "https://github.com/duckduckgo/zeroclickinfo-spice/blob/master/lib/DDG/Spice/HackerNews.pm"; | ||
icon_url "/i/www.hnsearch.com.ico"; | ||
topics "programming", "social"; | ||
category "forums"; | ||
attribution github => ['https://github.com/adman','Adman'], | ||
twitter => ['http://twitter.com/adman_X','adman_X']; | ||
status "enabled"; | ||
|
||
handle remainder => sub { | ||
return $_ if defined $_; | ||
}; | ||
|
||
package DDG::Spice::HackerNews; | ||
|
||
use DDG::Spice; | ||
|
||
triggers startend => "hn", "hackernews", "hacker news", "news.yc", "news.ycombinator.com", "hn search", "hnsearch", "hacker news search", "hackernews search"; | ||
|
||
spice to => 'http://api.thriftdb.com/api.hnsearch.com/items/_search?q=$1&limit=50&weights[title]=1.1&weights[text]=0.7&weights[domain]=2.0&weights[username]=0.1&weights[type]=0.0&weights[points]=1.25&boosts[fields][points]=0.15&boosts[fields][num_comments]=0.15&boosts[functions][pow%282,div%28div%28ms%28create_ts,NOW%29,3600000%29,72%29%29]=200.0&callback={{callback}}'; | ||
|
||
primary_example_queries "hn postgresql"; | ||
description "Search the Hacker News database for related stories/comments"; | ||
name "HackerNews"; | ||
code_url "https://github.com/duckduckgo/zeroclickinfo-spice/blob/master/lib/DDG/Spice/HackerNews.pm"; | ||
icon_url "/i/www.hnsearch.com.ico"; | ||
topics "programming", "social"; | ||
category "forums"; | ||
attribution github => ['https://github.com/adman','Adman'], | ||
twitter => ['http://twitter.com/adman_X','adman_X']; | ||
status "enabled"; | ||
|
||
handle remainder => sub { | ||
return $_ if defined $_; | ||
}; | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
package DDG::SpiceBundle::OpenSourceDuckDuckGo; | ||
# ABSTRACT: The open source Spice Bundle of DuckDuckGo | ||
|
||
# This package is only a namespace/version holder | ||
|
||
1; | ||
package DDG::SpiceBundle::OpenSourceDuckDuckGo; | ||
# ABSTRACT: The open source Spice Bundle of DuckDuckGo | ||
|
||
# This package is only a namespace/version holder | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
function ddg_spice_github_jobs(github) { | ||
if(github.length > 0) { | ||
var query = DDG.get_query(); | ||
var re = /(?:\s*(?:i\s+|we\s+)?(?:need|want|deserve|seek|get)\s+(?:an?\s+)?)?(?:(.+)\s+)(?:jobs?|work|employment)(?:\s+(?:in\s+)?(.+))?/; | ||
var description = query.replace(re, "$1"); | ||
var location = query.replace(re, "$2"); | ||
var moreat = "https://jobs.github.com/positions?description=" + encodeURIComponent(description) + "&location=" + encodeURIComponent(location); | ||
var out = '' | ||
out += '<div style="jobs"><ul>'; | ||
for(var i = 0;i < github.length;i++) { | ||
out += '<li><a href="' + github[i].url + '">' + github[i].title | ||
+ '</a> in ' + github[i].location + ' (' + github[i].company + ')</li>'; | ||
} | ||
out += '</ul>'; | ||
var items = [[]]; | ||
items[0]['a'] = out; | ||
items[0]['h'] = query + ' (GitHub Jobs)'; | ||
items[0]['s'] = 'GitHub'; | ||
items[0]['u'] = moreat; | ||
items[0]['force_big_header'] = true; | ||
|
||
nra(items); | ||
} | ||
} | ||
function ddg_spice_github_jobs(github) { | ||
if(github.length > 0) { | ||
var query = DDG.get_query(); | ||
var re = /(?:\s*(?:i\s+|we\s+)?(?:need|want|deserve|seek|get)\s+(?:an?\s+)?)?(?:(.+)\s+)(?:jobs?|work|employment)(?:\s+(?:in\s+)?(.+))?/; | ||
var description = query.replace(re, "$1"); | ||
var location = query.replace(re, "$2"); | ||
var moreat = "https://jobs.github.com/positions?description=" + encodeURIComponent(description) + "&location=" + encodeURIComponent(location); | ||
var out = '' | ||
out += '<div style="jobs"><ul>'; | ||
for(var i = 0;i < github.length;i++) { | ||
out += '<li><a href="' + github[i].url + '">' + github[i].title | ||
+ '</a> in ' + github[i].location + ' (' + github[i].company + ')</li>'; | ||
} | ||
out += '</ul>'; | ||
var items = [[]]; | ||
items[0]['a'] = out; | ||
items[0]['h'] = query + ' (GitHub Jobs)'; | ||
items[0]['s'] = 'GitHub'; | ||
items[0]['u'] = moreat; | ||
items[0]['force_big_header'] = true; | ||
|
||
nra(items); | ||
} | ||
} |
Oops, something went wrong.