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
/** source https://github.com/GoogleChromeLabs/puppeteer-examples/blob/master/side-by-side-pageload.js | |
* Thanks Google | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
**/ | |
const puppeteer = require('puppeteer'); | |
const DEFAULT_VIEWPORT = {width: 1000, height: 800, deviceScaleFactor: 2}; |
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 fauxcapi() { | |
var HTTPClient = require('dw/net/HTTPClient'); | |
var path = decodeURIComponent(request.httpParameterMap.path.stringValue); | |
var httpClient : HTTPClient = new HTTPClient(); | |
httpClient.open('GET', 'https://' + request.httpHost + '/' + path); | |
httpClient.setTimeout(5000); | |
httpClient.send(); | |
response.setContentType('application/json'); | |
var expiryTime = new Date(Date.now()); |
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 fs = require('fs'); | |
var xmlParser = require('xml2js').parseString; | |
const startPath = process.argv[2]; | |
const translate = require('@k3rn31p4nic/google-translate-api'); | |
var categories = []; | |
function handleCategory(index, callback) { | |
if (index > categories.length) { | |
return; | |
} |
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
/** | |
* parses the query string for custom expand parameter | |
* @returns {Object} a parameter object containing paging information based on request params or defauls | |
*/ | |
function parseQueryString() { | |
var params = null; | |
var queryString = request.httpQueryString; | |
if (queryString.indexOf('c_expand=true') > -1) { | |
params = {}; |
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 { appendFile } = require("fs"); | |
const fetch = require("node-fetch"); | |
const fs = require('fs'); | |
const params = JSON.parse(fs.readFileSync('./config.json')); | |
/* Example | |
{ | |
"accountManager": { | |
"scope": "SALESFORCE_COMMERCE_API:xxxx_xxx sfcc.yy", | |
"clientId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", |
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 { appendFile } = require("fs"); | |
const fetch = require("node-fetch"); | |
const fs = require('fs'); | |
const params = JSON.parse(fs.readFileSync('./config.json')); | |
/* Example | |
{ | |
"accountManager": { | |
"scope": "SALESFORCE_COMMERCE_API:xxxx_xxx sfcc.yy", | |
"clientId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<shipping xmlns="http://www.demandware.com/xml/impex/shipping/2007-03-31"> | |
<shipping-method method-id="standardDHL_DE" default="false"> | |
<display-name xml:lang="x-default">DHL Standard</display-name> | |
<online-flag>true</online-flag> | |
<price-table> | |
<amount order-value="0">0.99</amount> | |
</price-table> | |
<excluded-addresses> | |
<included-addresses> |
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
var customerPromotions = dw.campaign.PromotionMgr.getActiveCustomerPromotions(); | |
/** | |
* Converts a product into a extended object | |
*/ | |
function createExtendedProduct(productId) { | |
var staticCache = dw.system.CacheMgr.getCache('ProductExtendStatic'); | |
var product = dw.catalog.ProductMgr.getProduct(productId); | |
if (!product) { | |
return; |
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
// ==UserScript== | |
// @name Set Parcel Shop Id | |
// @version 1 | |
// @grant none | |
// ==/UserScript== | |
if (window.location.href.includes('https://production-realm-customer.demandware.net/on/demandware.store/Sites-Site/')) { | |
function waitForElement(selector) { | |
return new Promise(function (resolve, reject) { |
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
/** | |
* Input: Line separated SKUs (e.g grepped from catalog export), inventory export | |
* Output: inventory import of all 0 item items | |
* | |
* Original use case: customer shows Back-in-Stock only if item has zero item inventory, however production cleaned 0 to null removing bis | |
*/ | |
const fs = require('fs'); | |
var readlines = require('n-readlines') |
OlderNewer