This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* A list of italian prepositions. | |
* Useful for excluding stopwords from slugs and/or search queries. | |
*/ | |
return [ | |
'il', 'lo', 'la', 'i', 'gli', 'le', | |
'di', 'del', 'dello', 'della', 'dei', 'degli', 'delle', | |
'a', 'al', 'allo', 'alla', 'ai', 'agli', 'alle', | |
'da', 'dal', 'dallo', 'dalla', 'dai', 'dagli', 'dalle', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title></title> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Pretty Print. | |
* | |
* @param [mixed] $val The value to print | |
*/ | |
function pp( $value ) { | |
switch ( $type = gettype( $value ) ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@media print { | |
* { | |
background: transparent !important; | |
color: #000 !important; | |
box-shadow: none !important; | |
text-shadow: none !important; | |
} | |
p, h1, h2, h3, h4, h5, h6 { | |
orphans: 3; | |
widows: 3; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Javascript closure. | |
*/ | |
( function( window, document, undefined ) { | |
'use strict'; | |
// do something | |
} )( window, window.document ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
// The URL we want to parse | |
var url = 'http://example.com/path/to/example-folder/?key=value#hashexample'; | |
// The magic: create a new anchor element, and set the URL as its href attribute. | |
// This triggers the same properties of the "location" object on the DOM element. | |
var a = document.createElement('a'); | |
a.setAttribute('href',url); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_login_enqueue_scripts() { | |
wp_enqueue_style( 'my-login', get_stylesheet_directory_uri() . '/assets/css/style-login.css' ); | |
} | |
add_action( 'login_enqueue_scripts', 'my_login_enqueue_scripts', 10 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get browser language, optionally passing a list of available languages. | |
* | |
* @param [array] $available_languages Available languages for the site | |
* @param [string] $default Default language for the site | |
* @return [string] Language code | |
*/ | |
function get_browser_language_code( $available_languages = [], $default = 'en' ) : string | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get data URI string from an image file. | |
* | |
* @param string $path_to_file | |
* @return string | |
*/ | |
function get_data_uri( string $path_to_file ) : string | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* These are two points in New York City */ | |
$point1 = array('lat' => 40.770623, 'long' => -73.964367); | |
$point2 = array('lat' => 40.758224, 'long' => -73.917404); | |
$distance = getDistanceBetweenPoints($point1['lat'], $point1['long'], $point2['lat'], $point2['long']); | |
foreach ($distance as $unit => $value) { | |
echo $unit.': '.number_format($value,4).'<br />'; | |
} |