Skip to content

Instantly share code, notes, and snippets.

View Jonathan-Ironman's full-sized avatar

Jonathan Jonathan-Ironman

View GitHub Profile
var text = "Long text with newlines";
text.split(/\r\n?|\n/); // Preserves empty lines.
text.split(/[\r\n]+/); // Drops empty lines.
// Retrieve your data from locaStorage
var saveData = JSON.parse(localStorage.saveData || null) || {};
// Store your data.
function saveStuff(obj) {
saveData.obj = obj;
// saveData.foo = foo;
saveData.time = new Date().getTime();
localStorage.saveData = JSON.stringify(saveData);
}
var L = navigator.plugins.length;
document.write(
L.toString() + " Plugin(s)<br>" +
"Name | Filename | Description<br>");
for (var i = 0; i < L; i++) {
document.write(
navigator.plugins[i].name +
" | " + navigator.plugins[i].filename +
function createGUID() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = Math.random() * 16 | 0,
v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}