Skip to content

Instantly share code, notes, and snippets.

Avatar

Miguel Felipe Calo azamanaza

View GitHub Profile
@azamanaza
azamanaza / gist:bac1f3fefae384f0d41fcd2520262240
Created Nov 12, 2019
Script to check for valid boggle game guesses
View gist:bac1f3fefae384f0d41fcd2520262240
const checkWord = (board, word) => {
const boardMap = boardToMap(board);
const startPoints = Array.from(boardMap.values());
if (!startPoints) {
return false;
}
return checkNodes(boardMap, startPoints, [], [], word.split(''), 0);
};
View gist:6ea94b80a07046fa5fff06cfee400f19
const rangeSum = n => ((n * (n + 1)) / 2) - 1;
const getMaxRange = pxCt => {
let currRange = 2;
while(pxCt > rangeSum(currRange)) {
currRange++;
}
return currRange;
};
@azamanaza
azamanaza / m2-get-product-image
Created Sep 12, 2018
Magento2 - Rendering Product Image
View m2-get-product-image
...
@param \Magento\Catalog\Block\Product\ImageBuilder $imageBuilder
@param \Magento\Catalog\Model\Product $product
@param string $imageTypeId (product_base_image | product_page_image_medium)
$imageHtml = $imageBuilder->setProduct($product)
->setImageId($imageId)
->create()->toHtml();
You can’t perform that action at this time.