markdown 使用GitHub Search API可以找到5件有趣的东西

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 使用GitHub Search API可以找到5件有趣的东西相关的知识,希望对你有一定的参考价值。

### Find the most commented issues in the past month

OK. OK. You were only expecting 5 examples. But since you read this far, here's a bonus one.

```sh
# We'll use the `date` command to get the date for "1 month ago"
$ date -v-1m '+%Y-%m-%d'
# => 2013-06-23

$ curl -G https://api.github.com/search/issues             \
    --data-urlencode "q=created:>`date -v-7d '+%Y-%m-%d'`" \
    --data-urlencode 'sort=comments'                       \
    --data-urlencode 'order=desc'                          \
    -H 'Accept: application/vnd.github.preview'            \
    | jq '.items[0,1,2] | {html_url, title, comments}'
```

I ran this a couple months ago, when we were first sketching out the search API. What did I find? A Pull Request to remove all press representatives from bitcoin.org. Followed by another Pull Request to counteract the first one.

Interesting times.

```json
{
  "comments": 158,
  "title": "Remove press representatives",
  "html_url": "https://github.com/bitcoin/bitcoin.org/issues/152"
}
{
  "comments": 151,
  "title": "Add several independent voices to the Press Center page",
  "html_url": "https://github.com/bitcoin/bitcoin.org/issues/162"
}
{
  "comments": 150,
  "title": "Select and implement a template engine (or The issue to discuss everything Framework refactoring)",
  "html_url": "https://github.com/joomla/jissues/issues/86"
}
```

Check out the [Issue Search API docs][1] for more details.

[1]: http://developer.github.com/v3/search/#search-issues
### What does John Resig work on other than JavaScript?

```sh
$ curl -G https://api.github.com/search/repositories   \
    --data-urlencode 'q=@jeresig -language:javascript' \
    -H 'Accept: application/vnd.github.preview'        \
    | jq '.items[] | {html_url, watchers_count, language, name}'
```

```json
{
  "name": "processing-js",
  "language": "Java",
  "watchers_count": 1455,
  "html_url": "https://github.com/jeresig/processing-js"
}
{
  "name": "selectortest",
  "language": null,
  "watchers_count": 12,
  "html_url": "https://github.com/jeresig/selectortest"
}
{
  "name": "wtpa-bot",
  "language": "Perl",
  "watchers_count": 9,
  "html_url": "https://github.com/jeresig/wtpa-bot"
}
{
  "name": "jeresig.github.com",
  "language": null,
  "watchers_count": 6,
  "html_url": "https://github.com/jeresig/jeresig.github.com"
}
{
  "name": "apples2artworks",
  "language": "Python",
  "watchers_count": 1,
  "html_url": "https://github.com/jeresig/apples2artworks"
}
{
  "name": "datacook",
  "language": "Perl",
  "watchers_count": 0,
  "html_url": "https://github.com/jeresig/datacook"
}
```

@jeresig has a [repo with zero people watching it][1]?
This changes my whole worldview.

---

Check out the [Repository Search API docs][2] for more details.

[1]: https://github.com/jeresig/datacook
[2]: http://developer.github.com/v3/search/#search-repositories
### Find recently-indexed Clojure projects using an MIT license

Rebels! I bet these dudes don't like [hammocks][1] either.

```sh
$ curl -G https://api.github.com/search/code          \
    --data-urlencode 'q=MIT License path:project.clj' \
    --data-urlencode 'sort=indexed'                   \
    --data-urlencode 'order=desc'                     \
    -H 'Accept: application/vnd.github.preview'       \
    | jq '.items[0,1,2] | {description: (.repository.description), name: (.repository.full_name), html_url}'
```

```json
{
  "html_url": "https://github.com/royvandewater/optparse/blob/e4bb8558405ffd7ba6a14718b89e7cd418b5565e/project.clj",
  "name": "royvandewater/optparse",
  "description": "Option parser for clojure"
}
{
  "html_url": "https://github.com/SnootyMonkey/coming-soon/blob/108decfd74338ba5428580c8cd156f684484d3b2/project.clj",
  "name": "SnootyMonkey/coming-soon",
  "description": "coming-soon is a simple Clojure/ClojureScript/Redis 'landing page' application that takes just a few minute to setup"
}
{
  "html_url": "https://github.com/rreas/ring-test/blob/5fd78404eec4f81033ae073c5a42ea8a55ccc75a/project.clj",
  "name": "rreas/ring-test",
  "description": "An integration test framework for ring web applications."
}
```

Check out the [Code Search API docs][2] for more details.

[1]: http://data-sorcery.org/2010/12/29/hammock-driven-dev/
[2]: http://developer.github.com/v3/search/#search-code
### How many issues do Ruby developers create each day?

Track issue trends over time.

```sh
for i in {1..7}
do
    created_on=`date -v-"${i}"d '+%Y-%m-%d'`
    issue_count=$(                                                      \
        curl -G https://api.github.com/search/issues                    \
        --data-urlencode "q=language:ruby created:$created_on"          \
        -H "Authorization: token REDACTED"                              \
        -H "Accept: application/vnd.github.preview" | jq ".total_count" \
    )

    echo "$created_on: $issue_count"
done
```

```
2013-07-22: 1174
2013-07-21: 716
2013-07-20: 687
2013-07-19: 1336
2013-07-18: 1348
2013-07-17: 1471
2013-07-16: 1386
```

Check out the [Issue Search API docs][1] for more details.

[1]: http://developer.github.com/v3/search/#search-issues
### Find the oldest user accounts with zero followers

Go follow these poor souls.

```sh
$ curl -G https://api.github.com/search/users   \
    --data-urlencode 'q=followers:0'            \
    --data-urlencode 'sort=joined'              \
    --data-urlencode 'order=asc'                \
    -H 'Accept: application/vnd.github.preview' \
    | jq '.items[0,1,2] | {html_url, login, id}'
```

```json
{
  "id": 30,
  "login": "fanvsfan",
  "html_url": "https://github.com/fanvsfan"
}
{
  "id": 32,
  "login": "railsjitsu",
  "html_url": "https://github.com/railsjitsu"
}
{
  "id": 44,
  "login": "errfree",
  "html_url": "https://github.com/errfree"
}
```

Check out the [User Search API docs][1] for more details.

[1]: http://developer.github.com/v3/search/#search-users
### Find the hottest repositories created in the last week

Keep an eye on the latest trending repos.

```sh
# We'll use the `date` command to get the date for "7 days ago"
$ date -v-7d '+%Y-%m-%d'
# => 2013-07-15

$ curl -G https://api.github.com/search/repositories       \
    --data-urlencode "q=created:>`date -v-7d '+%Y-%m-%d'`" \
    --data-urlencode "sort=stars"                          \
    --data-urlencode "order=desc"                          \
    -H "Accept: application/vnd.github.preview"            \
    | jq ".items[0,1,2] | {name, description, language, watchers_count, html_url}"
```

```json
{
  "html_url": "https://github.com/mame/quine-relay",
  "watchers_count": 2492,
  "language": "Ruby",
  "description": "An uroboros program with 50 programming languages",
  "name": "quine-relay"
}
{
  "html_url": "https://github.com/jehna/VerbalExpressions",
  "watchers_count": 483,
  "language": "JavaScript",
  "description": "JavaScript Regular expressions made easy",
  "name": "VerbalExpressions"
}
{
  "html_url": "https://github.com/applidium/ADTransitionController",
  "watchers_count": 340,
  "language": "Objective-C",
  "description": "UINavigationController with custom transitions",
  "name": "ADTransitionController"
}
```

Check out the [Repository Search API docs][1] for more details.

[1]: http://developer.github.com/v3/search/#search-repositories
### 5 entertaining things you can find with the GitHub Search API

Let's have some command-line fun with curl, [jq][1], and the [new GitHub Search API][2].

Today we're looking for:

- [The hottest repositories created in the last week](#file-01-trending-repos-md).
- [The oldest user accounts with zero followers](#file-02-lonely-users-md). (So sad.)
- [Issue trends by language](#file-03-issue-trends-md).
- [Clojure projects defying convention](#file-04-rebel-clojure-projects-md).
- [John Resig's hobbies outside of JavaScript](#file-05-resig-md).

[1]: http://stedolan.github.io/jq/
[2]: http://developer.github.com/changes/2013-07-19-preview-the-new-search-api/

以上是关于markdown 使用GitHub Search API可以找到5件有趣的东西的主要内容,如果未能解决你的问题,请参考以下文章

markdown 高级PR Search.md

markdown google_search_english_cheatsheet

markdown pip install with version search

markdown BigQuery的Google Search Console API

markdown ga-ua-track-search-with-0-results.md

使用GitHub作为Markdown图床