Elastic videos

HTML5 video

video {
	max-width: 100%;
	height: auto;

iframe, object, embed


.video-container {
	position: relative;
	padding-bottom: 56.25%;
	padding-top: 30px;
	height: 0;
	overflow: hidden;
.video-container iframe,
.video-container object,
.video-container embed {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;



Spiderfy markers on same position with Leaflet.markercluster

Considering a map set as:

map = new L.Map( map_id, {
	minZoom: 10,
	maxZoom: 18,

Set cluster group, disabling clustering after maxZoom, so spiderfy will be still on:

clusterGroup = L.markerClusterGroup({
	disableClusteringAtZoom: map.options.maxZoom + 1,

Set listener:

clusterGroup.on( 'clusterclick', function ( a ) {
	if ( map.options.maxZoom == a.layer._zoom ) {

So, if you are at maximum zoom and markers are still clustered, it spiderfies on click.


StackOverflow, Limit Zoom level when markers are on the same position

Add title tag automatically in WordPress

Basic implementation

On functions.php:

add_theme_support( 'title-tag' );

<head> must not have any <title> tag declared.

Backwards compatibility

In case WordPress version is less than 4.1:

if ( ! function_exists( '_wp_render_title_tag' ) ) {
	function theme_slug_render_title() {
<title><?php wp_title( '|', true, 'right' ); ?></title>
	add_action( 'wp_head', 'theme_slug_render_title' );

Custom queries

Custom queries depends on type of query, so title may be rendered in a wrong way.

add_filter( 'document_title_parts', 'change_title_part', 10 );

function change_title_part( $title ) {
	if ( get_query_var( 'favorites' ) ) {
		$title['title'] = 'Favorites';
	return $title;


Git deploy

Creating Git repository


Connect SSH

ssh username@mydomain.com

Create .git directory outside public_html and create bare repo

mkdir project.git
cd project.git
git --bare init

Create post-receive hook

cd hooks
nano post-receive
chmod +x post-receive

post-receive contents

git --work-tree=/home/username/public_html --git-dir=/home/username/project.git checkout -f


Create repository

cd project
git init

Add remote to local repository

git remote add staging ssh://username@mydomain.com:/home/username/project.git

Just commit and push

git commit -am "first edit"
git push staging master

Default push to staging

git push --set-upstream staging master

Reset remote

To reset remote and push files again to remote

git --work-tree=/home/username/public_html --git-dir=/home/username/project.git reset --hard


Useful resources