Skip to content

Instantly share code, notes, and snippets.

View danielsdeboer's full-sized avatar

Daniel S. Deboer danielsdeboer

View GitHub Profile
@danielsdeboer
danielsdeboer / phpunit-noxdebug.php
Created May 4, 2018 15:35
Run PHPUnit, disabling Xdebug before execution, preserving arguments.
<?php
require 'vendor/autoload.php';
use Composer\XdebugHandler\XdebugHandler;
/*
* Check if Xdebug is enabled and disable it.
*/
$xdebug = new XdebugHandler('no-prefix');
@danielsdeboer
danielsdeboer / mixin.js
Last active November 29, 2017 16:41
A VueJS mixin to automatically map class prop names and values to a computed value.
// The mixin
import kebabcase from 'lodash.kebabcase'
export default {
// The component will bind class to this computed property.
computed: {
classes () {
const classes = {}
Object.keys(this.$props)
@danielsdeboer
danielsdeboer / component.js
Last active November 20, 2017 15:36
Importing props in VueJs
// Instead of doing this in lots of components:
export default {
props: {
colorClass: {
type: String,
required: true,
default: 'blue',
validator: value => ['red', 'blue'].includes(value)
}
}