Skip to content

Instantly share code, notes, and snippets.

View buiquangduc's full-sized avatar
🎯
Focusing

Bui Quang Duc buiquangduc

🎯
Focusing
View GitHub Profile
@buiquangduc
buiquangduc / index.blade.php
Created January 24, 2018 09:26
Index template of Sage 9 starter theme
@extends('layouts.app')
@section('content')
@include('partials.page-header')
@if (!have_posts())
<div class="alert alert-warning">
{{ __('Sorry, no results were found.', 'sage') }}
</div>
{!! get_search_form(false) !!}
@buiquangduc
buiquangduc / front-page.blade.php
Created January 23, 2018 09:04
Sage's Controller hierarchy debug example
@extends('layouts.app')
@section('content')
@debug('hierarchy')
@include('partials.page-header')
@if (!have_posts())
<div class="alert alert-warning">
{{ __('Sorry, no results were found.', 'sage') }}
</div>
@buiquangduc
buiquangduc / simple-wordpress.yml
Created October 11, 2017 06:48
Simple WordPress Docker YAML
version: "2"
services:
my-wpdb:
image: mariadb
ports:
- "8081:3306"
environment:
MYSQL_ROOT_PASSWORD: MyHiddenPassword
my-wp:
image: wordpress
@buiquangduc
buiquangduc / routine-coincidental-cohesion.php
Created October 10, 2017 05:49
Routine with Coincidental cohesion
<?php
// Example of routine with coincidental cohesion
function handleStuff() {
// Stuff to action with database
// Stuff to action with user input
// Stuff to action with more unrelated things,...
}
@buiquangduc
buiquangduc / improve-routine-logical-cohesion.php
Created October 10, 2017 05:43
Improve routine with logical cohesion
<?php
// Example of routine with logical cohesion
function update($name, $input) {
switch($name) {
case 'person':
// Stuff to update person with input data
break;
case 'car':
// Stuff to update car with input data
@buiquangduc
buiquangduc / routine-logical-cohesion.php
Last active October 10, 2017 05:39
Routine with logical cohesion
<?php
// Example of routine with logical cohesion
function update($name, $input) {
switch($name) {
case 'person':
// Stuff to update person with input data
break;
case 'car':
// Stuff to update car with input data
@buiquangduc
buiquangduc / improve-routine-procedural-cohesion.php
Created October 10, 2017 05:17
Improve routine with procedural cohesion
<?php
// Example of routine with procedural cohesion
// Imagine that you have a input screen that display the input fields in the order: email, name, address,.. of employee
function getNameEmailAddressInputEmployee() {
// Stuff to get the input name
// Stuff to get the input email
// Stuff to get the input address
}
@buiquangduc
buiquangduc / routine-procedural-cohesion.php
Last active October 10, 2017 05:13
Routine with Procedural cohesion
<?php
// Example of routine with procedural cohesion
// Imagine that you have a input screen that display the input fields in the order: email, name, address,.. of employee
function getNameEmailAddressInputEmployee($input) {
// Stuff to get the input name
// Stuff to get the input email
// Stuff to get the input address
}
@buiquangduc
buiquangduc / improve-temporal-cohesion.php
Created October 9, 2017 18:02
Improve temporal cohesion
<?php
// Call other routines inside temporal cohesion
function Initializes() {
ReadConfigurationFile();
SetupMemoryManager()
SetupMoreThing();
...
}
@buiquangduc
buiquangduc / routine-temporal-cohesion.php
Created October 9, 2017 17:54
Routine with temporal cohesion
<?php
//Example if routines with temporal cohesion
function Initialize() {
// All actions when intialize come here
}
function Shutdown() {
// All actions when shut down come here
}