Skip to content

Instantly share code, notes, and snippets.

@klkvsk
klkvsk / gist:9684458
Created March 21, 2014 11:45
extdoc.php - generate .php from extension
<?php
if ($argc < 2) {
die('Usage: php extdoc.php <extension_name>' . PHP_EOL);
}
$extension = $argv[1];
$keywords = array('__halt_compiler', 'abstract', 'and', 'array', 'as', 'break', 'callable', 'case', 'catch',
'class', 'clone', 'const', 'continue', 'declare', 'default', 'die', 'do', 'echo', 'else', 'elseif', 'empty',
'enddeclare', 'endfor', 'endforeach', 'endif', 'endswitch', 'endwhile', 'eval', 'exit', 'extends', 'final',
'for', 'foreach', 'function', 'global', 'goto', 'if', 'implements', 'include', 'include_once', 'instanceof',
@klkvsk
klkvsk / .minttyrc
Last active February 4, 2017 21:36
Locale=ru_RU
Charset=UTF-8
BoldAsFont=-1
BellFlash=yes
CursorType=block
CursorBlinks=no
BackgroundColour=37,39,48
Font=Terminus (TTF)
FontWeight=500
ForegroundColour=200,200,200
set-option -g prefix `
bind-key ` send-prefix
unbind %
bind - split-window -v
bind = split-window -h
set -g base-index 1
setw -g pane-base-index 1
setw -g utf8 on
set -g status-utf8 on
@klkvsk
klkvsk / RESULTS.txt
Created December 12, 2020 14:38
php-enum property collection benchmarks
## 1000 files, 10 values in each
-- file parsing reader --
Read 1000 files, 10000 properties total
Total time consumed: 102.24 ms
-- reflection reader --
Read 1000 files, 10000 properties total
Total time consumed: 45.46 ms
@klkvsk
klkvsk / setup-office365-unblock-region.ps1
Created November 4, 2023 21:38
Single script to install/update MS Office. Also unblocks blocked regions ("Command not supported" error)
## !!! Run as Administrator
## !!! VPN is required for setup from blocked regions
## - Also, if you are still blocked, try `Set-WinHomeLocation -GeoId 244` (244=USA)
## - Know that setup.exe writes detailed logs to %TEMP%
# BetaChannel -> CurrentPreview -> Current -> MonthlyEnterprise -> SemiAnnualPreview -> SemiAnnual
$CHANNEL = "CurrentPreview"
# modify this to your needs
# https://github.com/MicrosoftDocs/OfficeDocs-DeployOffice/blob/public/DeployOffice/office-deployment-tool-configuration-options.md
@klkvsk
klkvsk / wslrsync.php
Last active November 17, 2023 20:48
Rsync wrapper for IDEA to fix rsync deployment from wsl
#!/usr/bin/env php
<?php
/**
* Rsync wrapper for IDEA to fix rsync deployment from wsl
* In "Rsync settings" set:
* - Rsync executable path: "c:\windows\system32\wsl.exe"
* - Rsync options: "/path/where/you/saved/wslrsync.php -zar"
* - Shell executable path: "ssh"
*/
$verbose = true;
@klkvsk
klkvsk / UniqueSafeRepositoryTrait.php
Created April 17, 2024 11:17
UniqueSafeRepositoryTrait
<?php
namespace App\Framework\Doctrine;
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Persisters\Entity\BasicEntityPersister;
trait UniqueSafeRepositoryTrait
{