Start with a testem.json file that includes sinon for stubbing, etc as well as any files that would be utilized in testing.
{
"framework": "mocha+chai",
"launch_in_dev": ["Chrome", "phantomjs"],
(function() { | |
/** | |
* Wrapper Element | |
* @type {Element} | |
*/ | |
const wrapperElement = document.querySelector('body'); | |
/** | |
* Root Domain |
<?php | |
/* A class is used to create an object - an object is defined by a class */ | |
class ShopProduct { | |
/** Properties **/ | |
public $title = 'Default Product'; | |
public $producer_last = 'Last Name'; | |
<?php | |
/** | |
* | |
* Traits | |
* | |
* 1. PHP does not allow for multiple inheritance | |
* 2. A class can implement many interfaces, but interfaces only provide a template. | |
* 3. Traits allow us to share implementation across class hierarchies. | |
* |
<?php | |
/** | |
* If two traits share the same method and are both included in a class, we have a problem. Rare, but possible | |
* Here's how to get around it. | |
* | |
* Reference: PHP Objects, Patterns and Practice, ed 4. pp 49 | |
**/ | |
trait TaxTools { | |
function calculateTax($price) { |
// Returns a function, that, as long as it continues to be invoked, will not | |
// be triggered. The function will be called after it stops being called for | |
// N milliseconds. If `immediate` is passed, trigger the function on the | |
// leading edge, instead of the trailing. | |
const debounce = function(func, wait, immediate) { | |
let timeout; | |
return function(...args) { |
// Returns a function, that, when invoked, will only be triggered at most once | |
// during a given window of time. Normally, the throttled function will run | |
// as much as it can, without ever going more than once per `wait` duration; | |
// but if you'd like to disable the execution on the leading edge, pass | |
// `{leading: false}`. To disable execution on the trailing edge, ditto. | |
const throttle = function(func, wait, options) { | |
let timeout, context, args, result; | |
let previous = 0; |
This is when you set max-height
on an element and then transition that property rather than height
. This is simple but
has obvious downsides:
min-height
is much larger than auto
, there will be a delay, plus you put a max-height on your element.<?php | |
/** @var string Secret Key $secret */ | |
$secret = ''; | |
/** @var bool $debugging */ | |
$debugging = false; | |
$webDirectory = '/var/www/html/'; |
sudo npm cache clean -f | |
sudo npm install -g n | |
sudo n stable |