Skip to content

Instantly share code, notes, and snippets.

View samuelgoldenbaum's full-sized avatar

Samuel Goldenbaum samuelgoldenbaum

View GitHub Profile
@samuelgoldenbaum
samuelgoldenbaum / json-localstorage.js
Created June 30, 2012 13:20 — forked from robnyman/json-localstorage.js
JSON and localStorage
var cast = {
"Adm. Adama" : "Edward James Olmos",
"President Roslin" : "Mary McDonnell",
"Captain Adama" : "Jamie Bamber",
"Gaius Baltar" : "James Callis",
"Number Six" : "Tricia Helfer",
"Kara Thrace" : " Katee Sackhoff"
};
// Stores the JavaScript object as a string
(function () {
// IndexedDB
var indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB || window.OIndexedDB || window.msIndexedDB,
IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.OIDBTransaction || window.msIDBTransaction,
dbVersion = 1.0;
// Create/open database
var request = indexedDB.open("elephantFiles", dbVersion),
db,
createObjectStore = function (dataBase) {
@samuelgoldenbaum
samuelgoldenbaum / Object.inherit.js
Created July 3, 2012 14:20 — forked from andrewdavey/Object.inherit.js
Simple object inheritance in JavaScript
(function () {
"use strict";
var copyOwnProperties = function (from, to) {
for (var propertyName in from) {
if (from.hasOwnProperty(propertyName)) {
to[propertyName] = from[propertyName];
}
}
};