-
-
Save longtth/343c4c4d7f2ee7ce85b2bfccfe2d4a86 to your computer and use it in GitHub Desktop.
Delete all your gists
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
var async = require('async'); | |
var GitHubApi = require('github'); | |
var github = new GitHubApi({ | |
version: '3.0.0', | |
protocol: 'https' | |
}); | |
github.authenticate({ | |
type: 'basic', | |
username: 'user', | |
password: 'pass' | |
}); | |
async.waterfall([ | |
function (callback) { | |
github.gists.getAll({}, callback); | |
}, | |
function (gists, callback) { | |
// filter gists by properties as needed | |
async.each(gists, function (gist, callback) { | |
github.gists.delete({ | |
id: gist.id | |
}, callback); | |
}, callback); | |
} | |
], function (err) { | |
if (err) { | |
console.log('Execution failed: %s', err.message); | |
process.exit(1); | |
} | |
console.log('Done!'); | |
process.exit(0); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment