Skip to content

Instantly share code, notes, and snippets.

View CamKem's full-sized avatar
🏠
Working from home

Cam Kemshal-Bell CamKem

🏠
Working from home
View GitHub Profile
@CamKem
CamKem / HandleFollows.php
Last active April 26, 2024 02:05
Laravel Polymorphic Follows System.
<?php
declare(strict_types=1);
// For code organisation, goes on the user model.
namespace App\Concerns;
use App\Models\Follow;
use Illuminate\Database\Eloquent\Model;
@CamKem
CamKem / PhpStorm Errors
Created April 5, 2024 03:32
PhpStorm Errors
Images

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@CamKem
CamKem / FlashMessage.vue
Last active March 4, 2024 14:12
Popup Flash Messages for VueJS
<template>
<teleport to="body">
<Transition
enter-active-class="transition duration-300 ease-in-out"
enter-from-class="translate-y-12 scale-75 opacity-0 ease-in-out"
enter-to-class="scale-100 opacity-100 ease-in-out"
leave-active-class="transition duration-300 ease-in-out"
leave-from-class="translate-y-0 scale-100 opacity-100 ease-in-out"
leave-to-class="translate-y-12 scale-75 opacity-0 ease-in-out"
>
@CamKem
CamKem / vite.config.js
Last active January 2, 2024 05:09
Herd SSL/TLS Vite Config Hack
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import vue from '@vitejs/plugin-vue';
import fs from 'fs';
import { homedir } from 'os';
import { resolve } from 'path';
export default defineConfig({
plugins: [
laravel({
@CamKem
CamKem / DashboardLayout.vue
Created December 14, 2023 08:45
Example of Responsive Layout Using HTML & CSS (Plus JavaScript)
<template>
<SidebarLayout v-if="$page.props.auth.user"
@newPost="handleNewPost"/>
<div id="wrapper"
class="flex w-full place-content-center">
<main id="main"
:class="[
layout.isMedium ? 'max-w-[980px]' : '',
layout.isLarge && !layout.isSidebarExpanded ? 'max-w-[956px]' : '',
layout.isLarge && layout.isSidebarExpanded ? 'max-w-[762px]' : '',
@CamKem
CamKem / LayoutStore.js
Last active October 26, 2023 23:29
Layout store (Pinia)
import { defineStore } from "pinia";
import useBreaks from "../Composables/useBreakpoints";
const { isSmall, isMedium, isLarge, isExtraLarge, is2xl, greaterThanMedium, greaterThanLarge } = useBreaks();
export const useLayoutStore = defineStore("layout", {
state: () => ({
sidebar: {
open: false,
expanded: false,
@CamKem
CamKem / EnumMethods.php
Created September 1, 2023 09:34
Group of enum helper methods trait
<?php
namespace App\Traits;
use Exception;
trait EnumMethods
{
/**
@CamKem
CamKem / Filters.php
Last active July 28, 2023 15:34
Abstract Filters Class
<?php
namespace App\Filters;
abstract class Filters
{
/**
* The protected request and query objects.
* @var object
//This is just the gist where I store all the images I use for markup.