If you hit return in the main input field, create new **Todo** model, persisting it to *localStorage*.
559640
function (e) {
			if (e.which !== ENTER_KEY || !this.$input.val().trim()) {
				return;
			}

			app.todos.create(this.newAttributes());
			this.$input.val('');
		}
1300306
function (key, defaultValue) {
            var input = self.session.get('_old_input', []);

            // Input that is flashed to the session can be easily retrieved by the
            // developer, making repopulating old forms and the like much more
            // convenient, since the request's previous input is available.
            if (key) {
                return isset(input[key]) ? input[key] : defaultValue;
            } else {
                return input;
            }
        }
968996
def add
      return if !verify_logged_in      
      
      resp = Caboose::StdClass.new
      
      if SavedSearch.exists?(:uri => params[:uri])
        resp.redirect = "/saved-searches"
      else        
        search = SavedSearch.new(
          :user_id        => logged_in_user.id,
          :date_last      => Date.today,
          :interval       => 1,
          :notify         => true,
          :uri            => params[:uri],
          :property_type  => params[:property_type],
          :params         => params[:params]        
        )
        if search.save
          resp.redirect = "/saved-searches"        
        else
          resp.error = "There was an error saving your search."        
        end
      end
      render :json => resp
    end
733312
function addTodo(text) {
    var todo = {
      _id: new Date().toISOString(),
      title: text,
      completed: false
    };
    db.put(todo, function callback (err, result) {
      if (!err) {
        console.log('Successfully posted a todo!');
      }
    });
  }
1039979
function (req, res) {
        var {name} = new {modelName}({{createFields}
        });

        {name}.save(function (err, {name}) {
            if (err) {
                return res.status(500).json({
                    message: 'Error when creating {name}',
                    error: err
                });
            }
            return res.status(201).json({name});
        });
    }
358085
function initModelNew (args) {
    var controller = this
    var model = this.model
    // if model/controller does not have form then cannot create new controller
    if (!this.form) {
        return
    }
    // create path if it does not exist
    if (!this.paths['/new']) {
        this.paths['/new'] = {}
    }
    // get accountId column
    var accountIdColumn = model.columnName('accountId') 
    // set role to authenticated if model requires account id
    var role = args.defaultRole || (accountIdColumn && model.columns[accountIdColumn].null === false ? 'authenticated' : 'all')
    // form inputs
    var input = {
        redirect: 'query.redirect',
    }
    // input may include pre-filled form values
    input[model.name] = 'query.'+model.name
    // add handler for GET /new
    this.paths['/new'].get = [
        {
            before: function (args) {
                return newInstance(controller, args)
            },
            input: input,
            method: function (args) {
                return {form: args.form}
            },
            methodName: 'new',
            role: role,
            template: 'instance',
        },
    ]
}
1176170
function(model, options) {
      options = options ? _.clone(options) : {};
      var wait = options.wait;
      model = this._prepareModel(model, options);
      if (!model) return false;
      if (!wait) this.add(model, options);
      var collection = this;
      var success = options.success;
      options.success = function(m, resp, callbackOpts) {
        if (wait) collection.add(m, callbackOpts);
        if (success) success.call(callbackOpts.context, m, resp, callbackOpts);
      };
      model.save(null, options);
      return model;
    }
682851
function createTodo(state: State, text: ?string): State {
  if (!text) {
    return state;
  }
  var newTodo = new Todo(text);
  return state.set(newTodo.id, newTodo);
}
1194546
function(key, ctx, partials, returnFound) {
      var found,
          names = key.split('.'),
          val = this.f(names[0], ctx, partials, returnFound),
          doModelGet = this.options.modelGet,
          cx = null;

      if (key === '.' && isArray(ctx[ctx.length - 2])) {
        val = ctx[ctx.length - 1];
      } else {
        for (var i = 1; i < names.length; i++) {
          found = findInScope(names[i], val, doModelGet);
          if (found != null) {
            cx = val;
            val = found;
          } else {
            val = '';
          }
        }
      }

      if (returnFound && !val) {
        return false;
      }

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

      return val;
    }
348419
def save_new(self, form, commit=True):
        
        kwargs = {self.fk.get_attname(): self.instance.pk}
        new_obj = self.model(**kwargs)
        self._prepare_multilingual_object(new_obj, form)
        return forms.save_instance(form, new_obj, exclude=[self._pk_field.name], commit=commit)
605772
def create(self, **fields):
        """"""
        entry = self.instance(**fields)
        entry.save()
        return entry
515318
function(todo) {
			var view = new window.app.TodoView({model: todo, el: $('#todo-template li').clone()});
			$("#todo-list").append(view.render().el);
		}
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);
                    }
                });
            }
        }
309109
function todoapp()
{
  var self = this;
  /* the main title */
  this.title = "todo";
  this.fontSize = 40;
  this.color = "#c8c8c8";
  
  this.swappable = 'hello';
  
  this.listen('todoapp__todolist','complete',function(e){
    if(!e.initial) this.flash(e);
  });
  
  this.titleclick = function(e)
  {
    self.getdata();
    if(self.swappable === 'hello')
    {
      self.swappable = 'goodbye';
    }
    else
    {
      self.swappable = 'hello';
    }
  }
}
828760
function () {
            // bind all of our elements
            var o=this.OPT, 
                ids = this.get(o.IDS), 
                els = this.get(o.ELEMENTS), 
                      i, el, id;

            // Add the default value as a key for each element for easier lookup
            for (i in this.ID) {
                if (lang.hasOwnProperty(this.ID, i)) {
                    ids[this.ID[i]] = ids[i];
                }
            }

            // Check for picker element, if not there, create all of them
            el = Dom.get(ids[this.ID.PICKER_BG]);
            if (!el) {
                this._createElements();
            } else {
                this.logger.log("Using pre-existing markup");
            }

            for (i in ids) {
                if (lang.hasOwnProperty(ids, i)) {
                    // look for element
                    el = Dom.get(ids[i]);

                    // generate an id if the implementer passed in an element reference,
                    // and the element did not have an id already
                    id = Dom.generateId(el);

                    // update the id in case we generated the id
                    ids[i] = id; // key is WEBSAFE_SWATCH
                    ids[ids[i]] = id; // key is websafe_swatch

                    // store the dom ref
                    els[id] = el;
                }
            }

        }
767041
def create_new_model(model, from_method)
      if model.is_a?(Model)
        if model.buffer?
          fail "The #{from_method} does not take a buffer.  Call .save! on buffer's to persist them."
        end

        # Set the new path and the persistor.
        model.options = @options.merge(parent: self, path: @options[:path] + [:[]])
      else
        model = wrap_values([model]).first
      end


      if model.is_a?(Model)
        promise = model.can_create?.then do |can_create|
          unless can_create
            fail "permissions did not allow create for #{model.inspect}"
          end
        end.then do

          # Add it to the array and trigger any watches or on events.
          reactive_array_append(model)

          @persistor.added(model, @array.size - 1)
        end.then do
          nil.then do
            # Validate and save
            model.run_changed
          end.then do
            # Mark the model as not new
            model.instance_variable_set('@new', false)

            # Mark the model as loaded
            model.change_state_to(:loaded_state, :loaded)

          end.fail do |err|
            # remove from the collection because it failed to save on the server
            # we don't need to call delete on the server.
            index = @array.index(model)
            delete_at(index, true)

            # remove from the id list
            @persistor.try(:remove_tracking_id, model)

            # re-raise, err might not be an Error object, so we use a rejected promise to re-raise
            Promise.new.reject(err)
          end
        end
      else
        promise = nil.then do
          # Add it to the array and trigger any watches or on events.
          reactive_array_append(model)

          @persistor.added(model, @array.size - 1)
        end
      end

      promise = promise.then do
        # resolve the model
        model
      end

      # unwrap the promise if the persistor is synchronus.
      # This will return the value or raise the exception.
      promise = promise.unwrap unless @persistor.async?

      # return
      promise
    end
750152
function persist (args) {
    // return original method call
    return this.model.createMeta({
        data: args,
        duplicate: true,
        responseIdOnly: true,
        session: this.session,
    })
}