Skip to content

Instantly share code, notes, and snippets.

View itumulak's full-sized avatar
🎯
Focusing

Ian Tumulak itumulak

🎯
Focusing
  • Davao City, Philippines
View GitHub Profile
<?php
class Script_Module {
private array $js_handles;
private array $js_localization;
private array $wpjs_strategies;
private string $current_js_handler;
public function __construct() {
$this->wpjs_strategies = array(
'in_footer' => true,
version: '3.7'
services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
deploy:
restart_policy:
condition: on-failure
@itumulak
itumulak / docker-stack.yml
Last active September 17, 2019 12:30
Docker WordPress Stack
version: '3.7'
services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
deploy:
restart_policy:
condition: on-failure
@itumulak
itumulak / docker-compose.yml
Last active July 3, 2019 21:05
WordPress + Elasticsearch Stack
version: '2'
services:
db:
image: mysql:5.7
volumes:
- ./db:/docker-entrypoint-initdb.d
- ./db_data:/var/lib/mysql
restart: always
environment:
@itumulak
itumulak / docker-compose.yml
Created May 22, 2019 20:23
Docker Compose for itumulak/wordpress-cli
version: '2'
services:
db:
image: mysql:5.7
volumes:
- ./db:/docker-entrypoint-initdb.d
- ./db_data:/var/lib/mysql
restart: always
environment:
@itumulak
itumulak / wp-image-handling.php
Last active September 24, 2018 16:41
Wordpress Image Handling
<?php
/**
* Wordpress Image Handling.
*
* @param array $file $_FILE. File Path Request.
* @return array $status Status
*/
function imageHandling( $file )
{
$imageArray = wp_handle_upload( $file, ['test_form' => false] );
$breakpoints: (
"phone": 400px,
"phone-wide": 480px,
"phablet": 560px,
"tablet-small": 640px,
"tablet": 768px,
"tablet-wide": 1024px,
"desktop": 1248px,
"desktop-wide": 1440px
);
$flex-justify: (
'start' : 'flex-start',
'end' : 'flex-end',
'center' : 'center',
'between' : 'space-between',
'around' : 'space-around'
);
$flex-align: (
'start' : 'flex-start',
// Best added in :before or :after
@mixin img_overlay($width, $height, $url : '../img/video-player.png' ) {
background-image: url($url);
max-width: #{$width}px;
max-height: #{$height}px;
content: ' ';
display: block;
width: 100%;
position: absolute;
height: 100%;
@itumulak
itumulak / helper.php
Last active November 2, 2017 07:51
Create an excerpt from the content if nothing is set
/**
* Allows to switch between excerpt and content.
* If excerpt is not set we will use content but limit the words.
* Ideally use for custom queries.
*
* @param string $content
* @param string $excerpt
* @param int $word_limit
* @param string $more
* @return string $trimmed_content