Skip to content

Instantly share code, notes, and snippets.

@tonyfast
Forked from ICBacon/MyFirstNotebook.yml
Last active August 29, 2015 14:25
Show Gist options
  • Save tonyfast/863827adf98937fa35a9 to your computer and use it in GitHub Desktop.
Save tonyfast/863827adf98937fa35a9 to your computer and use it in GitHub Desktop.
Programmatically discovering old gists

Accessing Old Gists

Example gist SHA 0c37e47f24531557decd

  1. List the commits from the gist

    https://gist.github.com/ICBacon/0c37e47f24531557decd/commits

  2. Open the console

  3. Parse the request

    // Deserialize API request into the console
    eval('var data = ' + document.getElementsByTagName('pre')[0].innerText )
    // Get the last Gist 
    gistUrl = data.slice(-1)[0]['url']
  4. Open the Github Gist

    // Replace the api location with the html uri location
    // Open that bad boy
    window.open(gistUrl.replace('https://api.github.com/gists/','https://gist.github.com/'))
  5. Open the Raw API

    ```javascript
    

    // Open that bad boy window.open(gistUrl)

    
    1. Parse the request again
    
    ```javascript
    // Deserialize API request into the console
    eval('var data = ' + document.getElementsByTagName('pre')[0].innerText )
    
    1. Copy homeboy into the clipboard
    copy(data['files']['MyFirstNotebook.ipynb']['content'])

References

Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment