Skip to content

Instantly share code, notes, and snippets.

View anatoliy-t7's full-sized avatar
💭
Stand With Ukraine

Anatoliy anatoliy-t7

💭
Stand With Ukraine
  • Planet Earth
View GitHub Profile
@anatoliy-t7
anatoliy-t7 / Online.vue
Created February 14, 2023 14:56
Vue 3 Online
<template>
<div> {{ isOnline }} </div>
</template>
<script setup lang="ts">
const navigator = window.navigator;
const isOnline = ref(navigator.onLine);
window.addEventListener('offline', () => {
isOnline.value = false;
@anatoliy-t7
anatoliy-t7 / Select.vue
Created January 13, 2023 02:32
Vue 3 composition components
<template>
<div>
<label
v-if="label"
:for="id"
class="form-label">
{{ label }}
</label>
<select
:id="id"
@anatoliy-t7
anatoliy-t7 / Envoy.blade.php
Last active January 4, 2023 05:59
Laravel Envoy with zero downtime
@setup
require __DIR__.'/vendor/autoload.php';
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
try {
$dotenv->load();
$dotenv->required(['APP_NAME', 'DEPLOY_SERVER', 'DEPLOY_REPOSITORY', 'DEPLOY_PATH', 'DEPLOY_BRANCH', 'LOG_SLACK_WEBHOOK_URL'])->notEmpty();
} catch ( Throwable $e ) {
echo $e->getMessage();
exit;
@anatoliy-t7
anatoliy-t7 / commands.txt
Last active October 14, 2022 04:08
Setup Apache for laravel to current folder
sudo nano /etc/apache2/sites-available/your_domain.conf
sudo a2ensite your_domain.conf
sudo a2dissite 000-default.conf
sudo apache2ctl configtest
sudo systemctl restart apache2
@anatoliy-t7
anatoliy-t7 / ErrorCatcher.php
Created April 23, 2022 13:25
ErrorCatcher for JavaScript (Laravel, Livewire)
<?php
namespace App\Http\Livewire;
use Livewire\Component;
use Illuminate\Support\Facades\Log;
class ErrorCatcher extends Component
{
protected $listeners = ['getError'];