Skip to content

Instantly share code, notes, and snippets.

View jjsquady's full-sized avatar
🎯
Focusing

Jorge Gonçalves Junior jjsquady

🎯
Focusing
View GitHub Profile
@jjsquady
jjsquady / BladeComponentsServiceProvider.md
Last active June 11, 2021 05:00
Registering anonymous blade components from a package

How to

<?php

public function boot()
{
  $dir = resource_path(<views-folder>);
  $this->loadViewsFrom($dir, '<prefix>');
@jjsquady
jjsquady / mysql-sail.md
Last active March 9, 2024 16:50
Laravel Sail - GRANT ALL PRIVILEGES to user

Run this command in sail project folder:

docker-compose exec mysql bash

execute the mysql -u root -p command

provide the default password password

then executes

docker run --name docker-postgres -e POSTGRES_PASSWORD=postgres -p 5432:5432 -d postgres
docker run --name docker-mysql -e MYSQL_ALLOW_EMPTY_PASSWORD="yes" -e MYSQL_ROOT_PASSWORD="" -p 3306:3306 -d mysql:latest
@jjsquady
jjsquady / laravel-worker.yml
Created July 28, 2020 17:41
PM2 Laravel Queue
apps:
- name: laravel-queue-worker
script: artisan
exec_mode: fork
interpreter: php
instances: 1
args:
- queue:work
- --queue=<name>
- --tries=3
@jjsquady
jjsquady / pagiantion.blade.php
Created June 10, 2020 05:08
Laravel custom Pagination with Tailwindcss for Livewire
@if ($paginator->hasPages())
<div
class="bg-white px-4 py-3 flex items-center rounded-b-lg shadow justify-between border-t border-gray-200 sm:px-6"
>
{{-- Mobile view.--}}
<div class="flex-1 flex justify-between sm:hidden" id="mobile">
@if($paginator->onFirstPage())
<button
disabled
class="relative inline-flex items-center px-4 py-2 bg-gray-200 cursor-not-allowed border border-gray-300 text-sm leading-5 font-medium rounded-md text-gray-700 focus:outline-none"
@jjsquady
jjsquady / Media.blade.php
Created May 25, 2020 21:46 — forked from tanthammar/Media.blade.php
LiveWire Spatie Media Image upload with VueCroppa
<div id="media-comp" class="display-contents">
<media inline-template>
<form>
<div v-for="(image, index) in form" :key="index" @touchstart.stop @mousedown.stop class="col-span-6">
<h3 class="text-3xl font-medium">@{{ image.label }}</h3>
<p class="py-3">Allowed Width @{{image.width}}px, Height @{{image.height}}px, Max file size @{{image.maxFileSize}}</p>
<input v-model="image.value" wire:model="@{{ image.name }}" type="hidden">
<croppa v-model="image.model" :width="image.width" :height="image.height"
:placeholder="locale == 'sv' ? 'Välj en bild' : 'Choose an image'"
:accept="'image/*'" :file-size-limit="image.maxByte" :zoom-speed="3" :disable-drag-and-drop="false"
@jjsquady
jjsquady / Media.blade.php
Created May 25, 2020 21:46 — forked from tanthammar/Media.blade.php
LiveWire Spatie Media Image upload with VueCroppa
<div id="media-comp" class="display-contents">
<media inline-template>
<form>
<div v-for="(image, index) in form" :key="index" @touchstart.stop @mousedown.stop class="col-span-6">
<h3 class="text-3xl font-medium">@{{ image.label }}</h3>
<p class="py-3">Allowed Width @{{image.width}}px, Height @{{image.height}}px, Max file size @{{image.maxFileSize}}</p>
<input v-model="image.value" wire:model="@{{ image.name }}" type="hidden">
<croppa v-model="image.model" :width="image.width" :height="image.height"
:placeholder="locale == 'sv' ? 'Välj en bild' : 'Choose an image'"
:accept="'image/*'" :file-size-limit="image.maxByte" :zoom-speed="3" :disable-drag-and-drop="false"
<div x-data="{open: true}" class="bg-gray-300 w-full h-screen p-4">
<div class="mb-6 w-full bg-white rounded-lg pointer-events-auto" x-show="open" x-transition:enter="ease-out duration-300" x-transition:enter-start="opacity-0" x-transition:enter-end="opacity-100" x-transition:leave="ease-in duration-200" x-transition:leave-start="opacity-100" x-transition:leave-end="opacity-0" class="fixed inset-0 transition-opacity">
<div class="rounded-lg shadow-xs overflow-hidden">
<div class="p-4">
<div class="flex items-start">
<div class="flex-shrink-0">
<svg class="h-6 w-6 text-green-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
@jjsquady
jjsquady / nextjs-deploy.md
Last active May 2, 2024 08:20
Deploying NEXTJS site with nginx + pm2

How to setup next.js app on nginx with letsencrypt

next.js, nginx, reverse-proxy, ssl

1. Install nginx and letsencrypt

$ sudo apt-get update
$ sudo apt-get install nginx letsencrypt

Also enable nginx in ufw