Skip to content

Instantly share code, notes, and snippets.

View ckomop0x's full-sized avatar
:octocat:
Life developer

Pavel Klochkov ckomop0x

:octocat:
Life developer
View GitHub Profile
@ckomop0x
ckomop0x / features&keys.md
Created December 9, 2016 09:02 — forked from ArtDanshin/features&keys.md
Как перестать бояться и начать использовать WebStorm - Клавиши и фичи

Ссылка на вебинар: JetBrains: https://youtu.be/Ozt8pBq9Mys

##Навигация:

  • cmd + e - Список последний табов/окон, в которых производились действия. Если начать вбивать название, то будут находиться совпадения
  • cmd + вверх - Бар с навигацией по пути файла в проекте
    • При хождении по навигации можно нажимать комбинации, например cmd + n для создания файла

##Отображение

@ckomop0x
ckomop0x / utils.js
Last active June 13, 2019 14:20
Old file with utils
// Old, old function that lives here from the scratch
function multiply (a, b) {
return a * b;
}
function sum (a, b) {
return a + b;
}
function calculateSomethingSpecial(data) {
return data.map(
dataItem => sum(dataItem.param1, dataItem.param2)
@ckomop0x
ckomop0x / multiply.js
Last active January 24, 2020 09:32
multiply.js refactored to a file
export default function multiply (a, b) {
return a * b;
}
// or
const multiply (a, b) => a * b;
export default multiply;
// Whatever you prefer – this article is not about syntax.
@ckomop0x
ckomop0x / sum.js
Created June 13, 2019 14:22
sum.js refactored to a file
export default function sum (a, b) {
return a + b;
}
@ckomop0x
ckomop0x / calculateSomethingSpecial.js
Created June 13, 2019 14:23
calculateSomethingSpecial.js refactored to a file
import sum from "./sum";
export default function calculateSomethingSpecial(data) {
return data.map(
dataItem => sum(dataItem.param1, dataItem.param2));
}
@ckomop0x
ckomop0x / App.js
Last active June 13, 2019 14:26
import refactored functions
import multiply from '../utils/multiply';
import sum from '../utils/sum';
import calculateSomethingSpecial from '../utils/calculateSomethingSpecial';
@ckomop0x
ckomop0x / index.js
Created June 13, 2019 14:28
index.js inside utils folder
export { default as sum } from './sum';
export { default as multiply } from './multiply';
export { default as calculateSomethingSpecial } from './calculateSomethingSpecial';
@ckomop0x
ckomop0x / App.js
Created June 13, 2019 14:29
Now, we can rewrite out the weirdness:
import { multiply, sum, calculateSomethingSpecial } from '../utils';
@ckomop0x
ckomop0x / App.js
Created June 13, 2019 14:30
Rewritten App.js
import React from "react";
import ReactDOM from "react-dom";
import { sum } from "./utils";
import "./styles.css";
function App() {
return (
<div className="App">
<h1>Re-export example</h1>
<p>{sum(5, 10)}</p>
</div>
@ckomop0x
ckomop0x / main.js
Created June 13, 2019 14:32
Compiled for production main.js chunk
(window.webpackJsonp = window.webpackJsonp || []).push([[0], {
10: function(e, n, t) {
"use strict";
t.r(n);
// So here is our function compiled inside a component
var r = t(0)
, a = t.n(r)
, c = t(2)
, o = t.n(c);
function l(e, n) {