If you hit return in the main input field, create new **Todo** model, persisting it to *localStorage*.
339622
function(e) {
      if (e.keyCode != 13) return;
      if (!this.input.val()) return;

      Todos.create({title: this.input.val()});
      this.input.val('');
    }
1137481
function () {
    var title = newTodoTitle.trim();
    if (title) {
      model.create(newTodoTitle, function (results) {
        var todo = createTodoComponent(listComponent, results[0].id, results[0].title);
        todos.push(todo);
        itemsLeft++;
        checkedAll = false;
      });
    }
  }
1344959
function(cb) {
		var todos = [], prevTodos;
		var model = this;

		open().then(function(db){
			var os = db.transaction(["todos"], "readwrite")
				.objectStore("todos");

			var req = os.openCursor();

			req.onsuccess = function(e){
				var cursor = e.target.result;
				if(cursor){
					todos.push(cursor.value);
					cursor.continue();
				} else {
					prevTodos = todos.slice();
					cb.call(model, todos);
					done();
				}
			};

			function done(){
				(todos || []).forEach(function(todo){
					os.put(todo);
				});
				prevTodos.forEach(function(todo){
					if(todos.indexOf(todo) === -1) {
						os["delete"](todo.text);
					}
				});
			}
		});
	  }
521849
function(model, options) {
    options = options ? extend({}, options) : {};
    if (!(model = this._prepareModel(model, options))){
      return false;
    }
    if (!options.wait){
      this.add(model, options);
    }
    var collection = this;
    options.cb = options.callback;
    options.callback = function cb(err, model, response){
      if (err){
        return callback(err, model, response, options);
      }
      if (options.wait){
        collection.add(model, options);
      }
      callback(null, model, response, options);
    };

    model.save(null, options);
    return model;
  }
615355
function Model(defaults){

    // Make sure "new" is always used,
    // so we can use "instanceof" to check if something is a Model.
    if (!(this instanceof Model)) {
      return new Model(defaults);
    }

    // `model` is the public API object returned from invoking `new Model()`.
    var model = this,

        // The internal stored values for tracked properties. { property -> value }
        values = {},

        // The callback functions for each tracked property. { property -> [callback] }
        listeners = {},

        // The set of tracked properties. { property -> true }
        trackedProperties = {};

    // The functional reactive "when" operator.
    //
    //  * `properties` An array of property names (can also be a single property string).
    //  * `callback` A callback function that is called:
    //    * with property values as arguments, ordered corresponding to the properties array,
    //    * only if all specified properties have values,
    //    * once for initialization,
    //    * whenever one or more specified properties change,
    //    * on the next tick of the JavaScript event loop after properties change,
    //    * only once as a result of one or more synchronous changes to dependency properties.
    function when(properties, callback, thisArg){
      
      // Make sure the default `this` becomes 
      // the object you called `.on` on.
      thisArg = thisArg || this;

      // Handle either an array or a single string.
      properties = (properties instanceof Array) ? properties : [properties];

      // This function will trigger the callback to be invoked.
      var listener = debounce(function (){
        var args = properties.map(function(property){
          return values[property];
        });
        if(allAreDefined(args)){
          callback.apply(thisArg, args);
        }
      });

      // Trigger the callback once for initialization.
      listener();
      
      // Trigger the callback whenever specified properties change.
      properties.forEach(function(property){
        on(property, listener);
      });

      // Return this function so it can be removed later with `model.cancel(listener)`.
      return listener;
    }

    // Adds a change listener for a given property with Backbone-like behavior.
    // Similar to http://backbonejs.org/#Events-on
    function on(property, callback, thisArg){
      thisArg = thisArg || this;
      getListeners(property).push(callback);
      track(property, thisArg);
    }
    
    // Gets or creates the array of listener functions for a given property.
    function getListeners(property){
      return listeners[property] || (listeners[property] = []);
    }

    // Tracks a property if it is not already tracked.
    function track(property, thisArg){
      if(!(property in trackedProperties)){
        trackedProperties[property] = true;
        values[property] = model[property];
        Object.defineProperty(model, property, {
          get: function () { return values[property]; },
          set: function(newValue) {
            var oldValue = values[property];
            values[property] = newValue;
            getListeners(property).forEach(function(callback){
              callback.call(thisArg, newValue, oldValue);
            });
          }
        });
      }
    }

    // Cancels a listener returned by a call to `model.when(...)`.
    function cancel(listener){
      for(var property in listeners){
        off(property, listener);
      }
    }

    // Removes a change listener added using `on`.
    function off(property, callback){
      listeners[property] = listeners[property].filter(function (listener) {
        return listener !== callback;
      });
    }

    // Sets all of the given values on the model.
    // `newValues` is an object { property -> value }.
    function set(newValues){
      for(var property in newValues){
        model[property] = newValues[property];
      }
    }

    // Transfer defaults passed into the constructor to the model.
    set(defaults);

    // Public API.
    model.when = when;
    model.cancel = cancel;
    model.on = on;
    model.off = off;
    model.set = set;
  }
818539
function(model) {
    if (model.isNew())
      return false
    this.localStorage().removeItem(this.name+"-"+model.id);
    this.records = _.reject(this.records, function(id){
      return id === model.id.toString();
    });
    this.save();
    return model;
  }
1252160
function(key, ctx, partials, returnFound) {
      var val = false,
          v = null,
          found = false,
          doModelGet = this.options.modelGet;

      for (var i = ctx.length - 1; i >= 0; i--) {
        v = ctx[i];
        val = findInScope(key, v, doModelGet);
        if (val != null) {
          found = true;
          break;
        }
      }

      if (!found) {
        return (returnFound) ? false : "";
      }

      if (!returnFound && typeof val == 'function') {
        val = this.mv(val, ctx, partials);
      }

      return val;
    }
460931
function (model, options, callback) {

                var self = this;

                flow()
                    .seq(function (cb) {
                        self._beforeModelSave(model, options, cb);
                    })
                    .seq("result", function (cb) {
                        self._saveModel(model, options, cb);
                    })
                    .seq(function (cb) {
                        self._afterModelSave(this.vars.result || model, options, cb);
                    })
                    .exec(function (err, results) {
                        callback && callback(err, results.result || model, options);
                    });
            }
954375
function newPutOne(endpoint, options) {
    // for backwards-compatibility <= 0.11.1
    if (_.isArray(options)) options = { allowable: options };
    else options = options || {};
    options.method = "put";
    return newPostOne(endpoint, options);
}
391506
function(o, callback) {
    var self = this;
    
    // Data is validated prior to being inserted
    var err = this.validateProperties(o);

    if (err) callback.call(self, err);
    
    else {
      
      // Convert object types to strings
      this.convertTypes(o);

      // Set model defaults
      this.setDefaults(o);

      // Save data into the database
      this.driver.insertInto({
        table: this.context,
        values: o
      }, function(err, id) {
        if (err) callback.call(self, err, null);
        else {
          callback.call(self, null, id);
        }
      });
      
    }

  }
209840
function(callback) {
            if (resumeEnabled) {
                qq.each(localStorage, function(key, item) {
                    if (key.indexOf(qq.format("qq{}resume", namespace)) === 0) {
                        var uploadData = JSON.parse(item);
                        callback(key, uploadData);
                    }
                });
            }
        }
682851
function createTodo(state: State, text: ?string): State {
  if (!text) {
    return state;
  }
  var newTodo = new Todo(text);
  return state.set(newTodo.id, newTodo);
}
605772
def create(self, **fields):
        """"""
        entry = self.instance(**fields)
        entry.save()
        return entry
154598
function() {
      
      // Attributes of the input field
      var attributes = {};
      attributes.id = this.divEl.id?this.divEl.id+'-field':YAHOO.util.Dom.generateId();
      attributes.type = "file";
      if(this.options.name) attributes.name = this.options.name;
   	if(this.options.size) attributes.size = this.options.size;
   	if(this.options.accept) attributes.accept = this.options.accept;

      // Create the node
      this.el = inputEx.cn('input', attributes);
      
      // Append it to the main element
      this.fieldContainer.appendChild(this.el);
   }
105006
function create(clientModelDoc, callback) {
      var cb = callback || angular.noop;

      return ClientModelDoc.create(clientModelDoc,
        function (clientModelDoc) {
          return cb(clientModelDoc);
        },
        function (err) {
          return cb(err);
        }).$promise;
    }
1092438
function() {
      var self = this;
      // Start by removing all old bindings and falling back to the initialized binding contents
      this.bindings = _.extend({}, this._bindings);

      // Stickit model two-way bindings
      _.each(this.$('[data-model]'), function(element) {
        var attr = $(element).data('model'),
            options = self.__getFieldOptions(attr),
            fieldBinding = self.__generateModelFieldBinding(attr, options);

        //add select options
        if ($(element).is('select')) {
          fieldBinding.selectOptions = self.__generateSelectOptions(element, options);
        }

        self.bindings['[data-model="' + attr + '"]'] = fieldBinding;
      });
    }
958580
function(todoEl) {
			var todoId = getClosestTodoId(todoEl),
				editInputEl = todoEl.querySelector('.edit'),
				title = todosDB.get(todoId).title; // Grab current label

			// Set the edit input value to current label
			editInputEl.value = title;

			todoEl.classList.add('editing');

			// Place user cursor in the input
			editInputEl.focus();
		}