Tim's Blog Random musings and rantings

Article Title

Feb 18, 2016
Here are some random code examples:

HTML is always fun to look at, right?

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>Some Random Title</title>
	</head>
	<body></body>
</html>

Javascript has several ways of making a self-executing function.

// ES5 IIFE
(function() {
	var x = 'foo';
}());

// ES5 Alternate IIFE
(function() {
	var y = 'bar';
})();

// ES6 IIFE
(() => {
	let x = 'foo';
	const y = 'bar';
})();
Or, how about some php magic methods?
<?php

class Foo {
	/**
	 * A Constructor
	 */
	public function __construct()
	{

	}

	/**
	 * A Destructor
	 */
	public function __destruct()
	{

	}

	/**
	 * Dynamically get class properties
	 *
	 * @param  string $key - the key of the item to get
	 * @return mixed - the value of the item
	 */
	public function __get($key)
	{

	}

	/**
	 * Dynamically set class properties
	 *
	 * @param string $key - the key of the item to set
	 * @param mixed $value - the value of the item to set
	 */
	public function __set($key, $value)
	{

	}
}

Or, you could even showcase CSS

:root {
	--body-font: 'Slabo 27px', serif;
	--header-fonts: 'PT Serif', serif;
	background:whitesmoke;
	font-family: var(--body-font);
	box-sizing: border-box;
	cursor: default;
	line-height: 1.4;
	-ms-overflow-style: -ms-autohiding-scrollbar;
	overflow-y: scroll;
	text-rendering: optimizeLegibility;
	text-size-adjust: 100%
}

/*
 *! Flexbox grid
 */
section {
	flex: 0;
}