Skip to content

Instantly share code, notes, and snippets.

@zdenekdrahos
zdenekdrahos / .gitignore
Last active Oct 16, 2020
Toggl time-entries -> JIRA (tempo) worklogs
View .gitignore
config.php
*.json
*.log
@zdenekdrahos
zdenekdrahos / README.md
Last active Jun 15, 2021
Docker volumes - www-data Debian/Ubuntu + Alpine
View README.md

Docker volumes - www-data Debian/Ubuntu + Alpine

Sharing host OS www-data directories as a volume is tricky for Alpine images. User ID (UID) and Group ID (GID) are different.

UID/GID Ubuntu Alpine
33 www-data xfs
82 - www-data
View MethodAnnotations.php
<?php
namespace Whatever;
// 10 Call to an undefined method Whatever\Swift_SmtpTransport::setUsername().
// 14 Call to an undefined method Whatever\Swift_SmtpTransport::setUsername().
class MethodAnnotations
{
public function __invoke()
{
@zdenekdrahos
zdenekdrahos / bash.sh
Created Jul 23, 2016
phpqa - exit code experiments
View bash.sh
$ phpqa --tools phpcs
[FileSystem\CleanDir] Cleaned build/
[FileSystem\FilesystemStack] mkdir ["build\/"]
[ParallelExec] /var/phpqa/vendor/bin/phpcs -p --extensions=php --standard=PSR2 --ignore=*/vendor/* "./" --report=checkstyle --report-file="build//checkstyle.xml"
1/1 [============================] 100%
[ParallelExec] '/var/phpqa/vendor/bin/phpcs -p --extensions=php --standard=PSR2 --ignore=*/vendor/* "./" --report=checkstyle --report-file="build//checkstyle.xml"' exited with code 1
[ParallelExec] Exit code 1 Time 0.25s
[phpqa]
+-------+----------------+--------------+--------+-------------+
@zdenekdrahos
zdenekdrahos / status.html
Last active Feb 12, 2018
Scortes - jQuery, AJAX integration
View status.html
<html lang=cs><head><meta charset=utf-8 /></head><body>
<ul class="teams">
<li><a href='https://scortes.rozpisyzapasu.cz/api/533A1A/2015/Morašice/status.html'>Muži</a></li>
<li><a href='https://scortes.rozpisyzapasu.cz/api/530C2B/2015/H. Újezd/Morašice/status.html'>Dorost</a></li>
<li><a href='https://scortes.rozpisyzapasu.cz/api/533E2A/2015/Morašice/status.html'>Žáci</a></li>
</ul>
<div id="scortes"></div>
<script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
View bootstrap.php
<?php
// app/bootstrap.php
function getService($service, array $config = [])
{
return initApplication($config)->getService($service);
}
function initApplication(array $config)
{
View LatteWithGlobalVariables.php
<?php
namespace App;
use Latte\Engine;
class LatteWithGlobalVariables extends Engine
{
private $globals = [];
View config.rb
# disable layout
page ".htaccess.apache", :layout => false
# rename file after build
after_build do
File.rename 'build/.htaccess.apache', 'build/.htaccess'
end
View TransactionalDispatcher.php
<?php
use Doctrine\ORM\EntityManager;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
class TransactionalDispatcher
{
/** @var EventDispatcherInterface */
private $dispatcher;