Skip to content

Instantly share code, notes, and snippets.

// Configuration for your app
const path = require('path')
const envObj = require('./.env')
const env = Object.keys(envObj).reduce((last, current) => {
last[current] = JSON.stringify(envObj[current])
return last
}, {})
module.exports = function (ctx) {
@codenamezjames
codenamezjames / flatten.js
Created January 1, 2019 16:15
Javascript flatten similar to ruby's flatten
function flatten(arr, depth = Infinity, result = []) {
if(!Array.isArray(arr)) return null
for (const value of arr) {
if (depth > 0 && Array.isArray(value)) {
if (depth > 1) {
flatten(value, depth - 1, result)
} else {
result.push(...value)
}
} else {
console.log('TEST FROM gist.github.com')
@codenamezjames
codenamezjames / catalog_product_view.xml
Created January 30, 2018 20:36 — forked from timneutkens/catalog_product_view.xml
Remove reviews from product page Magento 2
<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="product.info.review" remove="true" />
<referenceBlock name="reviews.tab" remove="true" />
</body>
</page>
@codenamezjames
codenamezjames / less-errors
Created August 22, 2017 04:54
errors on magento 2
ompilation from source: /Users/jamesharrington/dev/victory/victory-tailgate/app/design/frontend/victory/vtmain/web/css/collection.less
Compilation from source:
frontend/victory/vtmain/en_US/css/collection.less
variable @border is undefined in file /Users/jamesharrington/dev/victory/victory-tailgate/var/view_preprocessed/css/frontend/victory/vtmain/en_US/css/collection.less in collection.less on line 58, column 25
56| }
57| .left-nav-section{
58| border-top: 1px solid @border;
59| .show-truncated{
60| background-color: #e8e8e8;
const arr = [1,2,3,4,5,6,7,8]
const arrCopy = arr.reduce(function(lastVal, currentVal){
lastVal.push(currentVal)
return lastVal // whate ever we return gets used as the next "lastVal" paramater
}, [])//this empty array argument gets used as "lastVal" on the loops first iteration
arr.push(9)// altering the first array
console.log(arr)
#!/usr/bin/env bash
rm -rf var/cache/* var/page_cache/* var/generation/*
php bin/magento setup:upgrade
php bin/magento maintenance:disable
. ~/flush-magento.sh
A lot of rm: cant remove bla.......
rm: cannot remove ‘var/generation/Symfony/Component/Console/Input/ArrayInputFactory.php’: Read-only file system
rm: cannot remove ‘var/generation/Victory/VictoryModule/Controller/Manage/Contact/Interceptor.php’: Read-only file system
Cache cleared successfully
File system cleanup:
/app/var/generation/Composer
The file "/app/var/generation/Composer/Console/ApplicationFactory.php" cannot be deleted Warning!unlink(/app/var/generation/Composer/Console/ApplicationFactory.php): Read-only file system
/app/var/generation/Magento
The file "/app/var/generation/Magento/AdminGws/Model/ResourceModel/CollectionsFactory.php" cannot be deleted Warning!unlink(/app/var/generation/Magento/AdminGws/Model/ResourceModel/CollectionsFactory.php): Read-only file system
/app/var/generation/Symfony
#!/usr/bin/env bash
rm -rf var/di/* var/generation/* var/cache/* var/log/* var/page_cache/* var/session/* var/view_preprocessed/* pub/static/*
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy --jobs=1
php bin/magento cache:clean
php bin/magento cache:flush
php bin/magento indexer:reindex
#!/bin/bash
echo Install Mac App Store apps first. ( xcode )
read -p "Press any key to continue… " -n1 -s
echo '\n'
# Check that Homebrew is installed and install if not
if test ! $(which brew)
then
echo " Installing Homebrew"