Skip to content

Instantly share code, notes, and snippets.

@owenconti
owenconti / 0281fb4c-c3be-4349-96ae-2895f44c34a0.js
Created February 21, 2021 19:32
Replacing Laravel Mix with Vite
import { createVuePlugin as Vue2Plugin } from 'vite-plugin-vue2';
const { resolve } = require('path');
const Dotenv = require('dotenv');
Dotenv.config();
const ASSET_URL = process.env.ASSET_URL || '';
export default {
plugins: [
@owenconti
owenconti / 7ef5c6b7-bdd4-4782-bd3c-fe052d8dc0af.yml
Created February 18, 2021 04:23
GitHub Action to Deploy Laravel Vapor Apps
name: Build
on: [push, workflow_dispatch]
jobs:
build-php:
services:
mysql:
image: mysql:8.0
env:
MYSQL_USER: root
@owenconti
owenconti / 15fbfc6f-ad37-4044-9fad-6a7be2114bb4.jsx
Created February 10, 2021 19:56
Why you should be using React Context more often
// inside ModalHeader component...
const ModalCloseButton = () => {
const {closeModal} = useModal();
return (
<button type="button" onClick={() => closeModal()}>X</button>
);
}
@owenconti
owenconti / 029bf609-dc6d-48d6-bb43-e70ba9fd0af8.php
Last active August 20, 2023 18:14
Adding Stripe Checkout and Customer Portal to your Laravel application
<?php
Route::get('/subscription', ManageSubscriptionController::class)->name('subscription');
@owenconti
owenconti / 0342e875-6e9a-42ab-b08b-4a1adad53498.js
Last active January 11, 2021 16:34
Validating Props in Vue
{
props: {
name: [String, Number]
}
}
@owenconti
owenconti / 26747580-1a04-413f-8d76-812a1f84ca3d.php
Last active January 8, 2021 21:41
Storing and testing encrypted values in Laravel
<?php
...
use Sagalbot\Encryptable\Encryptable;
class User extends Authenticatable
{
use Encryptable;
@owenconti
owenconti / f4723c2b-ae0f-455c-a27d-146b116b185a.yaml
Last active December 30, 2020 20:22
Force PHP version during GitHub Actions job
name: Build
jobs:
test:
name: Test
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master
- name: Checkout
- name: Setup PHP with PECL extension
uses: shivammathur/setup-php@v2
SELECT * FROM mysql.general_log;
@owenconti
owenconti / 7eb33b8a-a18a-4938-a91a-a067521150af.php
Last active December 20, 2020 04:57
How to fix "cannot declare class because the name is already in use" error in Laravel/PHP
php artisan optimize:clear
composer dump-autoload
@owenconti
owenconti / 13ffd923-c36c-4beb-8a9e-e2479a49a712.html
Last active January 6, 2021 15:41
Supporting dark mode with SVG favicons
<svg width="180" height="180" viewBox="0 0 180 180" fill="none" xmlns="http://www.w3.org/2000/svg">
<style>
path {
fill: #273240;
}
@media (prefers-color-scheme: dark) {
path { fill: #ffffff; }
}
</style>