This file contains hidden or 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
// This function matches all non-ASCII characters after splitting the string in a "unicode-safe" way (using `[...str]`). | |
// It then splits each unicode character up into its code-points, and gets the escape code for each, and then joins all | |
// all the ASCII characters and Unicode escapes into one string. | |
function escapeUnicode(str) { | |
return [...str].map(c => /^[\x00-\x7F]$/.test(c) ? c : c.split("").map(a => "\\u" + a.charCodeAt().toString(16).padStart(4, "0")).join("")).join(""); | |
} | |
// Based on discussion in this thread: https://gist.github.com/mathiasbynens/1243213 |
This file contains hidden or 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
/* | |
* Magento 2 mixins for js files that return an UIComponent | |
* (based on https://alanstorm.com/the-curious-case-of-magento-2-mixins/) | |
* (for files that return an object literal: https://gist.github.com/alecarg/71a28b6d0ce2c3b7073481cc52fe1e23) | |
* (for files that return a function: ) | |
*/ | |
define([ | |
], function () { | |
'use strict'; |
This file contains hidden or 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
/* | |
* Magento 2 mixins for js files that return an object literal | |
* (based on https://alanstorm.com/the-curious-case-of-magento-2-mixins/) | |
* (for files that return an UIComponent: https://gist.github.com/alecarg/ed0516132e9c8a31c66f13fbccd292cf) | |
* (for files that return a function: ) | |
*/ | |
define([ | |
'mage/utils/wrapper' | |
], function (wrapper) { |
This file contains hidden or 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
export const nextAll = element => { | |
const nextElements = [] | |
let nextElement = element | |
while(nextElement.nextElementSibling) { | |
nextElements.push(nextElement.nextElementSibling) | |
nextElement = nextElement.nextElementSibling | |
} | |
return nextElements |
This file contains hidden or 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 | |
/** | |
* Copyright © Magento, Inc. All rights reserved. | |
* See COPYING.txt for license details. | |
* | |
* File: | |
* Magento_Theme/templates/html/copyright.phtml | |
*/ | |
?> | |
<small class="copyright"> |
This file contains hidden or 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
#!/usr/bin/env bash | |
#styles | |
VP_NONE='\033[00m' | |
VP_RED='\033[01;31m' | |
VP_GREEN='\033[01;32m' | |
VP_YELLOW='\033[01;33m' | |
VP_PURPLE='\033[01;35m' | |
VP_CYAN='\033[01;36m' | |
VP_WHITE='\033[01;37m' |
This file contains hidden or 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
// from : http://qnimate.com/javascript-limit-function-call-rate/ | |
function debounce(func, wait, immediate) { | |
var timeout; | |
return function() { | |
var context = this, | |
args = arguments; | |
var later = function() { | |
timeout = null; | |
if (!immediate) func.apply(context, args); |
This file contains hidden or 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() { | |
var beforePrint = function() { | |
console.log('Functionality to run before printing.'); | |
}; | |
var afterPrint = function() { | |
console.log('Functionality to run after printing'); | |
}; | |
if (window.matchMedia) { | |
var mediaQueryList = window.matchMedia('print'); |
This file contains hidden or 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
#!/usr/bin/env sh | |
# checks to see if running | |
launchctl list | grep elasticsearch | |
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist | |
launchctl remove homebrew.mxcl.elasticsearch | |
pkill -f elasticsearch |
This file contains hidden or 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
var fn = function(arg1, arg2) { | |
var str = '<p>aap ' + this.noot + ' ' + arg1 + ' ' + arg2 + '</p>'; | |
document.body.innerHTML += str; | |
}; | |
var context = { | |
'noot': 'noot' | |
}; | |
var args = ['mies', 'wim']; | |
// Calls a function with a given 'this' value and arguments provided individually. |
NewerOlder