Skip to content

Instantly share code, notes, and snippets.

View vitalets's full-sized avatar

Vitaliy Potapov vitalets

View GitHub Profile
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)
// 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));
}
@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';
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 / 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"}, ...]`.