Skip to content

Instantly share code, notes, and snippets.

@dvcarrot
dvcarrot / UiOffcanvas.vue
Created January 28, 2026 14:44
vue offcanvas with tailwindcss
<script setup lang="ts">
import { onUnmounted, watch } from 'vue'
import { useEventListener } from '@vueuse/core'
const opened = defineModel<boolean>({ default: false })
const props = defineProps<{
fullscreen?: boolean
side?: 'left' | 'right' | 'top' | 'bottom'
}>()
@dvcarrot
dvcarrot / JobsStatus.php
Created January 20, 2026 08:23
Laravel command jobs:status
<?php
namespace App\Console\Commands\Utils;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Date;
use Illuminate\Support\Facades\DB;
class JobsStatus extends Command
{
#!/bin/bash
# Скрипт для сжатия изображений с помощью ImageMagick
# Учитывает контекст и назначение изображений для оптимального сжатия
# Использование: ./compress_images.sh
echo "🚀 Начинаем сжатие изображений с учетом контекста..."
# Создаем папку для сжатых изображений
mkdir -p images/compressed
@dvcarrot
dvcarrot / recaptcha.js
Created February 14, 2024 00:20
nodejs recaptcha verification
import fetch from 'node-fetch'
import {RECAPTCHA_SECRET_KEY} from './settings'
const RECAPTCHA_VERIFY_URL = 'https://www.google.com/recaptcha/api/siteverify'
const RECAPTCHA_VERSION_NUM = 3
export async function verifyRecaptchaToken(token) {
const body = {
secret: RECAPTCHA_SECRET_KEY,
@dvcarrot
dvcarrot / ExcelHelper.php
Last active November 28, 2023 12:27
laravel excel helper
<?php
namespace App\Utils;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Storage;
class ExcelHelper
{
static function downloadCollectionAsExcel(Collection $collection, $fileName = 'export.xls')
<script>
export default {
name: 'UtilsDropzone',
data() {
return {
active: false,
visible: false,
}
},
render() {
@dvcarrot
dvcarrot / switcher.vue
Created September 28, 2023 12:22
UiSwitcher
<template>
<div class="ui-switcher" :class="{
'ui-switcher--relative': !isExternalRelative,
'ui-switcher--small': isSmall,
}">
<input class="ui-switcher__input" type="checkbox" v-model="checked" @change="onChange"/>
<span class="ui-switcher__display"></span>
</div>
</template>
@dvcarrot
dvcarrot / Online.php
Created April 28, 2023 09:21
Online - laravel middleware
<?php
namespace App\Http\Middleware;
use Carbon\Carbon;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
class Online
@dvcarrot
dvcarrot / Idempotency.php
Last active April 28, 2023 09:22
Idempotency - laravel middleware
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Cache;
use Carbon\Carbon;
@dvcarrot
dvcarrot / UiBottomSheet.vue
Created April 28, 2023 09:12
UiBottomSheet.vue
<template>
<div
class="ui-bottom-sheet"
:class="{
opened: opened,
closed: opened === false,
moving: moving
}"
v-on="handlers"
ref="bottomSheet"