Gets presigned posts

@param {string} siteId
@param {Object} checksums
@return {Object}
329784
async function _getPresignedPosts(siteId, checksums) {
  const endpoint = url.resolve(apiURL, `/sites/${siteId}/presigned_posts`);
  const body = { checksums };
  const response = await got.post(endpoint, { body, json: true, headers: _bearer() });

  return response.body.presignedPosts;
}
579822
function blockChecksums(fs, path, size, callback) {
  var cache = {};

  fs.readFile(path, function (err, data) {
    if (!err) {
      // cache file
      cache[path] = data;
    } else if (err && err.code === 'ENOENT') {
      cache[path] = [];
    } else {
      return callback(err);
    }

    var length = cache[path].length;
    var incr = size;
    var start = 0;
    var end = incr > length ? length : incr;
    var blockIndex = 0;
    var result = [];
    var chunk;
    var weak;
    var strong;

    while (start < length) {
      chunk  = cache[path].slice(start, end);
      weak   = calcWeak32(chunk).sum;
      strong = md5sum(chunk);

      result.push({
        index: blockIndex,
        weak: weak,
        strong: strong
      });
      // update slice indices
      start += incr;
      end = (end + incr) > length ? length : end + incr;
      // update block index
      blockIndex++;
    }

    callback(null, result);
  });
}
1270381
function(serverResponse, bidderRequest) {
    const bidResponses = [];
    serverResponse = serverResponse.body;

    if (serverResponse.responses) {
      serverResponse.responses.forEach(function (bid) {
        const bidResponse = {
          cpm: bid.cpm,
          width: bid.width,
          height: bid.height,
          currency: bid.currency,
          netRevenue: true,
          ttl: bid.ttl,
          ad: bid.ad,
          requestId: bid.bidId,
          creativeId: bid.creativeId
        };
        bidResponses.push(bidResponse);
      });
    }
    return bidResponses;
  }
889564
function _createSync(siteId) {
  const ttxSettings = config.getConfig('ttxSettings');
  const syncUrl = (ttxSettings && ttxSettings.syncUrl) || SYNC_ENDPOINT;

  return {
    type: 'iframe',
    url: `${syncUrl}&id=${siteId}`
  }
}
213046
public static SiteIdentifier single (final int siteId, final String siteString) {
        return new SiteIdentifier() {
            public int identifySite (HttpServletRequest req) {
                return siteId;
            }
            public String getSiteString (int siteId) {
                return siteString;
            }
            public int getSiteId (String siteString) {
                return siteId;
            }
            public Iterator<Site> enumerateSites () {
                return Collections.singletonList(new Site(siteId, siteString)).iterator();
            }
        };
    }
442427
function findBlogs (pRequest, pResponse) {

    var query       = pRequest.params.query,
        posts       = cache.get('posts') || {};

    var blogsToSend = [];

    for (var key in posts) {
        var post = new Post(posts[key]);
        if (post.containsQuery(query))
        {
            blogsToSend.push(posts[key]);
        }
    }
    return pResponse.status(201).send(blogsToSend).end();
}
517072
protected function getSite($sites, $site_id)
    {
        $site_found = collect($sites)->filter(function ($site) use ($site_id) {
            return $site->id === $site_id;
        })->first();

        if ($site_found) {
            return $site_found;
        }
        return null;
    }
1295497
function getAddress(addressInput) {
  var address = addressInput; // eslint-disable-line
  var result = null; // eslint-disable-line

  if (typeof(address) !== 'string') { throw new Error(`[ethjs-account] invalid address value ${JSON.stringify(address)} not a valid hex string`); }

  // Missing the 0x prefix
  if (address.substring(0, 2) !== '0x' &&
      address.substring(0, 2) !== 'XE') { address = `0x${address}`; }

  if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) {
    result = getChecksumAddress(address);

    // It is a checksummed address with a bad checksum
    if (address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && result !== address) {
      throw new Error('[ethjs-account] invalid address checksum');
    }

  // Maybe ICAP? (we only support direct mode)
  } else if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {
    throw new Error('[ethjs-account] ICAP and IBAN addresses, not supported yet..');

    /*
    // It is an ICAP address with a bad checksum
    if (address.substring(2, 4) !== ibanChecksum(address)) {
      throw new Error('invalid address icap checksum');
    }

    result = (new BN(address.substring(4), 36)).toString(16);
    while (result.length < 40) { result = '0' + result; }
    result = getChecksumAddress('0x' + result);
    */
  } else {
    throw new Error(`[ethjs-account] invalid address value ${JSON.stringify(address)} not a valid hex string`);
  }

  return result;
}
166008
function(bid) {
    const siteId = bid.params.siteId || '';
    if (!siteId) {
      utils.logError(LOG_MSG.noSite);
    }
    return !!(bid.adUnitCode && siteId);
  }
1195149
function getChecksum(fs, path, callback) {
  getAttr(fs, path, constants.attributes.checksum, callback);
}
1168184
function buildRequestData(searchTerm, maxResults) {
  var requestData = {
    numHits: maxResults,
    fuzzy: {
      maxEdits: 2,
      minLength: 5,
      prefixLength: 2
    }
  };

  if (searchTerm instanceof Array) {
    requestData["addresses"] = searchTerm.map(processAddress);
  } else {
    requestData["addr"] = processAddress(searchTerm);
  }
  return requestData;
}
501619
def site_payload
      @cached_payload = begin
        payload = old_site_payload

        site_hooks.each do |hook|
          p = hook.merge_payload(payload, self)
          next unless p && p.is_a?(Hash)
          payload = Jekyll::Utils.deep_merge_hashes(payload, p)
        end
        payload
      end
    end
164946
public function findUsageReferenceInOtherSite($siteId, $entities)
    {
        $usedOtherSite = array();
        $supportedEntities = array(BlockInterface::ENTITY_TYPE, ContentInterface::ENTITY_TYPE);
        /** @var UseTrackableInterface $entity */
        foreach ($entities as $entity) {
            $references = $entity->getUseReferences();
            $entityReferences = array(
                'entity' => $entity,
                'references' => array()
            );
            if (!empty($references)) {
                foreach ($references as $type => $reference) {
                    if (in_array($type, $supportedEntities)) {
                        $referenceIds = array_keys($reference);
                        $repo = $this->getRepositoryByType($type);
                        foreach ($referenceIds as $referenceId) {
                            $referenceEntity = $repo->findById($referenceId);
                            if (
                                $siteId !== $referenceEntity->getSiteId()
                            ) {
                                $entityReferences['references'][$type][$referenceEntity->getId()] = $referenceEntity;
                            }
                        }
                    }
                }
                $usedOtherSite[] = $entityReferences;
            }
        }

        return $usedOtherSite;
    }
723216
function get_posts( $post_ids )
	{
		// validate
		if( empty($post_ids) )
		{
			return $post_ids;
		}
		
		
		// vars
		$r = array();
		
		
		// find posts (DISTINCT POSTS)
		$posts = get_posts(array(
			'numberposts'	=>	-1,
			'post__in'		=>	$post_ids,
			'post_type'		=>	apply_filters('acf/get_post_types', array()),
			'post_status'	=>	'any',
		));

		
		$ordered_posts = array();
		foreach( $posts as $p )
		{
			// create array to hold value data
			$ordered_posts[ $p->ID ] = $p;
		}
		
		
		// override value array with attachments
		foreach( $post_ids as $k => $v)
		{
			// check that post exists (my have been trashed)
			if( isset($ordered_posts[ $v ]) )
			{
				$r[] = $ordered_posts[ $v ];
			}
		}
		
		
		// return
		return $r;
	}
1256305
private void validatePreSignedUrls() {
        if (pre_signed_put_url != null && pre_signed_delete_url != null) {
            PreSignedUrlParser parsedPut = new PreSignedUrlParser(pre_signed_put_url);
            PreSignedUrlParser parsedDelete = new PreSignedUrlParser(pre_signed_delete_url);
            if (!parsedPut.getBucket().equals(parsedDelete.getBucket()) ||
                    !parsedPut.getPrefix().equals(parsedDelete.getPrefix())) {
                throw HostControllerLogger.ROOT_LOGGER.preSignedUrlsMustHaveSamePath();
            }
        } else if (pre_signed_put_url != null || pre_signed_delete_url != null) {
            throw HostControllerLogger.ROOT_LOGGER.preSignedUrlsMustBeSetOrUnset();
        }
    }
1270869
function getSite(prefix, locals) {
  const site = locals && locals.site;

  return site || siteService.getSiteFromPrefix(prefix);
}
177588
protected function getNodeIdsInSite($siteId, DocumentManager $dm)
    {
        $qb = $dm->createQueryBuilder(Node::class)->hydrate(false);
        $qb->field('deleted')->equals(false)
            ->field('siteId')->equals($siteId)
            ->distinct('nodeId');

        return $qb->getQuery()->execute()->toArray();
    }