This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Easing Functions - inspired from http://gizma.com/easing/ | |
* only considering the t value for the range [0, 1] => [0, 1] | |
*/ | |
EasingFunctions = { | |
// no easing, no acceleration | |
linear: function (t) { return t }, | |
// accelerating from zero velocity | |
easeInQuad: function (t) { return t*t }, | |
// decelerating to zero velocity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Create a Mask for an email address using ES6 syntax | |
Could be used for confirmation of email address or preventing to public expose of address | |
Author: Andrew Guk https://gist.github.com/gukandrew | |
*/ | |
function emailMask(email, mask = '*') { | |
let masked = ''; | |
let prev; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for file in *string-to-replace*; do | |
newname=$(echo $file | sed "s/string-to-replace//"); | |
mv $file $newname; | |
done; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function filterWhere(inputObject, conditions = {}) { | |
return Object.values(inputObject).filter((r) => { | |
return !(Object.keys(conditions).every((v) => { | |
return String(r[v]) === String(conditions[v]) | |
})) | |
}) | |
} | |
const data = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# when pass id, mean click action on some link, scroll and replace hash in url | |
# when no id, gets element id to scroll from url hash | |
export const scrollToElementAfterBrowserRender = (id) => { | |
if (!window.requestAnimationFrame) { | |
return; | |
} | |
window.requestAnimationFrame(() => { | |
const url = new URL(document.location.href); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const parseSearchToObject = (urlSearch) => { | |
const fromPairs = (pairs) => pairs.reduce((cache, pair) => { | |
cache[pair[0]] = pair[1]; | |
return cache; | |
}, {}); | |
return fromPairs(urlSearch.replace('?', '').split('&').map((v) => v.split('='))); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create a bookmark and use this code as the URL, you can now toggle the css on/off | |
// thanks+credit: https://dev.to/gajus/my-favorite-css-hack-32g3 | |
javascript: (function() { | |
var styleEl = document.getElementById('css-layout-hack'); | |
if (styleEl) { | |
styleEl.remove(); | |
return; | |
} | |
styleEl = document.createElement('style'); | |
styleEl.id = 'css-layout-hack'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Magento\Framework\App\Bootstrap; | |
include 'app/bootstrap.php'; | |
// config | |
$pageSize = 100; | |
// config end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Magento\Framework\App\Bootstrap; | |
include 'app/bootstrap.php'; | |
// config | |
$pageSize = 100; | |
// config end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$quoteId = 1; | |
$ObjectManager = \Magento\Framework\App\ObjectManager::getInstance(); | |
$quoteCollectionFactory = $ObjectManager->create('\Magento\Quote\Model\ResourceModel\Quote\CollectionFactory'); | |
$QuoteRepository = $ObjectManager->create('\Magento\Quote\Model\ResourceModel\Quote\CollectionFactory'); | |
$quote = $quoteCollectionFactory->create() | |
->addFieldToFilter('quote_id', $quoteId) | |
->getFirstItem(); |
OlderNewer