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 lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Document</title> | |
</head> | |
<body> | |
<script> |
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 | |
| |
abstract class Node implements JsonSerializable | |
{ | |
/** | |
* @var string | |
*/ | |
public string $id; | |
| |
/** |
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 | |
// Paste this code into your theme/functions.php | |
add_action( 'abrs_countries_dataset', function ( $countries ) { | |
$top = [ 'VN', 'US' ]; | |
uasort( $countries, function ( $country1, $country2 ) use ( $top ) { | |
$top = array_reverse( $top ); | |
$priority1 = array_search( $country1['alpha2'], $top ); |
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
<?xml version="1.0"?> | |
<ruleset name="WordPress Coding Standards based custom ruleset for your plugin"> | |
<description>Generally-applicable sniffs for WordPress plugins.</description> | |
<!-- What to scan --> | |
<file>.</file> | |
<exclude-pattern>/tests/</exclude-pattern> | |
<exclude-pattern>/vendor/</exclude-pattern> | |
<!-- How to scan --> |
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
add_action( 'abrs_setup_room_rate', function ( $room_rate ) { | |
/* @var $room_rate \AweBooking\Availability\Room_Rate */ | |
$request = $room_rate->get_request(); | |
$request_adults = $request | |
->get_guest_counts() | |
->get_adults() | |
->get_count(); | |
if ( ( $extra_adults = $request_adults - 1 ) > 0 ) { |
Laravel has a powerful Inversion of Control (IoC) / Dependency Injection (DI) Container. Unfortunately the official documentation doesn't cover all of the available functionality, so I decided to experiment with it and document it for myself. The following is based on Laravel 5.4.26 - other versions may vary.
I won't attempt to explain the principles behind DI / IoC here - if you're not familiar with them you might want to read What is Dependency Injection? by Fabien Potencier (creator of the Symfony framework).
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 | |
class Multidimensional { | |
/** | |
* Return item in array with multidimensional support. | |
* | |
* @param array $array | |
* @param string $keys | |
* @param mixed $default | |
* @return 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 next and prev products | |
// Author: Georgy Bunin ([email protected]) | |
// forked from https://gist.github.com/2176823 | |
function ShowLinkToProduct($post_id, $categories_as_array, $label) { | |
// get post according post id | |
$query_args = array( 'post__in' => array($post_id), 'posts_per_page' => 1, 'post_status' => 'publish', 'post_type' => 'product', 'tax_query' => array( | |
array( | |
'taxonomy' => 'product_cat', |
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 | |
# Install Ruby v2.3.0 | |
sudo apt-get -y update | |
sudo apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev | |
cd /tmp | |
wget https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.0.tar.gz | |
tar -xvzf ruby-2.3.0.tar.gz | |
cd ruby-2.3.0/ | |
./configure --prefix=/usr/local |
NewerOlder