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 WooCommerceAPI = require('woocommerce-api'); | |
var WooCommerce = new WooCommerceAPI({ | |
url: 'https://xxxx.lt', | |
consumerKey: 'xxxxx', | |
consumerSecret: 'xxxxx', | |
wpAPI: true, | |
version: 'wc/v1' | |
}); | |
function helper({timeout, id, value, data}) { |
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 (global) { | |
let SCORE_NO_MATCH = 0.0; | |
let SCORE_MATCH = 1.0; | |
let SCORE_TRAILING = 0.8; | |
let SCORE_TRAILING_BUT_STARTED = 0.9; | |
let SCORE_BUFFER = 0.85; | |
let WORD_SEPARATORS = ' \t_-'; | |
let LiquidMetal = { | |
lastScore: null, |
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
/* | |
Sample usage: | |
runCron({promise: screenshotsCache, intervalNumber: 5, intervalString: 'minutes'}); | |
This will call "screenshotsCache" Promise every 5 minutes. | |
If promise resolves after 6 minutes, it will be called again immediately because 5 mins already passed. | |
*/ |
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
const validEncodings = [ | |
'US-ASCII', 'iso-ir-6', 'ANSI_X3.4-1968', 'ANSI_X3.4-1986', 'ISO_646.irv:1991', 'ISO646-US', 'us', 'IBM367', 'cp367', | |
'csASCII', 'ISO-8859-1', 'ISO_8859-1:1987', 'iso-ir-100', 'ISO_8859-1', 'latin1', 'l1', 'IBM819', 'CP819', | |
'csISOLatin1', 'ISO-8859-2', 'ISO_8859-2:1987', 'iso-ir-101', 'ISO_8859-2', 'latin2', 'l2', 'csISOLatin2', | |
'ISO-8859-3', 'ISO_8859-3:1988', 'iso-ir-109', 'ISO_8859-3', 'latin3', 'l3', 'csISOLatin3', 'ISO-8859-4', | |
'ISO_8859-4:1988', 'iso-ir-110', 'ISO_8859-4', 'latin4', 'l4', 'csISOLatin4', 'ISO-8859-5', 'ISO_8859-5:1988', | |
'iso-ir-144', 'ISO_8859-5', 'cyrillic', 'csISOLatinCyrillic', 'ISO-8859-6', 'ISO_8859-6:1987', 'iso-ir-127', | |
'ISO_8859-6', 'ECMA-114', 'ASMO-708', 'arabic', 'csISOLatinArabic', 'ISO-8859-7', 'ISO_8859-7:1987', 'iso-ir-126', | |
'ISO_8859-7', 'ELOT_928', 'ECMA-118', 'greek', 'greek8', 'csISOLatinGreek', 'ISO-8859-8', 'ISO_8859-8:1988', |
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
const _ = require('lodash'); | |
function orderObjectFields(input) { | |
if (!input) { | |
return input; | |
} | |
if (_.isString(input)) { | |
return input; | |
} else if (_.isArray(input)) { |
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
before npm i: | |
install openssl: `brew install openssl` | |
export CPPFLAGS=-I/usr/local/opt/openssl/include | |
export LDFLAGS=-L/usr/local/opt/openssl/lib |
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 default function openInTab({url}) { | |
let instance = window.open('about:blank'); | |
if (url.indexOf('http') !== 0) { | |
url = `http://${url}`; | |
} | |
let meta = `<meta http-equiv="refresh" content="0;url=${url}">`; | |
instance.document.write(meta); | |
instance.document.close(); | |
return false; | |
} |
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
# See list of docker virtual machines on the local box | |
$ docker-machine ls | |
NAME ACTIVE URL STATE URL SWARM DOCKER ERRORS | |
default * virtualbox Running tcp://192.168.99.100:2376 v1.9.1 | |
# Note the host URL 192.168.99.100 - it will be used later! | |
# Build an image from current folder under given image name | |
$ docker build -t gleb/demo-app . |
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
List() | |
var list = Immutable.List([1,2,3]) | |
// [1, 2, 3] | |
List.isList() | |
Immutable.List.isList(list) | |
// true | |
List.of() | |
var list = Immutable.List.of(1,2,3); |
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
sha1sum /dev/zero | sha1sum /dev/zero |