Skip to content

Instantly share code, notes, and snippets.

View iofjuupasli's full-sized avatar

Valery iofjuupasli

  • fugo.ai
  • Warsaw, Poland
  • 20:37 (UTC +02:00)
View GitHub Profile
@iofjuupasli
iofjuupasli / worse-better.md
Created August 23, 2015 13:51
Чем хуже, тем лучше

Чем хуже, тем лучше: JS

Почему я полюбил динамическую типизацию?

Я очень часто встречал мнение, что для очень больших проектов безусловно нужны языки со статической типизацией. Что 1 млн строк кода можно написать только на Java.

Однако я заметил, что на JS я должен писать свой код настолько простым, чтобы всегда было его очень легко понимать и использовать. И писать его как можно более модульно и лаконично.

@iofjuupasli
iofjuupasli / react-jsx-es6.md
Created August 25, 2015 22:59
React, JSX and ES6: The Parts

React, JSX and ES6: The Parts

Comment for this post

I've spent last year with React. And all the time I feel like I'm cheating. Facebook created something new by breaking some established principles. It gave us nice basis for further research and development. I see that there are many new libraries that inspired by React, and they are very promising.

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}
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,
// A
<li className={classNames({
completed: this.props.todo.completed,
editing: this.props.editing
})}>
// B
<input
className="toggle"
type="checkbox"
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
// All children from new line
// bad
h('.my-class', null, h('span', null, 'Foo'));
// good
h('.my-class', null,
h('span', null,
'Foo'
)
);
myData.map(fixName);
function fixName(person) {
return Object.assign({}, person, {
name: person.name.replace(/John/g, "Ben")
});
}
// inline function
myData.map(function fixName(person) {
@iofjuupasli
iofjuupasli / convert.js
Last active September 22, 2017 15:23
Lodash fp autocurry
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) => {
@iofjuupasli
iofjuupasli / rr.csv
Last active June 17, 2019 15:19
rr.csv
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
a
0.00001
123.123123
0.10001
0.00011
0.1111111
323.0001
4
5422