Skip to content

Instantly share code, notes, and snippets.

View JustSteveKing's full-sized avatar
🐘
Building API tools and educational content

Steve McDougall JustSteveKing

🐘
Building API tools and educational content
View GitHub Profile
@JustSteveKing
JustSteveKing / event.js
Created March 2, 2017 15:09
Custom Event Handler
class Event {
constructor() {
this.events = {};
}
fire(event, data) {
const Event = this.events[event];
if( Event ) {
Event.forEach(callback => {
callback.call(null, data);
@JustSteveKing
JustSteveKing / Laravel Repository.php
Created August 7, 2021 06:57
An example on Laravel Eloquent Repository
<?php
abstract class Repository
{
protected Builder $query;
public function all(): null|Collection
{
return $this->query->get();
}
@JustSteveKing
JustSteveKing / Colored.vue
Last active April 26, 2018 13:35
Component Structure for Buttons
<template>
<button class="btn" :classList="classList">
<template v-if="this.icons">
<slot></slot>
</template>
{{ this.text }}
</button>
</template>
<script>
@JustSteveKing
JustSteveKing / AccountController.php
Last active January 7, 2016 16:22
Using polymorphism in Laravel Auth
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Identity;
use App\Http\Requests;
use App\Http\Controllers\Controller;
class AccountController extends Controller {