// Built-in types
$variable = null; // null type
// Scalar types
$boolVar = true; // bool type
$intVar = 42; // int type
$floatVar = 3.14; // float type
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 | |
namespace Example; | |
$a = 23; | |
\is_null($a); |
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
#!/bin/bash | |
# This script takes a video file as input and converts it into an HLS (HTTP Live Streaming) playlist with multiple resolutions and bitrates. It also generates a thumbnail image from the video. | |
# Check if an input filename is provided | |
if [ -z "$1" ]; then | |
echo "Usage: $0 input_filename (without extension) [-t]" | |
exit 1 | |
fi |
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
<!-- wp:query {"queryId":0,"query":{"perPage":"7","pages":0,"offset":0,"postType":"post","order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":false,"parents":[]},"align":"full","className":"pattern-post-grid-cover","layout":{"type":"constrained"}} --> | |
<div class="wp-block-query alignfull pattern-post-grid-cover"><!-- wp:group {"align":"full","style":{"spacing":{"padding":{"right":"var:preset|spacing|plus-3","left":"var:preset|spacing|plus-3","top":"var(\u002d\u002dtheme-spacing\u002d\u002dplus-3)","bottom":"var(\u002d\u002dtheme-spacing\u002d\u002dplus-3)"}}},"layout":{"type":"default"}} --> | |
<div class="wp-block-group alignfull" style="padding-top:var(--theme-spacing--plus-3);padding-right:var(--wp--preset--spacing--plus-3);padding-bottom:var(--theme-spacing--plus-3);padding-left:var(--wp--preset--spacing--plus-3)"><!-- wp:post-template {"align":"full","style":{"spacing":{"blockGap":"var:preset|spacing|minus-3"}},"className":"is-style-no-gap is-style-flex-grow is-style-fe |
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
// getDescription - given a url, this Eleventy filter extracts the meta | |
// description from within the <head> element of a web page using the cheerio | |
// library. | |
// | |
// The full html content of the page is fetched using the eleventy-fetch plugin. | |
// If you have a lot of links from which you want to extract descriptions, the | |
// initial build time will be slow. However, the plugin will cache the content | |
// for a duration of your choosing (in this example, it's set to 1 day). | |
// | |
// The description is extracted from the <meta> element with the name attribute |
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 | |
/** | |
* Preloading WordPress assets without a plugin. | |
* Change function name to something more unique. | |
* Priority is set to 0 to include as high in the <head> DOM as possible. Change priority if needed. | |
* Use WordPress is_page() to target specific page or is_front_page() to target ONLY homepage as in Option #1 | |
* If asset needs to be preloaded globally use Option #2. | |
* For multiple assets clone the link tag instead of the entire echo block. | |
* Change 'as' attribute accordingly. Values for 'as' can be found here https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-as. | |
* Use abolute paths. For external assets paste the url, for internal assets use WordPress functions to construct 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
#!/bin/bash | |
# Change directory to /home | |
cd /home | |
# Iterate through all users directories | |
for user in * ; do | |
# For every webapp under the user directory | |
# Count wp-config files to make sure its Wordpess |
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
/** | |
* WordPress dependencies. | |
*/ | |
import api from '@wordpress/api'; | |
import { __ } from '@wordpress/i18n'; | |
import { dispatch } from '@wordpress/data'; | |
import { |
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
/** | |
* WordPress dependencies. | |
*/ | |
import { useDispatch, useSelect } from '@wordpress/data'; | |
/** | |
* useMeta Hook. | |
* | |
* useMeta hook to get/update WordPress' meta fields. | |
* |
NewerOlder