HTML5 provides us with lots of semantic elements aimed to describe precisely the content. Make sure you benefit from its rich vocabulary.
<!-- bad -->
# this file blocks ip requests - only request with Host are supported | |
server { | |
listen 80 default_server; | |
listen 443 default_server ssl; | |
server_name _; | |
return 444; | |
} |
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript"></script> | |
</head> | |
<body> | |
<div id="container" style="width:100%;"> | |
<div class="fb-like-box" data-href="https://www.facebook.com/adobegocreate" data-width="292" data-show-faces="true" data-stream="true" data-header="true"></div> | |
</div> |
<?php | |
var_dump ( | |
array_combine(['r','g','b'], sscanf('FF0000', "%02x%02x%02x")) | |
); |
//How to validate selectize.js comboboxes with the jQuery validation plugin | |
//selectize.js: http://brianreavis.github.io/selectize.js/ (brianreavis/selectize.js) | |
//http://jqueryvalidation.org (jzaefferer/jquery-validation) | |
//configure jquery validation | |
$("#commentForm").validate({ | |
//the default ignore selector is ':hidden', the following selectors restore the default behaviour when using selectize.js | |
//:hidden:not([class~=selectized]) | selects all hidden elements, but not the original selects/inputs hidden by selectize | |
//:hidden > .selectized | to restore the behaviour of the default selector, the original selects/inputs are only validated if their parent is visible | |
//.selectize-control .selectize-input input | this rule is not really necessary, but ensures that the temporary inputs created by selectize on the fly are never validated |
<?php | |
Event::listen('illuminate.query', function($query, $binding, $time, $connections) | |
{ | |
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); | |
foreach ($backtrace as $trace) { | |
if(array_key_exists('file',$trace) && array_key_exists('line',$trace)){ | |
if( strpos($trace['file'],base_path().'/app') !== false ){ | |
PhpConsole\Handler::getInstance()->debug([ |
var percentColors = [ | |
{ pct: 0.0, color: { r: 0xff, g: 0x00, b: 0 } }, | |
{ pct: 0.5, color: { r: 0xff, g: 0xff, b: 0 } }, | |
{ pct: 1.0, color: { r: 0x00, g: 0xff, b: 0 } } ]; | |
var getColorForPercentage = function(pct) { | |
for (var i = 0; i < percentColors.length; i++) { | |
if (pct <= percentColors[i].pct) { | |
var lower = percentColors[i - 1] || { pct: 0.1, color: { r: 0x0, g: 0x00, b: 0 } }; | |
var upper = percentColors[i]; |
Record Auto semicolon macro and bind shortcut to it: | |
1. Edit -> Macros -> Start Macro Recording | |
2. In the editor go to the end of line by pressing End | |
3. put semicolon ';' | |
4. Edit -> Macros -> Stop Macro Recording | |
5. Give a name, for example 'Auto semicolon' | |
6. Open settings (Ctrl + Alt + s), select Keymap | |
7. Expand Macros node | |
8. Select 'Auto semicolon', in the context menu choose Add Keyboard Shortcut | |
9. Set Ctrl + ; as First keystroke |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<meta name="viewport" content="width=device-width"/> | |
<!-- | |
Remove automatic format detection | |
I personally love that a lot of clients, especially on mobile, automatically convert dates, phone numbers, and emails to links; however, there’s always that random use case where you might not want to have that happen. Here’s how you can stop it: |
// This function creates a new anchor element and uses location | |
// properties (inherent) to get the desired URL data. Some String | |
// operations are used (to normalize results across browsers). | |
function parseURL(url) { | |
var a = document.createElement('a'); | |
a.href = url; | |
return { | |
source: url, | |
protocol: a.protocol.replace(':',''), |