Skip to content

Instantly share code, notes, and snippets.

View iDevelopThings's full-sized avatar

Sam Parton iDevelopThings

View GitHub Profile
@iDevelopThings
iDevelopThings / SomeState.js
Created January 24, 2021 10:10
VueJS Observable State
import Vue from 'vue';
class SomeState {
constructor()
{
this.state = Vue.observable({});
}
@iDevelopThings
iDevelopThings / YoutubeUrl.php
Last active November 29, 2020 15:47
PHP/Laravel, get youtube video id + start time
<?php
namespace App\Services\YouTube;
use Str;
class YoutubeUrl
{
private string $url;
@iDevelopThings
iDevelopThings / DragDrop.vue
Last active July 16, 2024 15:16
Handles drag and drop file upload in VueJS
<!-- USAGE -->
<drag-drop-file-upload ref="dragDropFileUpload" @handleInput="changeImage"></drag-drop-file-upload>
//Handle image change/upload etc
changeImage({file, filePreview}) {
console.log({file, filePreview});
},
//Clear files added/dropped onto component?
$types = [
'ABAP' => 'abap',
'Windows Bat' => 'bat',
'BibTeX' => 'bibtex',
'Clojure' => 'clojure',
'Coffeescript' => 'coffeescript',
'C' => 'c',
'C++' => 'cpp',
'C#' => 'csharp',
'CSS' => 'css',
@iDevelopThings
iDevelopThings / UserRoles.php
Last active November 9, 2017 22:27
Allows you to add roles to a laravel user
<?php
namespace App\Support\Traits;
use App\Role;
use App\UserRole;
trait HasRoles
{
@iDevelopThings
iDevelopThings / NotificationDisplay.php
Last active March 24, 2019 10:53
Allows easy rendering of "notifications" with Laravel. Allows for you to do "return back()->with('error', 'Something went wrong');" and globally render each type of alert.
<?php
namespace App\Support\Helpers;
use Session;
/**
* Created by PhpStorm.
* User: sam
* Date: 31/05/17