#301 Redirects for .htaccess | |
#Redirect a single page: | |
Redirect 301 /pagename.php http://www.domain.com/pagename.html | |
#Redirect an entire site: | |
Redirect 301 / http://www.domain.com/ | |
#Redirect an entire site to a sub folder | |
Redirect 301 / http://www.domain.com/subfolder/ |
<?php | |
// Here is a sample of the URLs this regex matches: (there can be more content after the given URL that will be ignored) | |
// http://youtu.be/dQw4w9WgXcQ | |
// http://www.youtube.com/embed/dQw4w9WgXcQ | |
// http://www.youtube.com/watch?v=dQw4w9WgXcQ | |
// http://www.youtube.com/?v=dQw4w9WgXcQ | |
// http://www.youtube.com/v/dQw4w9WgXcQ | |
// http://www.youtube.com/e/dQw4w9WgXcQ | |
// http://www.youtube.com/user/username#p/u/11/dQw4w9WgXcQ |
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
Оргенизация слоя хранения данных это всегда не простая задача, с кучей кейсов, вроде блокировки перезаписи, транзакции, сохранение целостности данных. В какой-то момент появились СУБД и обещали решить эти проблемы, но с ними появились новые - как нам работать с состоянием, которое мы храним?
Существует 4 основных подхода для организации рабоыт с базой данных, Table Gateway, Row Data Gateway, Active Record и Data Mapper. Все эти подходы объеденяет то, что они скрывают от нас базу данных и нюансы работы с ними (в частности SQL). На сегодняшний день самым популярным подходом являются Active Record и Data Mapper, все о них слышали, но для того что бы более полно представлять, как развивалась идея, стоит рассказать и о первых двух.
Table Data Gateway, который так же можно встретить под названием DAO (Data Access Object), предоставляет нам объектное представление отдель
const range1 = len => Object.keys(new Int8Array(len)).map(parseFloat); | |
const range2 = len => Array.apply(null, {length: len}).map(Number.call, Number); | |
const range3 = (start, end) => Array.apply(null, Array(end - start)).map((_, i) => start + i); | |
const range4 = (start, end) => [...Array(end - start)].map((_, i) => start + i); | |
const range5 = len => Object.keys(Array.apply(null, Array(len))); |
<?php | |
interface Logger | |
{ | |
public function log(string $message, int $level = 0): void; | |
} |