Skip to content

Instantly share code, notes, and snippets.

View JanMikes's full-sized avatar
🚀
Peon.dev, MySpeedPuzzling.com

Jan Mikeš JanMikes

🚀
Peon.dev, MySpeedPuzzling.com
View GitHub Profile
@JanMikes
JanMikes / grayscale.js
Last active August 29, 2015 13:57
Very simple jquery script, that adds grayscale filter to your images with class "grayscale". On image hover or parents <a> tag hover image turns into original version using CSS3 transitions. Requires browser with HTML5 support (using 2d canvas).
// jQuerys default .load() is unreliable in WebKit browsers as is said in documentation
$.fn.imageLoad = function(fn){
this.load(fn);
this.each( function() {
if ( this.complete && this.naturalWidth !== 0 ) {
$(this).trigger('load');
}
});
}
var didScroll = false;
$(window).scroll(function() {
didScroll = true;
});
setInterval(function() {
if ( didScroll ) {
didScroll = false;
@JanMikes
JanMikes / Article1.php
Last active November 28, 2016 21:36
Draft of possible immutable append-only entities
<?php
class Article
{
/** @var \DateTime */
private $createdAt;
/** @var ArticleHistory[] */
private $historyChanges;
@JanMikes
JanMikes / gist:9958af45b71da4848b649873ac7138a0
Created December 20, 2016 20:52
./certbot-auto errors output
root@debian7:~# ./certbot-auto certonly --webroot -w /var/www/cz.directa.com/www -d cz.directa.com -d cs.directa.com -d ru.directa.com
Bootstrapping dependencies for Debian-based OSes...
Hit:1 http://packages.dotdeb.org wheezy-php56 InRelease
Hit:2 http://security.debian.org stretch/updates InRelease
Hit:3 http://ftp.u-picardie.fr/mirror/debian wheezy-backports InRelease
Hit:4 http://ftp.it.debian.org/debian stretch InRelease
Hit:5 http://ftp.it.debian.org/debian stretch-proposed-updates InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree
@JanMikes
JanMikes / build.xml
Last active July 12, 2017 23:05
First Phing build script
<?xml version="1.0" encoding="UTF-8"?>
<project name="OdbavTo" default="production" basedir=".">
<property environment="env" />
<property name="configFile" value="app/config/config.testttt.neon" />
<target name="production" description="Creates local config file">
<available file="${configFile}" property="configExists" />
<echo msg="Config file: ${configFile}" />
<echo msg="Config exists: ${configExists}" />
<if>
@JanMikes
JanMikes / run-rabbit-consumers.php
Created September 7, 2017 00:31
Multiple rabbit consumers in single command
<?php declare(ticks=1, strict_types=1);
require_once __DIR__ . '/../vendor/autoload.php';
use Arara\Process\Action\Command;
use Arara\Process\Child;
use Arara\Process\Control;
use Kdyby\RabbitMq\DI\RabbitMqExtension;
use Nette\DI\Container;
@JanMikes
JanMikes / DB.txt
Last active January 4, 2023 09:23
Example of simple and stupid value object
Vygenerovat migrations, ktera smaze z commentu typu `(DC2Type:identity_uid)`
<?xml version="1.0" encoding="UTF-8"?>
<project name="OdbavTo" default="createLocalConfig" basedir=".">
<property environment="env" />
<property name="configFile" value="app/config/config.local.neon" />
<target name="createLocalConfig" description="Creates local config file">
<available file="${configFile}" property="configExists" />
<if>
<isset property="configExists" />
<then>
@JanMikes
JanMikes / CreateTicketPresenter.php
Created December 3, 2017 17:00
Creating DTO from request body (dumb way!)
<?php declare (strict_types=1);
namespace OdbavTo\App\Presenters;
use Nette\Application\IResponse;
use Nette\Application\Request;
use OdbavTo\App\HttpRequest\RequestBodyHelper;
use OdbavTo\App\Responses\CreatedResponse;
use OdbavTo\Application\CreateTicket\CreateTicketRequest;
use OdbavTo\Application\CreateTicket\CreateTicketUseCase;
@JanMikes
JanMikes / Dockerfile
Created September 15, 2018 16:59
Multi-stage dockerfile with xdebug for local development
####
## Production build
####
FROM php:7.1-apache as production
MAINTAINER Jan Mikeš j.mikes@me.com
## Install composer globally
RUN curl -sS https://getcomposer.org/installer | php \
&& mv composer.phar /usr/local/bin/composer