Skip to content

Instantly share code, notes, and snippets.

@petrosh
Last active August 5, 2021 10:35
Show Gist options
  • Save petrosh/8616917 to your computer and use it in GitHub Desktop.
Save petrosh/8616917 to your computer and use it in GitHub Desktop.
Gist Feed

Someone should make...

Github gist feed.
So you can see what people you follow are pasting in Github.

You can:

  • create a gist feed for code reference
  • show gists by keyword, language, or follower
  • enable replies and favoriting

API michael/github

https://github.com/michael/github

Particular user's gists

user.userGists(username, function(err, gists) {});

Get a gist

var gist = github.getGist(3165654);

// Read the contents of a Gist.
gist.read(function(err, gist) {

});

Response https://api.github.com/gists/5450088

{
  "created_at": "2012-11-09T22:02:23Z",
  "updated_at": "2013-12-08T08:22:24Z",
  "files": {
    "gistfile1.phtml": {
      "filename": "gistfile1.phtml",
      "type": "application/httpd-php",
      "language": "HTML+PHP",
      "raw_url": "https://gist.github.com/elparkino/5450088/raw/1cd97fe424225d877ec7b35ba822d1934a0dfc53/gistfile1.phtml",
      "size": 3449,
      "content": "..."
    }
  },
  "description": null,
  "fork_of": {
    "url": "https://api.github.com/gists/4048580",
    "forks_url": "https://api.github.com/gists/4048580/forks",
    "id": "4048580",
    "html_url": "https://gist.github.com/4048580",
    "user": {...}
  },
  "forks": [
    {
      "url": "https://api.github.com/gists/6436686",
      "user": {
        "login": "petrosh",
        "id": 4997583
      }
    }
  ],
  "history": [...]
}

To Do

GET /gists/starred
this.userGists = function(username, cb) {
  _request("GET", "/gists/starred", null, function(err, res) {
    cb(err,res);
  });
};

Parameters: since – A timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. Only gists updated at or after this time are returned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment