Skip to content

Instantly share code, notes, and snippets.

View atomjoy's full-sized avatar

Atomjoy atomjoy

View GitHub Profile
@atomjoy
atomjoy / Component-Slot-Event.vue
Last active July 15, 2025 11:26
Vue componen slot event.
<script setup>
import { ref } from 'vue';
let selector_slot = ref('accept');
</script>
<template>
<SelectorSlot v-model="selector_slot" name="selector_slot">
<template v-slot:default="{ onClick }">
<SelectorSlotButton v-model="selector_slot" value="accept" @click="onClick('accept')">✔️ Accept</SelectorSlotButton>
<SelectorSlotButton v-model="selector_slot" value="reject" @click="onClick('reject')">🚩 Reject</SelectorSlotButton>
@atomjoy
atomjoy / Load-Json-Translations-Dynamically.vue
Last active July 2, 2025 10:06
Load JSON translations dynamically from API in Vue 3 component with axios.
<script setup>
import { onBeforeMount, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n';
let { locale } = useI18n({ useScope: 'global' });
let list = ref(null);
onBeforeMount(async () => {
await load();
});
@atomjoy
atomjoy / Locales.vue
Last active July 2, 2025 09:30
Vue component local locales
<script setup>
// See: https://vue-i18n.intlify.dev/guide/advanced/composition
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
const { t } = useI18n({
// useScope: 'global', // Overwrite global
locale: 'en',
messages: {
en: {
@atomjoy
atomjoy / Queue-Mail-Jobs-Laravel.md
Last active June 21, 2025 08:23
Kolejkowanie wiadomości email w Laravel (queue, jobs, events).

Queue Mail Jobs Laravel

Laravel pozwala na łatwe tworzenie zadań w kolejce, które mogą być przetwarzane w tle. Przenosząc czasochłonne zadania do kolejki, Twoja aplikacja może odpowiadać na żądania internetowe szybciej i zapewniać lepsze wrażenia użytkownika.

Dodaj zadanie do kolejki

@atomjoy
atomjoy / CRON.md
Last active June 14, 2025 16:57
Wysyłanie wiadomości email z cron

Wysyłanie wiadomości email z cron

Połącz się przez ssh.

Plik mail.php

Plik php wysyłający wiadomość email.

<?php
@atomjoy
atomjoy / PaginateCustom.vue
Last active June 11, 2025 16:07
Vue 3 pagination component.
<!-- Runs only with vue 3.5 -->
<!-- <PaginateCustom :current_page="current_page" :last_page="last_page" @page="setPage" /> -->
<script setup>
import { onMounted, watchEffect } from 'vue';
const { current_page, last_page, offset } = defineProps({
current_page: { type: Number, default: 1 },
last_page: { type: Number, default: 10 },
offset: { type: Number, default: 3 },
@atomjoy
atomjoy / Nano-email.html
Last active May 22, 2025 14:08
Nano minimal Gmail html email template.
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Welcome</title>
<link href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet" />
@atomjoy
atomjoy / Laravel_app_composer.json
Last active May 22, 2025 14:02
Laravel package development on localhost.
{
"require": {
"php": "^8.2",
"laravel/framework": "^12.0",
"atomjoy/payu": "dev-main"
},
"repositories": [
{
"type": "path",
"url": "packages/atomjoy/payu"
@atomjoy
atomjoy / Laravel-Custom-Json-Exception.md
Last active May 4, 2025 09:14
Laravel 12 custom json exception class.

Custom Json Exception in Laravel

Laravel 12 custom json exception class.

JsonException Class

<?php

namespace App\Exceptions;
@atomjoy
atomjoy / Laravel-Custom-Exception-Handler.md
Created May 4, 2025 09:03
Laravel custom exception handler with service provider (modules).

Laravel 12 Custom Exception Handler

Laravel 12 custom exception handler with service provider (modules).

ExceptionHandlerProvider.php

<?php

namespace App\Providers;