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 byAge = guys => guys.sort( (Jonny, Tonny) => Jonny.age - Tonny.age ); |
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
/** | |
* AddMarkupByCanvas v1.0.0 | |
* | |
* The plugin print to jsPDF library that uses html2canvas to print DOM node to pdf. | |
*/ | |
// import html2canvas from 'html2canvas'; // from v0.5.0 | |
declare const html2canvas: any; | |
const fitPageSize = (pdfObj, options) => { |
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 makeFlat = (array) => { | |
return array.reduce((all, current) => { | |
return Array.isArray(current) | |
? all.concat(makeFlat(current)) | |
: all.push(current) && all; | |
},[]); | |
}; | |
expect(makeFlat([[1,2,[3]],4])).toEqual([1,2,3,4]); |
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
/** | |
* dCoords returns array of coors of dot C, where angle ABC is 90°. | |
* | |
* @param {Array} A - array of coords dot A [x,y] | |
* @param {Array} B - array of coords dot B [x,y] | |
* @param {Number} BC - distance between B and C | |
* @returns {Array} | |
*/ | |
export const dCoords = (A = [], B = [], BC = 0) => { | |
const bShifted = [- A[0] + B[0], - A[1] + B[1]]; |
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
# mysql -uroot -p | |
# CREATE DATABASE `magento_local` CHARACTER SET utf8 COLLATE utf8_general_ci; | |
# GRANT ALL PRIVILEGES ON magento_local.* TO magento@localhost IDENTIFIED BY 'magentoPass'; | |
# GRANT SELECT, INSERT, UPDATE, DELETE, \ | |
# CREATE, DROP, REFERENCES, INDEX, ALTER, \ | |
# CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, \ | |
# CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, \ | |
# EVENT, TRIGGER \ | |
# ON `magento_local`.* \ |
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 isPolindrome = str => { | |
let is = true; | |
const mediana = Math.floor(str.length / 2); | |
const rIndex = x => str.length - x - 1; | |
const iterate = (a,b) => Array.prototype.some.call(a,b); | |
const polindromCheck = (letter, index, string) => { | |
return (index > mediana) | |
|| (letter !== string[rIndex(index)]) | |
&& !(is = false) | |
}; |
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 curry = (fn, ...initialArgs) => { | |
let value; | |
const fnx = (...curryArgs) => { | |
value = fn.apply(null, initialArgs.concat(curryArgs)); | |
return fnx; | |
} | |
Object.defineProperty(fnx, 'valueOf', {value: () => value}); | |
return fnx; |
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 | |
echo $this->helper('Magento\Catalog\Helper\Output')->productAttribute($product, $product->getConfigGroupCpLabel(), 'config_group_cp_label'); | |
echo $product->getData(ProductAttributesInterface::CONFIG_GROUP_CP_LABEL); | |
echo '<br>z: '; | |
echo $this->helper('Magento\Catalog\Helper\Output')->productAttribute($product, $product->getConfigGroupCpOrder(), 'config_group_cp_order'); | |
echo $product->getData(ProductAttributesInterface::CONFIG_GROUP_CP_ORDER); | |
echo '<br>y: '; | |
echo $this->getProduct()->getAttributeText('config_group_cp_order'); | |
echo $product->getAttributeText('config_group_cp_order'); | |
echo '<br>x: '; |
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
# Scrape images with wget | |
# https://davidwalsh.name/scrape-images-wget | |
# $1 = url | |
# Example: scrapeimages https://davidwalsh.name/ | |
scrapeimages() { | |
wget -nd -H -p -A jpg,jpeg,png,gif -e robots=off $1 | |
} |
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
<div data-role="instafeed" class="instafeed-container"></div> | |
<script type="text/x-magento-init"> | |
{ | |
"[data-role=instafeed]": { | |
"instafeed-loader": { | |
"userId": "{{userId}}", // https://stackoverflow.com/q/11796349 | |
"accessToken": "{{accessToken}}" // https://www.instagram.com/developer/authentication/ | |
} | |
} | |
} |
OlderNewer