Skip to content

Instantly share code, notes, and snippets.

React:

  1. What can you say about the high order component(HOC)? - https://reactjs.org/docs/higher-order-components.html
  2. What is the difference between React.PureComponent and React.Component? - https://stackoverflow.com/questions/41340697/react-component-vs-react-purecomponent/43936258
  3. Why we shouldn't use inline arrow functions in component props? Using arrow functions or binding in react component is a bad practice that hurts performance, because the function is recreated on each render. Whenever a function is created, the previous function is garbage collected. Rerendering many elements might create jank in animations. Using an inline arrow function will cause PureComponents, and components that use shallowCompare in the shouldComponentUpdate method to rerender anyway. Since the arrow function prop is recreated each time, the shallow compare will identify it as a change to a prop, and the component will rerender.
  4. What methods of lifecycle do you know? Call them in the correct order. -
{
"us-east-1": "A1,CO,A2,AG,AI,AN,AW,BB,BM,BS,BZ,CR,CU,DM,DO,GD,GP,GT,HN,HT,JM,KN,KY,LC,MQ,MS,NI,O1,PA,PM,PR,SV,TC,TT,US,VC,VG,VI",
"us-east-2": "CA",
"us-west-1": "MX,PF,PN",
"ap-northeast-1": "FM,GU,JP,MH,MP,PW,UM",
"ap-northeast-2": "KP,KR,TW",
"ap-southeast-1": "*",
"ap-south-1": "AF,BD,BH,BI,BT,CD,DJ,ER,ET,IN,IO,IQ,IR,KE,KG,KM,KW,LK,MG,MU,MV,MW,MZ,NP,OM,PK,QA,RE,RW,SA,SC,SO,TJ,TM,TZ,UG,UZ,YE,YT",
"ap-southeast-2": "AQ,AS,AU,CK,FJ,HM,KI,NC,NF,NR,NU,NZ,PG,SB,TK,TO,TV,VU,WF,WS",
"sa-east-1": "AR,BO,BR,BV,CL,EC,FK,GF,GS,GY,PE,PY,SH,SR,UY,VE",
@shcoderAlex
shcoderAlex / client-docker-composer.yml
Created September 8, 2016 10:01
Core-docker-system and client-docker
version: '2'
services:
php:
image: shcoder/alpine-php7-fpm-composer
volumes_from:
- app
environment:
- SERVICE_NAME=app_name
nginx:
Всем привет.
Я сижу на линуксе около трёх лет, начинал с убуту и около года сидел на ней. Она жутко гнала(вероятно из-за меня же), но работало. Много раз я соглашался с менеджером пакетов удалить libc из-за этого просто переставлял убунту. Бывали случаи когда правя Grub я его ломал и снова накатывал убунтушку. Потом мой взор пал на аскетичный CrunchBang. Он очень простой и стабильный в плане софта. Рабочий стол вообще чистый, честно говоря это первое, что меня в нём привлекло. С ним я уже около двух лет и он стоит на каждой моей машине.
От винды я отказался полностью, года два назад, полностью живу с этим и радуюсь. Иногда аптайм моих компов достигает 2-3 месяцев пока не выключат свет.
Ниже я расскажу о своём наборе утилиток:
✔ CrunchBang distribution based Debian 7 Wheezy
✔ SublimeText3
✔ Guake Terminal
✔ ZSH SHELL
@shcoderAlex
shcoderAlex / new_gist_file
Created November 12, 2013 07:21
Метки в javascript
loop: for(var i = 0; i<=10; i++){
continue loop;
}
@shcoderAlex
shcoderAlex / variable.js
Created November 12, 2013 03:30
Область видимости переменных.
var a = "global"
function who(){
console.log(a) //undefined
var a = 'local'
}
var name = 'Peter';
model.findOne({name: new RegExp('^'+name+'$', "i")}, function(err, doc) {
//Do your action here..
});
async.auto({
getTempIdProducts: getTempIdProducts //Получаем массив айдишников продуктов
, getProductsById: ['getTempIdProducts',getProductsById]
})
function getTempIdProducts(cb){
Home.findOne({user:req.user.id}).exec(function(err, home){
if(_.size(home.temp)){77777777777777
home.temp.forEach(function(temp){
arr.push(temp.id)
<snippet>
<content><![CDATA[console.log(${0:$TM_SELECTED_TEXT});]]></content>
<tabTrigger>cl</tabTrigger>
<scope>source.js</scope>
<description>console.log</description>
</snippet>