*

@param {sprd.model.Product} product
@param {Object} [options]
@param {Function} callback
9443
function(product, options, callback) {

            if (arguments.length === 2) {
                callback = options;
                options = null;
            }

            if (options && options.clone) {
                product = product.clone(options.clone);
            }

            var bus = this.$.bus,
                self = this;

            //noinspection JSValidateTypes
            flow()
                .seq(function(cb) {
                    self.$.context.getCollection("printTypes").fetch({
                        fullData: true
                    }, cb);
                })
                .seq(function(cb) {
                    bus.setUp(product);
                    product.init(cb);
                })
                .exec(function(err) {
                    callback && callback(err, product);
                });
        }
1088624
function(options){
    this.triggerMethod("initialize:before", options);
    this._initCallbacks.run(options, this);
    this.triggerMethod("initialize:after", options);

    this.triggerMethod("start", options);
  }
417533
function(options) {
      inputEx.MultiAutoComplete.superclass.setOptions.call(this, options);
      
      // Method to format the ddlist item labels
      this.options.returnLabel = options.returnLabel;
   }
262234
def update(opts)
      opts = opts.merge(:option_id => self.option_id)
      Twocheckout::API.request(:post, 'products/update_option', opts)
      response = Twocheckout::API.request(:get, 'products/detail_option', opts)
      Option.new(response['option'][0])
    end
1360981
def makeProductPicker(self):
        
        productPicker = liveform.LiveForm(
            self.coerceProduct,
            [liveform.Parameter(
              str(id(product)),
              liveform.FORM_INPUT,
              liveform.LiveForm(
              lambda selectedProduct, product=product: selectedProduct and product,
              [liveform.Parameter(
                'selectedProduct',
                liveform.RADIO_INPUT,
                bool,
                repr(product))]
              ))
              for product
              in self.original.store.parent.query(Product)],
            u"Product to Install")
        return productPicker
713952
function doProduce(v, k) {
    try {
      var r = self._oldProduce(topic, partition,
        v, k,
        timestamp, opaque);

      self._hl.deliveryEmitter.once(opaque.__message_id, function(err, offset) {
        self._hl.pollingRef.decrement();
        setImmediate(function() {
          // Offset must be greater than or equal to 0 otherwise it is a null offset
          // Possibly because we have acks off
          callback(err, offset >= 0 ? offset : null);
        });
      });
      
      return r;
    } catch (e) {
      callback(e);
    }
  }
864905
function (options, callback) {
            options = options || {};

            if (options.limit || options.offset) {
                this.$offset = options.offset || 0;
                this.$limit = options.limit || this.$limit;
            }

            var self = this;

            function pageFetchedComplete(err, page, originalCallback) {
                var callback = function (err, page) {
                    if (originalCallback) {
                        originalCallback(err, page, options);
                    }
                };


                if (options.fetchModels || options.fetchSubModels) {

                    // TODO: introduce poolSize parameter for par, and parEach

                    flow()
                        .parEach(page.$items, function (model, cb) {
                            model.fetch({
                                fetchSubModels: options.fetchSubModels
                            }, cb);
                        })
                        .exec(function (err) {
                            callback(err, page);
                        });

                } else {
                    callback(err, page);
                }

            }

            if (this._fetch.state === State.LOADING) {
                // currently fetching -> register callback
                this._fetch.callbacks.push(function (err, page) {
                    pageFetchedComplete(err, page, callback);
                });
            } else if (this._fetch.state == State.LOADED) {
                // completed loaded -> execute
                pageFetchedComplete(null, this, callback);
            } else {
                // set state and start loading
                self._fetch.state = State.LOADING;

                this.$collection.$context.$dataSource.loadCollectionPage(this, options, function (err, page) {
                    self._fetch.state = err ? State.ERROR : State.LOADED;

                    // execute callbacks
                    pageFetchedComplete(err, page, callback);

                    _.each(self._fetch.callbacks, function (cb) {
                        cb(err, page);
                    });
                });
            }
        }
1140312
function(opts) {
			var i, n, options, label, self = this;
			opts = opts || {};
	
			if (self.tagType === TAG_SELECT) {
				options = [];
				for (i = 0, n = self.items.length; i < n; i++) {
					label = self.options[self.items[i]][self.settings.labelField] || '';
					options.push('<option value="' + escape_html(self.items[i]) + '" selected="selected">' + escape_html(label) + '</option>');
				}
				if (!options.length && !this.$input.attr('multiple')) {
					options.push('<option value="" selected="selected"></option>');
				}
				self.$input.html(options.join(''));
			} else {
				self.$input.val(self.getValue());
				self.$input.attr('value',self.$input.val());
			}
	
			if (self.isSetup) {
				if (!opts.silent) {
					self.trigger('change', self.$input.val());
				}
			}
		}
160627
function callback_(fn, obj) {
  var args = [];
  for (var i = 2, c = arguments.length; i < c; i++) {
    args.push(arguments[i]);
  }
  return function() {
    fn.apply(obj, args);
  };
}
489323
function(options) {
      var self = this;

      self.options = $.extend({}, defaultOptions, options);
      // When itemValue is set, freeInput should always be false
      if (self.objectItems)
        self.options.freeInput = false;

      makeOptionItemFunction(self.options, 'itemValue');
      makeOptionItemFunction(self.options, 'itemText');
      makeOptionFunction(self.options, 'tagClass');

      // Typeahead Bootstrap version 2.3.2
      if (self.options.typeahead) {
        var typeahead = self.options.typeahead || {};

        makeOptionFunction(typeahead, 'source');

        self.$input.typeahead($.extend({}, typeahead, {
          source: function (query, process) {
            function processItems(items) {
              var texts = [];

              for (var i = 0; i < items.length; i++) {
                var text = self.options.itemText(items[i]);
                map[text] = items[i];
                texts.push(text);
              }
              process(texts);
            }

            this.map = {};
            var map = this.map,
                data = typeahead.source(query);

            if ($.isFunction(data.success)) {
              // support for Angular callbacks
              data.success(processItems);
            } else if ($.isFunction(data.then)) {
              // support for Angular promises
              data.then(processItems);
            } else {
              // support for functions and jquery promises
              $.when(data)
               .then(processItems);
            }
          },
          updater: function (text) {
            self.add(this.map[text]);
            return this.map[text];
          },
          matcher: function (text) {
            return (text.toLowerCase().indexOf(this.query.trim().toLowerCase()) !== -1);
          },
          sorter: function (texts) {
            return texts.sort();
          },
          highlighter: function (text) {
            var regex = new RegExp( '(' + this.query + ')', 'gi' );
            return text.replace( regex, "<strong>$1</strong>" );
          }
        }));
      }

      // typeahead.js
      if (self.options.typeaheadjs) {

          // Determine if main configurations were passed or simply a dataset
          var typeaheadjs = self.options.typeaheadjs;
          if (!$.isArray(typeaheadjs)) {
              typeaheadjs = [null, typeaheadjs];
          }
          var valueKey = typeaheadjs[1].valueKey; // We should test typeaheadjs.size >= 1
          var f_datum = valueKey ? function (datum) { return datum[valueKey];  }
                                 : function (datum) {  return datum;  }
          $.fn.typeahead.apply(self.$input,typeaheadjs).on('typeahead:selected', $.proxy(function (obj, datum) {
              self.add( f_datum(datum) );
              self.$input.typeahead('val', '');
            }, self));

      }

      self.$container.on('click', $.proxy(function(event) {
        if (! self.$element.attr('disabled')) {
          self.$input.removeAttr('disabled');
        }
        self.$input.focus();
      }, self));

        if (self.options.addOnBlur && self.options.freeInput) {
          self.$input.on('focusout', $.proxy(function(event) {
              // HACK: only process on focusout when no typeahead opened, to
              //       avoid adding the typeahead text as tag
              if ($('.typeahead, .twitter-typeahead', self.$container).length === 0) {
                self.add(self.$input.val());
                self.$input.val('');
              }
          }, self));
        }

      // Toggle the 'focus' css class on the container when it has focus
      self.$container.on({
        focusin: function() {
          self.$container.addClass(self.options.focusClass);
        },
        focusout: function() {
          self.$container.removeClass(self.options.focusClass);
        },
      });

      self.$container.on('keydown', 'input', $.proxy(function(event) {
        var $input = $(event.target),
            $inputWrapper = self.findInputWrapper();

        if (self.$element.attr('disabled')) {
          self.$input.attr('disabled', 'disabled');
          return;
        }

        switch (event.which) {
          // BACKSPACE
          case 8:
            if (doGetCaretPosition($input[0]) === 0) {
              var prev = $inputWrapper.prev();
              if (prev.length) {
                self.remove(prev.data('item'));
              }
            }
            break;

          // DELETE
          case 46:
            if (doGetCaretPosition($input[0]) === 0) {
              var next = $inputWrapper.next();
              if (next.length) {
                self.remove(next.data('item'));
              }
            }
            break;

          // LEFT ARROW
          case 37:
            // Try to move the input before the previous tag
            var $prevTag = $inputWrapper.prev();
            if ($input.val().length === 0 && $prevTag[0]) {
              $prevTag.before($inputWrapper);
              $input.focus();
            }
            break;
          // RIGHT ARROW
          case 39:
            // Try to move the input after the next tag
            var $nextTag = $inputWrapper.next();
            if ($input.val().length === 0 && $nextTag[0]) {
              $nextTag.after($inputWrapper);
              $input.focus();
            }
            break;
         default:
             // ignore
         }

        // Reset internal input's size
        var textLength = $input.val().length,
            wordSpace = Math.ceil(textLength / 5),
            size = textLength + wordSpace + 1;
        $input.attr('size', Math.max(this.inputSize, $input.val().length));
      }, self));

      self.$container.on('keypress', 'input', $.proxy(function(event) {
         var $input = $(event.target);

         if (self.$element.attr('disabled')) {
            self.$input.attr('disabled', 'disabled');
            return;
         }

         var text = $input.val(),
         maxLengthReached = self.options.maxChars && text.length >= self.options.maxChars;
         if (self.options.freeInput && (keyCombinationInList(event, self.options.confirmKeys) || maxLengthReached)) {
            // Only attempt to add a tag if there is data in the field
            if (text.length !== 0) {
               self.add(maxLengthReached ? text.substr(0, self.options.maxChars) : text);
               $input.val('');
            }

            // If the field is empty, let the event triggered fire as usual
            if (self.options.cancelConfirmKeysOnEmpty === false) {
                event.preventDefault();
            }
         }

         // Reset internal input's size
         var textLength = $input.val().length,
            wordSpace = Math.ceil(textLength / 5),
            size = textLength + wordSpace + 1;
         $input.attr('size', Math.max(this.inputSize, $input.val().length));
      }, self));

      // Remove icon clicked
      self.$container.on('click', '[data-role=remove]', $.proxy(function(event) {
        if (self.$element.attr('disabled')) {
          return;
        }
        self.remove($(event.target).closest('.tag').data('item'));
      }, self));

      // Only add existing value as tags when using strings as tags
      if (self.options.itemValue === defaultOptions.itemValue) {
        if (self.$element[0].tagName === 'INPUT') {
            self.add(self.$element.val());
        } else {
          $('option', self.$element).each(function() {
            self.add($(this).attr('value'), true);
          });
        }
      }
    }
1168508
function create(options, callback) {
  var t = new TestObject(options);
  t.save(null, { success: callback });
}
757289
function WorkerJob(msg, options, callback) {
  this.msg = msg || {};
  this.options = options || {};
  this.callback = callback;
}
390801
function parseArguments(options, callback) {
    if (_.isUndefined(options) && _.isUndefined(callback)) { // No params
        return [{}, undefined];
    }
    if (!_.isUndefined(options) && _.isFunction(options)) { // Only callback param
        callback = options;
        options = {};
    }
    return [options, callback]; // Both params
}
1182378
protected function prepareProductItem(array &$product, array $options)
    {
        $this->setItemProductInComparison($product, $this->product_compare);
        $this->setItemPriceCalculated($product, $this->product);
        $this->setItemProductInWishlist($product, $this->wishlist);
        $this->setItemPriceFormatted($product, $this->price, $this->current_currency);
        $this->setItemProductBundle($product, $this->product, $this->image);
        $this->setItemRenderedProduct($product, $options);
    }
427934
public function AssignCallback($Callback, $Options = NULL) {
      if (!is_callable($Callback)) return FALSE;
      
      $this->Callback = $Callback;
      $this->CallbackOptions = $Options;
   }
1091943
function (uses, payload, message, callback) {
        executeMiddlewares(uses, payload, message, function (newPayload) {
            callback.apply(undefined, [newPayload]);
        });
    }
466319
function makeRespondMiddleware(opts) {
  opts = Object.assign({}, opts)

  // Make the respond function.
  const respond = makeRespond(opts)

  /**
   * Installs the functions in the context.
   *
   * @param  {KoaContext} ctx
   */
  function patch(ctx) {
    const statusMethods = Object.assign({}, opts.statusMethods, statusCodeMap)
    ctx.send = respond.bind(ctx, ctx)

    // Bind status methods.
    for (const method in statusMethods) {
      const code = statusMethods[method]
      ctx[method] = respond.bind(ctx, ctx, code)
    }

    // Bind other methods
    const methods = Object.assign({}, opts.methods)
    for (const method in methods) {
      const fn = methods[method]
      ctx[method] = fn.bind(ctx, ctx)
    }

    return ctx
  }

  /**
   * The respond middleware adds the methods to the context.
   *
   * @param  {KoaContext} ctx
   */
  function respondMiddleware(ctx, next) {
    patch(ctx)
    return next()
  }

  // Tack on the patch method to allow Koa 1 users
  // to install it, too.
  respondMiddleware.patch = patch
  return respondMiddleware
}