Skip to content

Instantly share code, notes, and snippets.

@m0zziter
m0zziter / 0_reuse_code.js
Last active August 29, 2015 14:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@m0zziter
m0zziter / gist:b7c2f00afd3684e0642060d19617ab2f
Last active August 10, 2016 15:26
algolia magento 2 - commonjs.phtml minified html
<?php /** @var \Algolia\AlgoliaSearch\Block\Algolia $block */ $config = $block->getConfigHelper(); $catalogSearchHelper = $block->getCatalogSearchHelper(); $product_helper = $block->getProductHelper(); $algolia_helper = $block->getAlgoliaHelper(); $base_url = rtrim($block->getBaseUrl(), '/'); $isSearchPage = false; $isCategoryPage = false; $currency_code = $block->getCurrencyCode(); $group_id = $block->getGroupId(); $price_key = $block->getPriceKey(); $allDepartments = "All departments"; $query = ''; $refinement_key = ''; $refinement_value = ''; $path = ''; /** * Handle category replacement */ if ($config->isInstantEnabled() && $config->replaceCategories() && $block->getRequest()->getControllerName() == 'category') { $category = $block->getCurrentCategory(); if ($category && $category->getDisplayMode() !== 'PAGE') { $category->getUrlInstance()->setStore($block->getStoreId()); foreach ($category->getPathIds() as $treeCategoryId) { if ($path != '') { $path .= ' } $path .= $product_helper->getCategoryName($treeC
@m0zziter
m0zziter / redis-delallbykey
Created December 20, 2016 19:21 — forked from mattweyant/redis-delallbykey
Delete all keys from Redis matching a regular expression
# All credit: http://stackoverflow.com/questions/4006324/how-to-atomically-delete-keys-matching-a-pattern-with-redis
redis-cli [options] KEYS "prefix:*" | xargs redis-cli [options] DEL