Creates interface to build requests to retrieve products
from the public Product Hunt API.

@return {Object} `productHunt` module
972652
function productHunt() {
	let queryParams = { };

	return {

		/**
		 * Sets the request query parameters to fetch the
		 * most popular products from Product Hunt.
		 *
		 * @return {Object} `productHunt` module
		 */
		popular() {
			queryParams.filter = 'popular';

			return this;
		},

		/**
		 * Sets the request query parameters to fetch the
		 * newest products from Product Hunt.
		 *
		 * @return {Object} `productHunt` module
		 */
		newest() {
			queryParams.filter = 'newest';

			return this;
		},

		/**
		 * Sets the request query parameters to fetch todays
		 * products from Product Hunt.
		 *
		 * @return {Object} `productHunt` module
		 */
		today() {
			queryParams.page = 0;

			return this;
		},

		/**
		 * Sets the request query parameters to fetch
		 * yesterdays products from Product Hunt.
		 *
		 * @return {Object} `productHunt` module
		 */
		yesterday() {
			queryParams.page = 1;

			return this;
		},

		/**
		 * Sets the request query parameters to fetch
		 * Product Hunt products from `n` days ago.
		 *
		 * @param {Number} n - number of days
		 *
		 * @return {Object} `productHunt` module
		 */
		daysAgo(n) {
			const days = parseInt(n, 10);

			if (!isNaN(days)) {
				queryParams.page = days;
			}

			return this;
		},

		/**
		 * Executes the built request.
		 *
		 * @return {Promise} resolves to an Array of products
		 */
		exec() {
			const params = Object.assign(
				{},
				DEFAULT_QUERY_PARAMS,
				queryParams
			);

			const request = http.GET(API, params);

			queryParams = { };

			return request;
		}
	};
}
1091041
public function createAction()
    {
        $this->checkAuth(AdminResources::PRODUCT, [], AccessManager::CREATE);

        $baseForm = $this->createForm(ApiForm::PRODUCT_SALE_ELEMENTS, "form", [], [
            "validation_groups" => ["create", "Default"],
            'csrf_protection' => false,
            "cascade_validation" => true,
        ]);

        $con = Propel::getConnection(ProductSaleElementsTableMap::DATABASE_NAME);
        $con->beginTransaction();

        $createdIds = array();

        try {
            $form = $this->validateForm($baseForm);

            $entries = $form->getData();

            foreach ($entries["pse"] as $entry) {
                $createEvent = new ProductSaleElementCreateEvent(
                    ProductQuery::create()->findPk($entry["product_id"]),
                    $entry["attribute_av"],
                    $entry["currency_id"]
                );

                $createEvent->bindForm($form);

                $this->dispatch(TheliaEvents::PRODUCT_ADD_PRODUCT_SALE_ELEMENT, $createEvent);

                $this->processUpdateAction(
                    $entry,
                    $pse = $createEvent->getProductSaleElement(),
                    $createEvent->getProduct()
                );

                $createdIds[] = $pse->getId();
            }

            $con->commit();
        } catch (\Exception $e) {
            $con->rollBack();

            return new JsonResponse(["error" => $e->getMessage()], 500);
        }

        return new JsonResponse(
            $this->getProductSaleElements(
                array_merge(
                    $this->getRequest()->query->all(),
                    ["id" => implode(",", $createdIds)]
                )
            ),
            201
        );
    }
777912
function createAgent (appname, masterSpec, moduleSpec, cb) {
  fs.mkdir(path.join(path.resolve(appname), 'generated', 'agents', moduleSpec.name), function (response) {
    createTemplate(appname, path.join('generated', 'agents', 'agentModule.js'), {
      moduleName: moduleSpec.name,
      states: moduleSpec.states
    })

    var oldPath = path.join(appname, 'generated', 'agents', 'agentModule.js'),
      newPath = path.join(appname, 'generated', 'agents', moduleSpec.name, moduleSpec.name + '.js')
    fs.renameSync(oldPath, newPath)

    // CREATE THE AGENT MAIN CONTROLLER
    fs.mkdir(path.join(path.resolve(appname), 'generated', 'agents', moduleSpec.name, 'controllers'), function (response) {
      createTemplate(appname, path.join('generated', 'agents', 'agentMasterController.js'), {
        moduleName: moduleSpec.name,
        actions: moduleSpec.actions,
        states: moduleSpec.states
      })
      var oldControllerPath = path.join(appname, 'generated', 'agents', 'agentMasterController.js'),
        newControllerPath = path.join(appname, 'generated', 'agents', moduleSpec.name, 'controllers', moduleSpec.name + '.js')
      fs.renameSync(oldControllerPath, newControllerPath)

      // CREATE THE MODULE INIT STATE CONTROLLER AND PARTIAL
      fs.mkdir(path.join(path.resolve(appname), 'generated', 'partials', 'agents', moduleSpec.name), function (response) {
        createTemplate(appname, path.join('generated', 'index.html'), {})

        var oldHtmlPath = path.join(appname, 'generated', 'index.html'),
          newHtmlPath = path.join(appname, 'generated', 'partials', 'agents', moduleSpec.name, 'index.html')
        fs.renameSync(oldHtmlPath, newHtmlPath)

        if (moduleSpec.actions.elements) {
          for (childState in moduleSpec.actions.elements) {
            var state = {
              title: moduleSpec.actions.elements[childState].ui.title,
              components: moduleSpec.actions.elements.init.components,
              initConversation: true
            }
            createAgentChildState(appname, moduleSpec.name, moduleSpec.actions.elements[childState], '', moduleSpec.actions.url)
          }
        }
        // CREATE THE MODULE CHILD STATES
        if (moduleSpec.states) {
          for (var i = moduleSpec.states.length - 1; i >= 0; i--) {
            moduleSpec.states[i] = translateUiTitles(moduleSpec.states[i])
            createAgentState(appname, moduleSpec.name, moduleSpec.states[i], moduleSpec.actions.url)
          }
        }
        moduleSpec.actions.elements = translateUiTitles(moduleSpec.actions.elements)
        fs.mkdir(path.join(path.resolve(appname), 'generated', 'agents', moduleSpec.name, 'services'), function (response) {
          createTemplate(appname, path.join('generated', 'agents', 'agentServices.js'), {
            moduleName: moduleSpec.name,
            actions: moduleSpec.actions,
            states: moduleSpec.states,
            agentSpec: masterSpec.agents
          })
          var oldServicePath = path.join(appname, 'generated', 'agents', 'agentServices.js'),
            newServicePath = path.join(appname, 'generated', 'agents', moduleSpec.name, 'services', moduleSpec.name + 'Services.js')
          fs.renameSync(oldServicePath, newServicePath)
          cb()
        })
      })
    })
  })
}
722688
function createQueryAction (endpoint, responseAction, errorAction, rewritePayload, postprocess) {
  return async function (dispatch, getState) {
    const otpState = getState().otp
    const api = otpState.config.api
    const url = `${api.host}${api.port ? ':' + api.port : ''}${api.path}/${endpoint}`
    let payload
    try {
      const response = await fetch(url)
      if (response.status >= 400) {
        const error = new Error('Received error from server')
        error.response = response
        throw error
      }
      payload = await response.json()
    } catch (err) {
      return dispatch(errorAction(err))
    }

    if (typeof rewritePayload === 'function') {
      dispatch(responseAction(rewritePayload(payload)))
    } else {
      dispatch(responseAction(payload))
    }

    if (typeof postprocess === 'function') {
      postprocess(payload, dispatch, getState)
    }
  }
}
1062996
def create_ad_product_set(name:, filter:)
      query = { name: name, filter: filter.to_json }
      result = AdProductSet.post("/#{id}/product_sets", query: query)
      AdProductSet.find(result['id'])
    end
1178095
function CreateFilterManager(){

    // Create manager.
    var engine = new jquery_engine(golr_response);
    engine.method('GET');
    engine.use_jsonp(true);
    var filter_manager = new golr_manager(gserv, gconf, engine, 'async');
    
    // Manager settings.
    var personality = 'bioentity_for_browser';
    var confc = gconf.get_class(personality);
    filter_manager.set_personality(personality);
    filter_manager.add_query_filter('document_category',
				    confc.document_category(), ['*']);
    filter_manager.set_results_count(0); // don't need any actual rows returned
    
    // Add the filter widget and hook to manager.
    var hargs = {
	meta_label: 'Total gene products:&nbsp;',
	// free_text_placeholder:
	// 'Input text to filter against all remaining documents',
	'display_free_text_p': false
    };
    var filters = new widgets.live_filters('accordion',
					   filter_manager, gconf, hargs);
    filters.establish_display();
    
    // Add pre and post run spinner (borrow filter's for now).
    filter_manager.register('prerun', function(){
	filters.spin_up();
    });
    filter_manager.register('postrun', function(){
	filters.spin_down();
    });
    
    filter_manager.register('search', function(resp, manager){
	console.log('filter_manager search callback');
	GetInitialRootInformation(filter_manager);
    });
    
    filter_manager.search();
}
62141
function search(platform) {
  return new Promise((resolve, reject) => {
    if (!platform || platform === '') reject(new Error('platform cannot be blank'));
    const options = {
      method: 'GET',
      hostname: 'www.exploitalert.com',
      path: `/api/search-exploit?name=${platform}`,
    };

    const req = http.request(options, (res) => {
      const chunks = [];

      res.on('data', (chunk) => {
        chunks.push(chunk);
      });

      res.on('end', () => {
        const body = Buffer.concat(chunks);
        resolve(JSON.parse(body));
      });
    });

    req.on('error', err => reject(err));
    req.end();
  });
}
1359346
static function fetch( $productCollectionID, $asObject = true )
    {
        return eZPersistentObject::fetchObject( eZProductCollection::definition(),
                                                null,
                                                array( 'id' => $productCollectionID ),
                                                $asObject );
    }
370004
function fetch(publicAPI, model, name) {
  let fetchCallback = null;
  const requestQueue = [];

  publicAPI[`set${capitalize(name)}FetchCallback`] = (fetchMethod) => {
    if (requestQueue.length) {
      fetchMethod(requestQueue);
    }
    fetchCallback = fetchMethod;
  };

  return {
    addRequest(request) {
      requestQueue.push(request);
      if (fetchCallback) {
        fetchCallback(requestQueue);
      }
    },
    resetRequests(requestList) {
      while (requestQueue.length) {
        requestQueue.pop();
      }
      if (requestList) {
        // Rebuild request list
        requestList.forEach((req) => {
          requestQueue.push(req);
        });
        // Also trigger a request
        if (fetchCallback) {
          fetchCallback(requestQueue);
        }
      }
    },
  };
}
1053728
def get(self, nick, fields=[], props=None, page_no=None, page_size=None):
        ''''''
        request = TOPRequest('taobao.products.get')
        request['nick'] = nick
        if not fields:
            product = Product()
            fields = product.fields
        request['fields'] = fields
        if props!=None: request['props'] = props
        if page_no!=None: request['page_no'] = page_no
        if page_size!=None: request['page_size'] = page_size
        self.create(self.execute(request))
        return self.products
172999
public function generateSerializedProductsRequest(ProductsRequestInterface $request)
    {
        $newRequest = clone $request;

        switch ($this->getFacet()->getName()) {
            case 'ShopName':
            case 'ProgramId':
                // There is no valid filter Query for these facets, add debug log

                $request->getAffilinetClient()
                    ->getLog()
                    ->addDebug(
                        'You can not filter SearchProducts with '
                        . $this->getFacet()->getName()
                        . ' Seems like you used this facet and tried to generate a Link or a ProductsRequest for this facets\' results.'
                    );

                break;
            case 'ShopId':

                $newRequest->onlyFromShopIds([$this->getValue()]);
                break;

            case 'ShopCategoryId':
                $newRequest->onlyFromCategories([$this->getValue()], false, false);
                break;

            case 'AffilinetCategoryId':
                $newRequest->onlyFromCategories([$this->getValue()]);
                break;

            default :
                $newRequest->addFilterQuery($this->getFacet()->getName(), $this->getValue());

        }

        return $newRequest->serialize();
    }
289254
public function create()
	{
		$view = $this->getView();
		$data['product.lists.siteid'] = $this->getContext()->getLocale()->getSiteId();
		$data = array_replace_recursive( $this->toArray( $view->item ), $view->param( 'download', [] ) );

		$view->downloadData = $data;
		$view->downloadBody = '';

		foreach( $this->getSubClients() as $client ) {
			$view->downloadBody .= $client->create();
		}

		return $this->render( $view );
	}
881307
function() {

     	var modules = this.modules;
     	for(var i = 0 ; i < modules.length ; i++) {
		  	this.addModuleToList(modules[i]);
     	}

     	// Make the layer a drag drop target
     	if(!this.ddTarget) {
       	this.ddTarget = new YAHOO.util.DDTarget(this.layer.el, "module");
       	this.ddTarget._layer = this.layer;
     	}
 	}
1150160
function hotCreateRequire(moduleId) { // eslint-disable-line no-unused-vars
/******/ 		var me = installedModules[moduleId];
/******/ 		if(!me) return __webpack_require__;
/******/ 		var fn = function(request) {
/******/ 			if(me.hot.active) {
/******/ 				if(installedModules[request]) {
/******/ 					if(installedModules[request].parents.indexOf(moduleId) < 0)
/******/ 						installedModules[request].parents.push(moduleId);
/******/ 					if(me.children.indexOf(request) < 0)
/******/ 						me.children.push(request);
/******/ 				} else hotCurrentParents = [moduleId];
/******/ 			} else {
/******/ 				console.warn("[HMR] unexpected require(" + request + ") from disposed module " + moduleId);
/******/ 				hotCurrentParents = [];
/******/ 			}
/******/ 			return __webpack_require__(request);
/******/ 		};
/******/ 		for(var name in __webpack_require__) {
/******/ 			if(Object.prototype.hasOwnProperty.call(__webpack_require__, name)) {
/******/ 				fn[name] = __webpack_require__[name];
/******/ 			}
/******/ 		}
/******/ 		fn.e = function(chunkId, callback) {
/******/ 			if(hotStatus === "ready")
/******/ 				hotSetStatus("prepare");
/******/ 			hotChunksLoading++;
/******/ 			__webpack_require__.e(chunkId, function() {
/******/ 				try {
/******/ 					callback.call(null, fn);
/******/ 				} finally {
/******/ 					finishChunkLoading();
/******/ 				}
/******/ 				function finishChunkLoading() {
/******/ 					hotChunksLoading--;
/******/ 					if(hotStatus === "prepare") {
/******/ 						if(!hotWaitingFilesMap[chunkId]) {
/******/ 							hotEnsureUpdateChunk(chunkId);
/******/ 						}
/******/ 						if(hotChunksLoading === 0 && hotWaitingFiles === 0) {
/******/ 							hotUpdateDownloaded();
/******/ 						}
/******/ 					}
/******/ 				}
/******/ 			});
/******/ 		};
/******/ 		return fn;
/******/ 	}
375795
function createFactory() {
  return function Stamp(options) {
    var descriptor = Stamp.compose || {};
    // Next line was optimized for most JS VMs. Please, be careful here!
    var obj = {__proto__: descriptor.methods}; // jshint ignore:line

    merge(obj, descriptor.deepProperties);
    assign(obj, descriptor.properties);
    Object.defineProperties(obj, descriptor.propertyDescriptors || {});

    if (!descriptor.initializers || descriptor.initializers.length === 0) return obj;

    if (options === undefined) options = {};
    var inits = descriptor.initializers;
    var length = inits.length;
    for (var i = 0; i < length; i += 1) {
      var initializer = inits[i];
      if (isFunction(initializer)) {
        var returnedValue = initializer.call(obj, options,
          {instance: obj, stamp: Stamp, args: slice.apply(arguments)});
        obj = returnedValue === undefined ? obj : returnedValue;
      }
    }

    return obj;
  };
}
458735
function app(bidderRequest) {
  const pubId = bidderRequest && bidderRequest.length > 0 ? bidderRequest[0].params.cp : '0';
  const appParams = bidderRequest[0].params.app;
  if (appParams) {
    return {
      publisher: {
        id: pubId.toString(),
      },
      bundle: appParams.bundle,
      storeurl: appParams.storeUrl,
      domain: appParams.domain,
    }
  }
  return null;
}
1279463
function (products, categoryUrlId) {
        return products.map(function (product) {
            product.categoryUrlId = categoryUrlId;
            // the backend is sending us prices as strings.
            // we need to fix that up for sorting and other things to work
            product.price = parseFloat(product.price, 10);
            return sofa.Util.extend(new sofa.models.Product(), product);
        });
    }