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 / 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>
@whizark
whizark / SassMeister-input.scss
Last active August 29, 2015 14:06
Sass: Typed value factory & validator using Map #sass
// ----
// Sass (v3.4.1)
// Compass (v1.0.1)
// ----
// Sass: Typed value factory & validator using Map
// Direction type that accepts only top, right, left, bottom
// Direction type factory
@function dir-new($dir) {
@whizark
whizark / SassMeister-input-HTML.html
Last active August 29, 2015 14:06
Sass: Passing/Getting property value(s) into/inside mixins/functions #sass
<a class="button">An example link</a>
<a class="button--ghost">An example link</a>