Skip to content

Instantly share code, notes, and snippets.

View webostv.js
export function promisifyRequest(fn) {
return params => {
return new promise(r => {
rthrh
})
};
}
export const createWebosAsPromised = webos => {
const webosPromised = Object.create(webos);
View App.js
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
*/
import React from 'react';
import {
View fp.js
// filter array by value
1. f(2, [1, 2, 3, 2]) // -> [2, 2]
2. f([1, 2, 3, 2], 2) // -> [2, 2]
@vitalets
vitalets / webpack.config.js
Last active Dec 8, 2017
Mocha ES6 modules: webpack config final
View webpack.config.js
module.exports = {
entry: ['./setup.js', './run.js'],
output: {
filename: 'bundle.js',
},
resolve: {
alias: {
// map remote chai.js url to locally installed in node_modules
'https://unpkg.com/chai@4.1.2/chai.js': 'chai/chai.js'
}
@vitalets
vitalets / sum.js
Last active Dec 8, 2017
Incorrect sum
View sum.js
export default function sum(a, b) {
return a * b; // a bug
}
@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>
View sum.test.js
describe('sum', function () {
it('should return sum of arguments', function () {
chai.expect(sum(1, 2)).to.equal(3);
});
});
@vitalets
vitalets / sum.js
Last active Dec 8, 2017
ES5 sum js
View sum.js
function sum(a, b) {
return a + b;
}
@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 / webpack.config.js
Created Dec 6, 2017
Mocha ES6 modules: webpack config v2
View webpack.config.js
module.exports = {
entry: ['./setup.js', './run.js'],
output: {
filename: 'bundle.js',
},
resolve: {
alias: {
'https://unpkg.com/chai@4.1.2/chai.js': 'chai/chai.js'
}
}
You can’t perform that action at this time.