Skip to content

Instantly share code, notes, and snippets.

@pawelmysior
pawelmysior / Setting.php
Created Oct 10, 2019
Cacheable settings model
View Setting.php
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Cache;
class Setting extends Model
{
protected static function boot()
@pawelmysior
pawelmysior / index.html
Created Mar 28, 2019
Images preloading
View index.html
<script>
window.addEventListener('load', function () {
const imagesToPreload = [
'/images/test.png',
// ..
];
let images = [];
for (let i = 0; i < imagesToPreload.length; i++) {
images[i] = new Image();
@pawelmysior
pawelmysior / SvgIcon.vue
Last active Aug 7, 2018 — forked from calebporzio/SvgIcon.vue
SVG Icon Vue Component
View SvgIcon.vue
<template>
<div v-html="require('!!html-loader!./../../../svg/zondicons/' + this.icon + '.svg')" v-once></div>
</template>
<script>
export default {
props: ['icon'],
mounted() {
this.$el.firstChild.classList.add(...this.$el.className.split(' '));
this.$el.firstChild.classList.add('fill-current');