Skip to content

Instantly share code, notes, and snippets.

@bezumkin
bezumkin / gitify-csv.php
Created May 25, 2023 08:13
Script to export context from Gitify exatracted files into CSV and import back
#!/usr/local/bin/php
<?php
use modmore\Gitify\Gitify;
use Symfony\Component\Yaml\Yaml;
if (PHP_SAPI !== 'cli') {
exit('This file should be run through the command line interface!');
}
@bezumkin
bezumkin / phinx.php
Last active April 24, 2023 05:31
Script to programmatically run Phinx from browser
<?php
use Phinx\Console\PhinxApplication;
use Phinx\Wrapper\TextWrapper;
$base = dirname(__DIR__, 2) . '/private/';
require $base . 'vendor/autoload.php';
$config = $base . 'console-commands/configs/phinx.php';
@bezumkin
bezumkin / download-db.php
Last active February 7, 2023 06:05
Download and upload MODX database from/to remote server
<?php
require 'config.core.php';
require MODX_CORE_PATH . 'config/' . MODX_CONFIG_KEY . '.inc.php';
$filename = $dbase . '-' . date('Y-m-d') . '.sql.gz';
header('Content-Type: application/x-gzip');
header('Content-Disposition: attachment; filename="' . $filename . '"');
@bezumkin
bezumkin / avatar-crop.vue
Created November 14, 2022 12:01
CropperJS example
<template>
<div>
<div
style="min-height: 200px; transition: background-color 0.25s"
:class="{
'border rounded overflow-hidden': true,
'bg-light': !dragCount,
'bg-light-green border-success': dragCount > 0,
}"
@drop.prevent="onAddFile"
@bezumkin
bezumkin / auth-plugin.ts
Last active April 2, 2024 16:55
Nuxt 3 Auth Example
// Put into plugins/auth.ts
export default defineNuxtPlugin((nuxtApp) => {
const auth = useAuth()
nuxtApp.hook('app:created', async () => {
if (!auth.loggedIn.value && auth.token.value) {
try {
await auth.loadUser()
} catch (e) {
if (e.response && e.response.status === 401) {