Skip to content

Instantly share code, notes, and snippets.

View whizark's full-sized avatar
🏞️
Working from home

Whizark whizark

🏞️
Working from home
View GitHub Profile
@whizark
whizark / extendingTraits.php
Created July 10, 2014 01:22
Extending Traits #test #php
<?php
trait FirstTrait
{
public function firstMethod() {
echo 'This is the firstMethod()' . PHP_EOL;
}
}
trait SecondTrait
{
@whizark
whizark / InterfaceAndTrait.php
Last active August 29, 2015 14:03
Interface and Trait #test #php
<?php
interface FlyableThingInterface
{
public function fly();
}
interface AnimalInterface
{
public function eat();
}
@whizark
whizark / constructorTrait.php
Created July 10, 2014 03:18
Constructor trait #test #php
<?php
interface PersonInterface
{
public function getFullname();
}
trait PersonTrait
{
private $name;
@whizark
whizark / dci.php
Last active August 29, 2015 14:04
DCI in PHP #test #php
<?php
interface AccountInterface
{
public function getBalance();
public function increase($money);
public function decrease($money);
}
trait AccountTrait
{
@whizark
whizark / wp-service-provider.php
Last active August 29, 2015 14:04
Register WordPress $GLOBALS as services with a container (The simplest way) #test #wordpress
<?php
// This is just an example FOR WORDPRESS USERS.
//
// To make this better:
// * use namespace/class/closure etc.
// * use autoloader
// * create & use service provider classes
// * create & use factory for WP_Query, WP_User etc.
// interface ContainerInterface
@whizark
whizark / wp-best-practice.md
Last active January 3, 2016 21:31
WordPress: (My) Best Practices #draft #wordpress

WordPress: Best Practices

This is my best practices for WordPress but it is also the one FOR MOST OF THE WORDPRESSS DESIGNERS/DEVELOPERS. Some of these practices are useful to check code quality of themes/plugins.

Follow PSR

You may/should break away from WordPress Coding Standards and follow PSR if you are not a core/core-plugin developer (If you haven't followed either of WordPress Conding Standards or PSR, it is a bad habit) .

Why

@whizark
whizark / sass-naming-convention.md
Last active April 25, 2023 13:55
Sass Naming Convention #sass #draft
@whizark
whizark / SassMeister-input.scss
Last active August 29, 2015 14:05
Sass: Map getter & overridding #sass
// ----
// Sass (v3.4.1)
// Compass (v1.0.1)
// ----
// A property map
$properties: (
prop-1: "raw-prop-1-value",
prop-2: "raw-prop-2-value"
);
@whizark
whizark / SassMeister-input-HTML.html
Last active August 29, 2015 14:05
Sass & BEM: A flexible component definition #sass
<div class="collection">
<div class="collection__item">Item 1</div>
<div class="collection__item">Item 2</div>
<div class="collection__item">Item 3</div>
</div>
<ul class="collection">
<li class="collection__item">Item 1</li>
<li class="collection__item">Item 2</li>
<li class="collection__item">Item 3</li>
@whizark
whizark / SassMeister-input-HTML.html
Created August 31, 2014 07:38
Sass: Polymorphic placeholder & mixins #sass
<a class="button" href="#">&lt;a&gt; button</a>
<button class="button">&lt;button&gt; button</button>