Skip to content

Instantly share code, notes, and snippets.

@flowersinthesand
Last active December 26, 2015 18:49
Show Gist options
  • Save flowersinthesand/7197379 to your computer and use it in GitHub Desktop.
Save flowersinthesand/7197379 to your computer and use it in GitHub Desktop.
Creating a HTTP status const
$('#table-http-status-codes-1 tbody tr').each(function(i, elem) {
var code = elem.children[0].innerHTML;
var reason = elem.children[1].innerHTML;
if (!!+code && reason !== 'Unassigned') {
console.log('/**');
console.log(' * {@code '+code+' '+reason+'}');
console.log(' */');
console.log('public static final Status '+reason.toUpperCase().replace(/[\s\-]/ig, '_')+' = new Status('+code+', "'+reason+'");');
console.log('');
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment