Skip to content

Instantly share code, notes, and snippets.

<?php
$gemeentes = [
'Aa en Hunze',
'Aalburg',
'Aalsmeer',
'Aalten',
'Achtkarspelen',
'Alblasserdam',
'Albrandswaard',
@stephan-v
stephan-v / gist:c100c34c8585f4d1cfb8
Created March 14, 2016 20:46
Laravel connect polymorphic table to a pivot
// it ain't pretty but it works
// grab all the beer_user pivot records from a table and the corresponding commentable records
$comments = \DB::table('users')
->select('beer_user.id', 'comments.comment', 'comments.commentable_id', 'comments.created_at')
->join('beer_user', 'users.id', '=', 'beer_user.id')
->join('comments', 'beer_user.id', '=', 'comments.commentable_id')
->where('beer_user.user_id', $id)
->where('comments.commentable_type', 'App\Beer')
->get();
@stephan-v
stephan-v / self.static.php
Created December 8, 2016 15:38 — forked from jasonrhodes/self.static.php
Self vs Static in PHP
<?php
class A
{
public static $var = "I'm set in A!<br>";
public static function getStatic() {
echo static::$var;
}
public static function getSelf() {
phpunit ~/CodeCoverage --coverage-html
https://css-tricks.com/svg-artboard-sizing/
https://jsfiddle.net/7nyg1h8w/1/
@stephan-v
stephan-v / webpack.mix.js
Created May 24, 2017 08:19
Webpack configuration file.
const mix = require('laravel-mix');
const DashboardPlugin = require('webpack-dashboard/plugin');
const webpack = require('webpack');
const path = require('path');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
@stephan-v
stephan-v / Autocomplete.vue
Last active May 31, 2017 13:53
Vue autocomplete
<template>
<div class="relative">
<input type="text"
autocomplete="off"
class="form-control"
id="destination"
name="destination"
:placeholder="placeholder"
v-model="query"
@keydown="keydown">
@stephan-v
stephan-v / SearchFilter.vue
Last active July 7, 2017 13:59
Search filter component.
<template>
<div class="filter">
<h4>{{ title }}</h4>
<div class="checkbox" v-for="(value, key) in range">
<label>
<input type="checkbox" :value="key" v-model.number="items">
<span class="value">{{ value }}</span>
<span class="background"></span>
<template>
<div class="filter">
<h4>{{ translation }}</h4>
<div class="checkbox" v-for="(value, index) in range" :key="index">
<label>
<input type="checkbox" :value="index" v-model.number="values">
<span class="value">{{ value }}</span>
<span class="background"></span>
@stephan-v
stephan-v / SvgInline.vue
Last active July 31, 2017 14:25
Code splitting SVG images with Webpack.
import(/* webpackChunkName: "js/svg/[request]" */ `resources/assets/images/svg/${this.name}.svg`)
.then((module) => {
this.svg = module;
}
).catch(error => 'An error occured while loading the svg');