Blogs

Regex for unbalanced anchor tag

Here is a regex expression for finding an unbalanced anchor tag in a chunk of text

<?php
if (preg_match_all('/<a\b[^>]*>(.*?)(?!<\/a>)/', $markup)) {
  // We found one or more, do something
}  

Customizing KeyCue for Sublime Text 3

How to create an XML import file to expose hidden key bindings

Detecting HTML5 Video Fullscreen On and Off Events

Here's some code that demonstrates how to respond to the fullscreen event of an HTML5 video player. The question I was searching for was how to know if we're going to fullscreen (FullscreenOn) or leaving fullscreen (FullscreenOff). These snippets should explain how to do this. For explanation of this refer to Google. This is just my synopsis.

First here is the HTML code:

a tag with mp4 file does not download in Chrome when clicked

The solution is to add the download attribute to the tag like this

Before (doesn't work)

<a href="http://www.intheloftstudios.com/some-video.mp4">click to download</a>

After (the fix)

<a href="http://www.intheloftstudios.com/some-video.mp4" download>click to download</a>

Valid XHTML 1.0 Transitional