Skip to content

Instantly share code, notes, and snippets.

View vitalets's full-sized avatar

Vitaliy Potapov vitalets

View GitHub Profile
@vitalets
vitalets / combobox.js
Last active December 17, 2015 23:29
X-editable combobox: typeahead + dropdown
/**
Typeahead input (bootstrap only). Based on Twitter Bootstrap [typeahead](http://twitter.github.com/bootstrap/javascript.html#typeahead).
Depending on `source` format typeahead operates in two modes:
* **strings**:
When `source` defined as array of strings, e.g. `['text1', 'text2', 'text3' ...]`.
User can submit one of these strings or any text entered in input (even if it is not matching source).
* **objects**:
When `source` defined as array of objects, e.g. `[{value: 1, text: "text1"}, {value: 2, text: "text2"}, ...]`.
var webdriver = require('selenium-webdriver'),
By = webdriver.By,
until = webdriver.until,
test = require('selenium-webdriver/testing');
test.describe('Google Search (selenium compatible)', function () {
var driver;
test.before(function () {
var capabilities = {
@vitalets
vitalets / msf-unbundle.js
Created February 20, 2017 16:49
msf unbundle
/**
* Unbundle samsung msf library:
* node msf-unbundle
*/
const fs = require('fs');
const path = require('path');
const mkdirp = require('mkdirp');
const { SourceMapConsumer } = require('source-map');
const filename = './dist/msf-2.3.2.min.js.map';
// before:
if (x === y) { ... }
// after:
if (strictEqual(x, y)) { ... }
function strictEqual(a, b) {
if (typeof a !== typeof b) {
console.warn('Strict compare of different types: ' + (typeof a) + ' === ' + (typeof b));
}
src/isomorphic/classic/types/ReactPropTypes.js:132
Strict equal of different types: true (boolean) === "red" (string)
Strict equal of different types: true (boolean) === "blue" (string)
Strict equal of different types: [] (Array) === "red" (string)
Strict equal of different types: [] (Array) === "blue" (string)
Strict equal of different types: false (boolean) === 0 (number)
Strict equal of different types: false (boolean) === "false" (string)
Strict equal of different types: NaN === "red" (string)
Strict equal of different types: NaN === "blue" (string)
PASS src/isomorphic/classic/__tests__/ReactContextValidator-test.js
src/renderers/shared/shared/shouldUpdateReactComponent.js:26
Strict equal of different types: {"key":null,"ref":nu... (object) === false (boolean)
Strict equal of different types: [object Object] (object) === false (boolean)
src/renderers/shared/shared/shouldUpdateReactComponent.js:27
Strict equal of different types: {"key":null,"ref":nu... (object) === false (boolean)
Strict equal of different types: [object Object] (object) === false (boolean)
src/renderers/shared/stack/reconciler/ReactCompositeComponent.js:1258
@vitalets
vitalets / index.html
Last active December 8, 2017 13:54
Mocha ES6 modules
<html>
<head>
<meta charset="utf-8">
<title>Mocha Tests</title>
<link href="https://cdn.rawgit.com/mochajs/mocha/2.2.5/mocha.css" rel="stylesheet" />
</head>
<body>
<div id="mocha"></div>
<script src="https://cdn.rawgit.com/jquery/jquery/2.1.4/dist/jquery.min.js"></script>
@vitalets
vitalets / index.html
Last active December 8, 2017 13:43
Mocha ES6 modules: html after cleanup
<html>
<head>
<meta charset="utf-8">
<title>Mocha Tests</title>
<link href="https://unpkg.com/mocha@4.0.1/mocha.css" rel="stylesheet" />
</head>
<body>
<div id="mocha"></div>
<script src="https://unpkg.com/chai@4.1.2/chai.js"></script>
@vitalets
vitalets / sum.js
Last active December 8, 2017 13:48
ES5 sum js
function sum(a, b) {
return a + b;
}
export default function sum(a, b) {
return a + b;
}