Skip to content

Instantly share code, notes, and snippets.

View depsimon's full-sized avatar

Simon Depelchin depsimon

View GitHub Profile
@depsimon
depsimon / UserFactory.php
Created July 18, 2019 11:14
Unique initials from first name & last name in Laravel Model Factory
<?php
/** @var \Illuminate\Database\Eloquent\Factory $factory */
use App\User;
use Illuminate\Support\Str;
use Faker\Generator as Faker;
/*
|--------------------------------------------------------------------------
| Model Factories
@depsimon
depsimon / profile.vue
Created March 5, 2019 10:56
Vuetify Profile Page
<template>
<v-container fluid>
<v-layout column>
<v-card>
<v-card-text>
<v-flex class="mb-4">
<v-avatar size="96" class="mr-4">
<img :src="'/avatars/avatar_' + (form.avatar.toLowerCase()) + '.png'" alt="Avatar">
</v-avatar>
<v-btn @click="openAvatarPicker">Change Avatar</v-btn>
@depsimon
depsimon / AvatarPicker.vue
Created March 5, 2019 10:41
Avatar Picker with Vuetify in a Profile Form
<template>
<v-dialog :fullscreen="$vuetify.breakpoint.xs" width="500" transition="dialog-bottom-transition" v-model="show">
<v-card>
<v-toolbar dark color="primary">
<v-btn icon dark @click="show = false">
<v-icon>close</v-icon>
</v-btn>
<v-toolbar-title>Select an Avatar</v-toolbar-title>
<v-spacer></v-spacer>
</v-toolbar>
@depsimon
depsimon / RouteSummaryCommand.php
Created July 13, 2018 11:17
route:summary Summary of all registered routes
<?php
namespace App\Console;
use Illuminate\Foundation\Console\RouteListCommand;
use Illuminate\Routing\Route;
use Symfony\Component\Console\Input\InputOption;
class RouteSummaryCommand extends RouteListCommand
{
@depsimon
depsimon / Icon.vue
Last active April 15, 2018 13:00
Font Awesome 5 - SVG Icon component
<template>
<svg class="icon" viewBox="0 0 512 512"><use :xlink:href="'/svg/fa-' + w + '.svg#' + n"></use></svg>
</template>
<script>
export default {
props: {
weight: { default: 'regular' },
name: { type: String }
},
04ea926c2a9244bbf9b0ccafa7bc7037a4d5872a609baec1259b6ad2d793eded1c578947b1030a67a05f3f16bad16818357b16d6ac46edfb68ead3ae66db36457e;frbayart
@depsimon
depsimon / helpers.php
Created January 27, 2018 17:21
Count mondays of a month with Carbon in PHP/Laravel
<?php
function mondaysInMonth($month = null) {
if ($month === null) $month = Carbon\Carbon::today()->startOfMonth();
$nextMonth = $month->copy()->endOfMonth();
return $month->diffInDaysFiltered(function ($date) {
return $date->isMonday();
}, $nextMonth);
@depsimon
depsimon / bulma.blade.php
Created July 16, 2017 14:37
Laravel Bulma Pagination Template
@if ($paginator->hasPages())
<nav class="pagination">
{{-- Previous Page Link --}}
@if ($paginator->onFirstPage())
<a class="pagination-previous" disabled>Previous</li>
@else
<a class="pagination-previous" href="{{ $paginator->previousPageUrl() }}" rel="prev">Previous</a>
@endif
{{-- Next Page Link --}}
@depsimon
depsimon / helper.php
Created December 9, 2014 11:13
PHPExcel - CSV to array helper function
<?php
/**
* Helper function to convert CSV sheet to key value array
* PHPExcel.php class required
* @param string $filePath path to CSV file
* @param string $delimiter delimiter
* @param string $enclosure enclosure
* @param string $lineEnding line ending
* @param integer $sheetIndex sheet index to read
@depsimon
depsimon / css_resources.md
Created June 2, 2014 07:35 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides