Это устаревшее тестовое задание, есть повеселее и посовременнее: Реакт, Тайпскрипт, Файрбейз в gotovo.ru.
I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.
I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.
Chrome 51 has some pretty wild behaviour related to console.log
in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.
// Array literal (= []) is faster than Array constructor (new Array()) | |
// http://jsperf.com/new-array-vs-literal/15 | |
var array = []; | |
// Object literal (={}) is faster than Object constructor (new Object()) | |
// http://jsperf.com/new-array-vs-literal/26 | |
var obj = {}; | |
// property === undefined is faster than hasOwnProperty(property) | |
// http://jsperf.com/hasownproperty-vs-in-vs-undefined/17 |
// got to vk.im/ page | |
// copy paste this js to console and run | |
// profit | |
var lastMsgId = parseInt(geByClass('dialogs_row ')[0].className.match(/dialogs_msg(.*)/)[1]); | |
var lastMsgId = lastMsgId + 10; | |
for (var i = lastMsgId; i > lastMsgId - 100; i--) { | |
var id = i; | |
console.log('try restore message: ' + id); | |
ajax.post('al_mail.php', {act: 'a_restore', id: i, from: 'im', hash: cur.mark_hash, gid: cur.gid}); |
Английская версия: https://evilmartians.com/chronicles/bootstrap-an-intervention
У CSS есть несколько базовых проблем, которые позволяют очень быстро отстрелить себе ногу при неправильном использовании:
-
Глобальный неймспейс – в серверном программировании все что написано в файле, в файле и остается. Все же что написано в css и js засирает глобальное пространство имен со всеми вытекающими. В JS эту проблему сейчас побороли всякими модульными системами, а вот с css сложнее. В идеальном мире это должен починить Shadow DOM и настоящие Web Components, но пока их нет единственный способ с этим бороться – следовать какой-то системе именований селекторов, которая по возможности уменьшает и исключает возможные конфликты.
-
Каскадность – если на один элемент может сработать несколько правил, то они все и сработают последовательно. Если есть элемент
h1.title
, на него сработают все правила для теговh1
и все правила для класса.title
. Так как весь html состоит из тегов, то правил которые п
##Погодное одностраничное веб-приложение
(!) Данные можно взять с сайта openweathermap.org или с любого другого сервиса.
(!) Обязательно использовать react.js и redux.
Приложение должно уметь:
- Добавлять/удалять города
- Сохранять локально данные
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft
,elem.offsetTop
,elem.offsetWidth
,elem.offsetHeight
,elem.offsetParent
The MIT License (MIT) | |
Copyright (c) 2015 Justin Perry | |
Permission is hereby granted, free of charge, to any person obtaining a copy of | |
this software and associated documentation files (the "Software"), to deal in | |
the Software without restriction, including without limitation the rights to | |
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | |
the Software, and to permit persons to whom the Software is furnished to do so, | |
subject to the following conditions: |