Skip to content

Instantly share code, notes, and snippets.

@DougHayward
DougHayward / gist:ac567ba4075b2f11f4b1210672f204bf
Last active May 16, 2019 — forked from belsrc/gist:672b75d1f89a9a5c192c
Simple Vue.js filters that I usually need
View gist:ac567ba4075b2f11f4b1210672f204bf
/**
* Simple filter to make JSON pretty when dumping to the view.
* @param {JSON} value The JSON Object.
*/
Vue.filter('jsonPrettyPrint', (json) => {
if (typeof json !== 'string') {
json = JSON.stringify(json, undefined, 2)
}
json = json.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;')
return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+-]?\d+)?)/g, function (match) {
@DougHayward
DougHayward / composer.json
Created Mar 6, 2017 — forked from jaytaph/composer.json
Using the Symfony security component as standalone
View composer.json
{
"name": "jaytaph/security-example",
"require": {
"symfony/security-core": "~2.8"
},
"authors": [
{
"name": "Joshua Thijssen",
"email": "jthijssen@noxlogic.nl"
}
View select2-foundation5.css
/*
Version: 3.4.5 Timestamp: Mon Nov 4 08:22:42 PST 2013
*/
.select2-container {
margin: 0 0 1rem 0;
position: relative;
vertical-align: middle;
font-family: inherit;
-webkit-appearance: none !important;
font-size: 0.875rem;