Skip to content

Instantly share code, notes, and snippets.

@duskohu
duskohu / Dockerfile-fpm-7-1
Last active June 1, 2020 12:48
Dockerfiles
FROM php:7.1-fpm-alpine
LABEL maintainer="Dusan Hudak <[email protected]>"
RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community/ --allow-untrusted gnu-libiconv
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php
# install GD
RUN apk add --no-cache freetype libpng libjpeg-turbo freetype-dev libpng-dev libjpeg-turbo-dev && \
docker-php-ext-configure gd \
--with-gd \
/**
* This file is part of the ReCaptchaControl package
*
* @license MIT
* @author Petr Kessler (https://kesspess.cz)
* @link https://github.com/uestla/ReCaptchaControl
*/
;(function(window, $) {
@duskohu
duskohu / curl-multy.php
Last active December 24, 2018 14:18
curl-multy
<?php
$urls = array(
'https://affil.invia.sk/direct/core/tool_xml-feed/download/id/4717246-59914d4420a17/',
'https://affil.invia.sk/direct/core/tool_xml-feed/download/id/4717246-5991501203db9/',
'https://affil.invia.sk/direct/core/tool_xml-feed/download/id/4717246-5991508463df6/',
'https://affil.invia.sk/direct/core/tool_xml-feed/download/id/4717246-599150f30d32a/',
'https://affil.invia.sk/direct/core/tool_xml-feed/download/id/4717246-598ec4850dd48/',
'https://affil.invia.sk/direct/core/tool_xml-feed/download/id/4717246-598df691c7e53/',
'https://affil.invia.sk/direct/core/tool_xml-feed/download/id/4717246-598df6511a99e/',
Samozrejme zalezi od konkretneho pripadu, ale podmienku by som rozdelil do mensich AOP casti
<?php
/**
* @param array $settings
* @return bool
*/
public function isModuleUploads($settings = array()) {
if (isset($settings['module-uploads']) && $settings['module-uploads']) {
Pokial sa jedna o tento priklad tak connection by som riesil ako sluzbu samostatne a dal by som ju do DI,
pri registraci do DI by sa nakonfigurovala, naco sa ma stale vytvarat objekt DatabaseConnection staci jedn sluzba.
UserFacade by som tiez dal do DI nech si ju mozem zavolat kde potrebujem a DatabaseConnection si vyziadam, DI sa o to uz postara.
V reale by som asi pouzil doctrinu, lebo ma lepsie riesenu architekturu.
<?php
class DatabaseConnection {
@duskohu
duskohu / Page.php
Created January 10, 2015 08:20
TreePathListener
<?php
/**
* This file is part of the Nas of Nette Framework
*
* Copyright (c) 2013 Dusan Hudak (http://dusan-hudak.com)
*
* For the full copyright and license information, please view
* the file license.txt that was distributed with this source code.
*/
@duskohu
duskohu / Role.php
Created March 9, 2014 22:23
Doctrine model
<?php
namespace Nas\UsersModule\Model;
/**
* @ORM\Entity
* @ORM\Table(name="roles")
*/
class Role extends Object
{
/**
@duskohu
duskohu / LessFilter.php
Created February 27, 2014 22:16
LessFilter
<?php
namespace NasExt\Framework\Components\WebLoader\Filter;
use WebLoader\Compiler;
/**
* @author Dusan Hudak <[email protected]>
*/
class LessFilter
@duskohu
duskohu / ModularRouter.php
Last active January 4, 2016 05:39
Modular Router
<?php
namespace Nas;
use Nette\Application\IRouter;
use Nette\Application\Request;
use Nette\Http\IRequest;
use Nette\Http\Url;
use Nette\Object;
class ModularRouter extends Object implements IRouter
@duskohu
duskohu / custom.netteForms.js
Created December 9, 2013 20:57
Custom netteForms.js - change alert messages
/**
* Display error message.
*/
Nette.addError = function (elem, message) {
if (elem.focus) {
elem.focus();
}
if (message) {
var elemPosition = $(elem).position();
var elmHeight = $(elem).outerHeight();