Skip to content

Instantly share code, notes, and snippets.

@simonw
Created January 28, 2015 02:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simonw/aaabe56340c99819cb23 to your computer and use it in GitHub Desktop.
Save simonw/aaabe56340c99819cb23 to your computer and use it in GitHub Desktop.
Using gist.github.com to persist data from JavaScript running on any webpage
jQuery.get('https://api.github.com/gists/3a065d804c44b0149eac', function(data) {
console.log(data.files['file1.txt'].content)
});
jQuery.post('https://api.github.com/gists', JSON.stringify({
"description": "Saving some data",
"public": true,
"files": {
"file1.txt": {
"content": "Contents of file"
}
}
}), function(data) {
console.log("Data has been saved to", data.html_url)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment