server {
listen 80;
server_name example.com;
access_log /var/log/nginx/example.com;
location / {
proxy_pass http://127.0.0.1:3000;
}
location /second-project-path {
proxy_pass http://127.0.0.1:3001;
}
}
server {
listen 80;
server_name first-project.com;
access_log /var/log/nginx/first-project.com;
location / {
proxy_pass http://127.0.0.1:3000;
}
}
server {
listen 80;
server_name second-project.com;
access_log /var/log/nginx/second-project.com;
location / {
proxy_pass http://127.0.0.1:3001;
}
}
}
const c = a.map((i, el) => ({ selector: `#${el.id}`}));
var a = $("span[id ^= call]"),
c = [];
for (var i = 0; i < a.length; i++) {
let b = {
selector:"#" + a.eq(i).attr("id"),
};
c.push(b);
}
mkdir workplace
cd workplace
git clone [path to project]
cd [project directory name]
npm install
server {
listen 80;
server_name example.com;
access_log /var/log/nginx/example.com;
location / {
proxy_pass "http://127.0.0.1:3000";
}
}
npm start
class App extends Component {
state = {
activeItemId: -1,
};
selectItem = id => {
this.setState({
activeItemId: id,
});
};
render() {
const { items } = this.props;
const { activeItemId } = this.state;
const activeItem = items.find(item => item.id === selectedItemId);
return (
<Wrapper>
<More item={activeItem} />
<Items
items={items}
onSelectItemCalback={this.selectItem}
/>
</Wrapper>
);
}
}
const links = [
{
label: 'Home',
path: '/',
},
{
label: 'About',
path: '/about',
},
{
label: 'Shop',
path: '/shop',
},
{
label: 'Home',
path: '/',
},
{
label: 'Contact',
path: '/contact',
},
];
return (
<Wrapper>
{links.map((link, i) => (
<Link key={i} to={link.path}>
{link.label}
</Link>
))}
</Wrapper>
);
this.state.href[0] // первый элемент массива
it('test openModal', () => {
expect(actions.openModal({ name: 'Some name'}, '1')).toEqual({
type: types.OPEN_MODAL,
payload: {
id: '1',
initData: {
name: 'Some name',
},
},
});
});
{
type: types.OPEN_MODAL, // тут естественно значение
payload: {
id: undefined,
initData: {
id: '1',
initData: {
name: 'Some name',
},
},
},
}
import { applyContainerQuery } from 'react-container-query';
import { Hello, Boy, Wrapper } from '../somePlace';
const myQuery = {
hasMinWidth: {
minWidth: 1024,
},
};
class MyComponent extends Component {
...
render() {
const {
containerQuery: { hasMinWidth },
} = this.props;
return (
<Wrapper>
{hasMinWidth ? <Hello /> : <Boy />}
</Wrapper>
);
}
}
export default applyContainerQuery(MyComponent, myQuery);
export default function(state = initialState, action) {
if (action.type === 'DIALOG_SELECTED') {
return state;
}
if (action.type === 'DIALOG_DELETE') {
const newState = [...state];
newState.shift();
return newState;
}
else {
return state;
}
}
const mapStateToProps = state => ({
dialogs: state.dialogs,
});
const mapDispatchToProps = {
selectDialog: actions.selectDialog,
deleteDialog: actions.deleteDialog,
};
export default connect(mapStateToProps, mapDispatchToProps)(Sidebar);
class Sidebar extends Component {
selectDialog = () => {
this.props.selectDialog();
};
deleteDialog = () => {
this.props.deleteDialog();
};
render() {
console.log('рендер сайдбара');
return (
<div className='sidebar'>
<div className='sidebar__content'>
<div className='sidebar__head'></div>
<SidebarChatGroup chatName='Общий'>
<button onClick={this.selectDialog}>Выбрать</button>
<button onClick={this.deleteDialog}>удалить</button>
</SidebarChatGroup>
</div>
<div className='sidebar__bg'></div>
</div>
)
}
}
const circle_1 = [7, 2, 3, 5, 16, 50, 25, 40],
circle_2 = [2, 5, 10, 30, 25, 3, 10, 25],
circle_3 = [25, 10, 2, 10, 5, 2, 10, 5],
circle_4 = [7, 2, 3, 20, 3, 7, 2, 5],
circle_5 = [2, 20, 1, 7, 25, 1, 25],
circle_6 = [3];
function findSum(value, arrays, i = 0) {
for (let j = 0; j < arrays[i].length; j++) {
const el = arrays[i][j];
if (i < arrays.length - 1) {
const result = findSum(value - el, arrays, i + 1);
if (result !== null) {
return [el, ...result];
}
} else if (el === value) {
return [el];
}
}
return null;
}
console.log('result', findSum(136, [
circle_1,
circle_2,
circle_3,
circle_4,
circle_5,
circle_6
]));
// => result [50, 30, 25, 3, 25, 3]
this.setState({
columnId,
}, this.fetchData);
componentDidUpdate(_, prevState) {
if (prevState.columnId !== this.state.columnId) {
this.fetchData();
}
}
color: #607D8B;
color: rgba(0, 0, 0, 0.5);
color: transparent;