Skip to content

Instantly share code, notes, and snippets.

@gabmontes
Created May 9, 2016 15:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabmontes/55c239fbd798bafef49911457f2589e1 to your computer and use it in GitHub Desktop.
Save gabmontes/55c239fbd798bafef49911457f2589e1 to your computer and use it in GitHub Desktop.
Gists cleaner
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);
});
{
"dependencies": {
"async": "^1.5.2",
"github": "^0.2.4"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment