Skip to content

Instantly share code, notes, and snippets.

@julianitor
julianitor / gist:8c5b7223d4dcdc2c48c8446d65958109
Created November 24, 2025 14:17
Delete old GH repo artifacts
REPO="owner/repo"
DAYS=30
# macOS/BSD date: use -v for offsets
cutoff=$(date -u -v -"${DAYS}"d +"%Y-%m-%dT%H:%M:%SZ")
gh api --paginate "repos/$REPO/actions/artifacts" \
-q '.artifacts[] | select(.expired==false) | {id: .id, name: .name, created_at: .created_at}' \
| jq -c --arg cutoff "$cutoff" '. | select(.created_at < $cutoff)' \
| jq -r '.id' \
@julianitor
julianitor / backbone-save-all.js
Created July 17, 2015 07:25
Save all models of a Backbone collection if they changed.
Backbone.Collection.prototype.saveAll = function(options) {
return $.when.apply($, _.map(this.models, function(m) {
return m.hasChanged() ? m.save(null, options).then(_.identity) : m;
}));
};