Publish subdirectory of a project to gh-pages
If your build is located at ./build, then do this:
1 |
git subtree push --prefix build origin gh-pages |
More details here — https://gist.github.com/cobyism/4730490
Testing react’s dom with jest and enzyme
Install it like this:
1 |
yarn add enzyme enzyme-adapter-react-16 --registry="https://registry.npmjs.org" |
Regression testing of react app with jest
Example is here — https://facebook.github.io/jest/docs/en/tutorial-react.html. The main idea is this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
// Link.react.test.js import React from 'react'; import Link from '../Link.react'; import renderer from 'react-test-renderer'; test('Link changes the class when hovered', () => { const component = renderer.create( <Link page="http://www.facebook.com">Facebook</Link>, ); let tree = component.toJSON(); expect(tree).toMatchSnapshot(); // manually trigger the callback tree.props.onMouseEnter(); // re-rendering tree = component.toJSON(); expect(tree).toMatchSnapshot(); // manually trigger the callback tree.props.onMouseLeave(); // re-rendering tree = component.toJSON(); expect(tree).toMatchSnapshot(); }); |
UTF-8 icons
https://tutorialzine.com/2014/12/you-dont-need-icons-here-are-100-unicode-symbols-that-you-can-use Icon-like Smiley ☺ ☺ ☺ Hot Springs ♨ ♨ ♨ 8-Ball ➑ ➑ ➑ White Star ☆ ☆ ☆ Black Star ★ ★ ★ White Heart ♡ ♡ ♡ Black Heart ❤ ❤ ❤ Airplane ✈ ✈ ✈ Black Scissors ✂ ✂ ✂ White Scissors ✄ ✄ ✄ Crown ♕ ♕ ♕ Cross ✝ …
How to handle js errors in your react app
https://hackernoon.com/a-user-encounters-a-javascript-error-youll-never-guess-what-happens-next-dc1a6f725490 In russian — https://habrahabr.ru/company/ruvds/blog/344682/
Yet another article about js-interview
https://medium.freecodecamp.org/the-definitive-javascript-handbook-for-a-developer-interview-44ffc6aeb54e In russian — https://habrahabr.ru/post/345882/
docker-compose for starting aerospike and memcache
Place this config wherever you like (in your project) — for instance, ~/myproj/docker/docker-compose.yml:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
version: "2" services: #aerspike as: image: aerospike/aerospike-server volumes: - ./aerospike/etc:/opt/aerospike/etc ports: - 3000:3000 command: [asd, --config-file, /opt/aerospike/etc/docker.conf] memcached: image: memcached ports: - 11211:11211 volumes: #volume for etcd dicovery-data: driver: local #volume for database db-data: driver: local |
And this config for aerospike should be placed in a directory ~/myproj/docker/aerospike/etc/docker.conf After that you should run it like that:
1 2 |
cd ~/myproj/docker docker-compose up -d |
When you finished, just run:
1 2 |
cd ~/myproj/docker docker-compose down |
https://docs.docker.com/compose/reference/up/
Container insights for golang engineer (k8s docker CPU throttling)
We’ve run into problems on my work when k8s limits cpu to few processors (throttling), while go application can see all of them (setting GO_MAX_PROCS to maximum CPUs available) and go’s scheduler is going crazy because of that during highload (like stress-tests). It is caused by scheduling for, let’s say, 40 processors while you have …
Proxies and traffic sniffers for mac os
That’s a great one but it’s not cheap — https://www.charlesproxy.com/. They say this one is good as well and free — https://mitmproxy.org/. But I don’t like the interface.
React component lifecycle methods
Flow of lifecycle methods I checked it with react 16.2.0. On a client When component is rendered for the first time
1 2 3 4 |
constructor componentWillMount render componentDidMount |