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
// ответить | |
// текущему клиенту | |
socket.emit(EVENT_NAME, data); | |
// клиентам этой сессии | |
const sockets = io.sockets.sockets; | |
const clients = Object.keys(sockets); | |
clients.forEach(client => { | |
if (sockets[client].handshake.sid !== socket.handshake.sid) return; | |
sockets[client].emit(EVENT_NAME, data); | |
}); |
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 classof = object => Object.prototype.toString.call(object).slice(8, -1); |
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
// Отметить идентификаторы, доступные через замыкания | |
// Ответ: weapon, name | |
function Samurai(name) { | |
var weapon = 'katana'; | |
this.getWeapon = function() { | |
return weapon; | |
}; | |
this.getName = function() { | |
return name; |
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
"prettier.singleQuote": true, | |
"prettier.trailingComma": "all", | |
"prettier.printWidth": 120, |
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
lsof -i tcp:8890 // порт | |
kill -9 16658 // id процесса |
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
UPDATE wp_options SET option_value = replace(option_value, 'http://www.example.com', 'http://localhost/test-site') WHERE option_name = 'home' OR option_name = 'siteurl'; | |
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.example.com', 'http://localhost/test-site'); | |
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.example.com','http://localhost/test-site'); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/redux/3.0.4/redux.js" /></script> | |
<script src="https://fb.me/react-0.14.0.js" /></script> | |
<script src="https://fb.me/react-dom-0.14.0.js" /></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-redux/4.0.0/react-redux.js" /></script> |
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
git branch -m old_branch new_branch – переименовать локальную ветку | |
git push origin :old_branch – удалить старую ветку | |
git push --set-upstream origin new_branch – выгрузить новую ветку и "закрепить" ее за локальной веткой |
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
/* Child.js */ | |
import React from 'react' | |
class Child extends React.Component { | |
componentDidMount() { | |
this.props.onRef(this) | |
} | |
componentWillUnmount() { | |
this.props.onRef(undefined) | |
} |
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
// дата '1.02.1927' | |
/(3[0-1]|2\d|1\d|0\d|\d).(1[0-2]|0\d|\d).(\d{4})/ |