This file contains 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 express = require(`express`); | |
const router = express.Router(); | |
router.get(`/oembed`, (req, res) => { | |
const {url, maxwidth, maxheight, format} = req.query; | |
const width = maxwidth || 1000; | |
const height = maxheight || 600; | |
const embedUrl = url; // you can transform url that user provided to url that should be displayed in iframe | |
const responseData = { |
This file contains 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
a | b | |
---|---|---|
1 | 2 | |
2 |
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
This file contains 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
a | |
0.00001 | |
123.123123 | |
0.10001 | |
0.00011 | |
0.1111111 | |
323.0001 | |
4 | |
5422 |
This file contains 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 readline = require(`readline`); | |
const fs = require(`fs`); | |
const rl = readline.createInterface({ | |
input: fs.createReadStream(`./to_parse_v4.x.x.js`), | |
}); | |
const getArgs = /((\(\([^\)]*\)[^\)]*\))|[\w?]|(: )|(\<[^\>]*\>)|(\([^\)]*\))|( => )|( \| )|(\{[^\}]*\})|(\[[^\]]*\])|[\<\>]|( \& ))+/g; | |
const split = (line) => { |
This file contains 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
myData.map(fixName); | |
function fixName(person) { | |
return Object.assign({}, person, { | |
name: person.name.replace(/John/g, "Ben") | |
}); | |
} | |
// inline function | |
myData.map(function fixName(person) { |
This file contains 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
// All children from new line | |
// bad | |
h('.my-class', null, h('span', null, 'Foo')); | |
// good | |
h('.my-class', null, | |
h('span', null, | |
'Foo' | |
) | |
); |
This file contains 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
return <div> | |
<header className="header"> | |
<h1>todos</h1> | |
<input | |
className="new-todo" | |
placeholder="What needs to be done?" | |
value={this.state.newTodo} | |
onKeyDown={this.handleNewTodoKeyDown(todo)} | |
onChange={this.handleChange(e)} | |
autoFocus=true |
This file contains 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
// A | |
<li className={classNames({ | |
completed: this.props.todo.completed, | |
editing: this.props.editing | |
})}> | |
// B | |
<input | |
className="toggle" | |
type="checkbox" |
This file contains 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
return h('li', { | |
className: classNames({ | |
completed: this.props.todo.completed, | |
editing: this.props.editing | |
}) | |
}, | |
h('div.view', null, | |
h('input.toggle', { | |
type: 'checkbox', | |
checked: this.props.todo.completed, |
This file contains 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
return ( | |
<li className={classNames({ | |
completed: this.props.todo.completed, | |
editing: this.props.editing | |
})}> | |
<div className="view"> | |
<input | |
className="toggle" | |
type="checkbox" | |
checked={this.props.todo.completed} |
NewerOlder