Skip to content

Instantly share code, notes, and snippets.

@vitalets
vitalets / combobox.js
Last active Dec 17, 2015
X-editable combobox: typeahead + dropdown
View combobox.js
/**
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"}, ...]`.
View webdriver.js
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 = {
View msf-unbundle.js
/**
* 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';
View Runtyper-example.js
// 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));
}
View react-runtyper-result.txt
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)
View react-runtyper-group-by-tests.txt
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 Dec 8, 2017
Mocha ES6 modules
View index.html
<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 Dec 8, 2017
Mocha ES6 modules: html after cleanup
View index.html
<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 Dec 8, 2017
ES5 sum js
View sum.js
function sum(a, b) {
return a + b;
}
View sum.js
export default function sum(a, b) {
return a + b;
}
You can’t perform that action at this time.