Skip to content

Instantly share code, notes, and snippets.

View luisdepau's full-sized avatar

Luis De Pau luisdepau

View GitHub Profile
@clayperez
clayperez / Code.gs
Created December 18, 2019 14:53
AUTO-Generate Unique IDs in Google Sheets
// AUTO GENERATE SIMPLE UNIQUE ID'S FOR NON-EMPTY ROWS
//
// Author: Carlos Perez, clayperez@gmail.com
//
// Purpose: This Google Sheets script fires when any cell is edited and
// inserts a random (reasonably unique) UID of ID_LENGTH length
// into the specified ID_COLUMN. For instance if the first column in the
// sheet specified by SHEETNAME is the column where you would like the
// UID injected, then ID_COLUMN should be 1.
//
@ScottKaye
ScottKaye / Hide URL Parameters.js
Last active April 18, 2024 12:30
Hide URL parameters using Javascript's history.replaceState methods. The server (PHP or whatever) will still see it of course, but this script will quickly 'hide' the parameters. Don't use this to hide anything sensitive - there shouldn't be anything sensitive in GET anyway, but I use this to hide various un-pretty things like ?error=invalidPass…
function getURLParameter(name) {
return decodeURI((RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]);
}
function hideURLParams() {
//Parameters to hide (ie ?success=value, ?error=value, etc)
var hide = ['success','error'];
for(var h in hide) {
if(getURLParameter(h)) {
history.replaceState(null, document.getElementsByTagName("title")[0].innerHTML, window.location.pathname);
}