Skip to content

Instantly share code, notes, and snippets.

View pzaich's full-sized avatar

Paul Zaich pzaich

View GitHub Profile
@pzaich
pzaich / gist:3126360
Created July 17, 2012 01:35
save key value pair
$.totalStorage("savedlist", myList);
@pzaich
pzaich / gist:3126451
Created July 17, 2012 01:51
retrieve key
return $.totalStorage("savedlist");
@pzaich
pzaich / gist:3126463
Created July 17, 2012 01:53
list initialize
var listSaver = new SaveToDb();
var myList = new TaskList();
@pzaich
pzaich / gist:3126470
Created July 17, 2012 01:55
check for "savedList"
if (listSaver.not_empty()){
myList.entries = listSaver.retrieve();
console.log(myList.entries);
}
this.not_empty = function() {
return $.totalStorage("savedlist");
}
@pzaich
pzaich / gist:3126480
Created July 17, 2012 01:56
reinitialize objects from keys
this.retrieve = function() {
var rawList = $.totalStorage("savedlist");
// console.log(rawList);
return this.reloadList(rawList);
}
this.reloadList = function(rawObject) {
var array_of_tasks = []
for (var i = 0; i < rawObject.entries.length; i++){
var description = rawObject.entries[i].task_description
@pzaich
pzaich / keyvalue.js
Created July 17, 2012 02:02
key value saving
//The standard localStorage function for saving a value
localStorage.setItem(<key>, <value>);
//Using the nice jQuery plugin
$.totalStorage(<key>, <value>);
@pzaich
pzaich / dictionary.js
Created July 17, 2012 20:43
objectliteral.js
var objectLiteral = {
some_value: 0,
some_function: function (arguments) {
//function and return
}
};
var newObject = objectMaker();
var objectMaker = function(){
var instance = {};
instance.array = [];
instance.value = 0;
instance.someFunctionOfObject = function(arguments) {
//function returned here
}
return instance;
}
var objectConstructor = function(value){
this.value = value;
this.arr = [];
this.someFunctionBoundtoObject = function () {
//function bound to object here
}
//No return needed
};