Skip to content

Instantly share code, notes, and snippets.

View Sogl's full-sized avatar

Artyom Mezin Sogl

View GitHub Profile
@james0r
james0r / gist:d625419b92d2c8644aa29755a7872693
Last active September 4, 2022 22:16
Dynamic Routing in Grav using Flex Objects

In my-plugin/my-plugin.php:

public function onPluginsInitialized(): void {
   ...

  $this->router();
}
public function router() {
 /** @var Uri $uri */
@stephan-strate
stephan-strate / grav.php
Created July 25, 2022 16:42
Zero-downtime deployer grav recipe
<?php
namespace Deployer;
require_once 'recipe/common.php';
add('recipes', ['grav']);
add('shared_dirs', [
'user/accounts',
@amiranagram
amiranagram / select2.blade.php
Created June 29, 2021 13:51
Select2 multiple - Livewire/Alpine
<div
x-data="{
model: @entangle($attributes->wire('model')),
}"
x-init="
select2 = $($refs.select)
.not('.select2-hidden-accessible')
.select2({
theme: 'bootstrap',
dropdownAutoWidth: true,
@slava-vishnyakov
slava-vishnyakov / readme.md
Last active July 23, 2024 18:32
How to upload images with TipTap editor
  1. Create a file Image.js from the source below (it is almost a copy of Image.js from tiptap-extensions except that it has a constructor that accepts uploadFunc (function to be called with image being uploaded) and additional logic if(upload) { ... } else { ... previous base64 logic .. } in the new Plugin section.
import {Node, Plugin} from 'tiptap'
import {nodeInputRule} from 'tiptap-commands'

/**
 * Matches following attributes in Markdown-typed image: [, alt, src, title]
 *
@moay
moay / imapsync.md
Last active June 29, 2023 05:51 — forked from dsoares/imapsync.md
Install and use imapsync in Mac OS X

Install and use imapsync in Mac OS X

brew install imapsync

Run (without ssl)

imapsync --host1 imap.from.server --user1 foo --password1 secret1 --host2 imap.dest.server --user2 bar --password2 secret2

Run (with ssl)

@nickdenardis
nickdenardis / deploy.php
Last active February 13, 2024 16:39
Zero downtime local build Laravel 5 deploys with Deployer
<?php
namespace Deployer;
require 'recipe/laravel.php';
require 'vendor/deployer/recipes/local.php';
require 'vendor/deployer/recipes/rsync.php';
require 'vendor/deployer/recipes/npm.php';
// Configuration
set('ssh_type', 'native');
anonymous
anonymous / app.dockerfile
Created January 2, 2017 11:02
FROM php:7.0.4-fpm
RUN apt-get update && apt-get install -y libmcrypt-dev \
mysql-client libmagickwand-dev --no-install-recommends \
&& pecl install imagick \
&& docker-php-ext-enable imagick \
&& docker-php-ext-install mcrypt pdo_mysql
@jacurtis
jacurtis / _spacing-helpers.scss
Last active May 30, 2024 17:41
SASS Margin and Padding Helpers Loop. Generates .m-t-10 type helper classes.
/*
This .scss loop will create "margin helpers" and "padding helpers" for use in your web projects.
It will generate several classes such as:
.m-r-10 which gives margin-right 10 pixels.
.m-r-15 gives MARGIN to the RIGHT 15 pixels.
.m-t-15 gives MARGIN to the TOP 15 pixels and so on.
.p-b-5 gives PADDING to the BOTTOM of 5 pixels
.p-l-40 gives PADDING to the LEFT of 40 pixels
@davebarnwell
davebarnwell / PHP composer tools.md
Last active July 5, 2024 11:36
Global installation of PHP tools with Composer

Global installation of PHP tools with Composer

To install a composer package globally, you run the usual require command, but with the addition of the global modifier. So to install PHPUnit, you would run:

$ composer global require phpunit/phpunit
$ composer global require phpunit/dbunit
$ composer global require phing/phing
$ composer global require phpdocumentor/phpdocumentor
$ composer global require sebastian/phpcpd
@alexeygrigorev
alexeygrigorev / vimeo-download.py
Created September 17, 2016 09:09
Downloading segmented video from vimeo
import requests
import base64
from tqdm import tqdm
master_json_url = 'https://178skyfiregce-a.akamaihd.net/exp=1474107106~acl=%2F142089577%2F%2A~hmac=0d9becc441fc5385462d53bf59cf019c0184690862f49b414e9a2f1c5bafbe0d/142089577/video/426274424,426274425,426274423,426274422/master.json?base64_init=1'
base_url = master_json_url[:master_json_url.rfind('/', 0, -26) + 1]
resp = requests.get(master_json_url)
content = resp.json()