Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Filip Procházka fprochazka

🏠
Working from home
Block or report user

Report or block fprochazka

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View RabbitProducerMock.php
<?php
use Kdyby;
use Kdyby\RabbitMq\Connection;
use Kdyby\RabbitMq\DI\RabbitMqExtension;
use Nette;
use Nette\Reflection\ClassType;
use PhpAmqpLib\Message\AMQPMessage;
use Tester;
View sqlSelect.php
<? php
public static function getAllIndicatorValuesOverview($userId = null) {
$surveys = self::getConnection()->query(
'SELECT surveys.surveyId,surveys.year,user.organizationName
FROM surveys
LEFT JOIN user ON surveys.userId=user.userId'
)->fetchAll();
foreach($surveys as &$survey) {
View AssetsPublishingCssFilter.php
<?php
namespace WebLoader;
use Kdyby;
use Nette;
use Nette\Utils\FileSystem;
use Nette\Utils\Strings;
use WebLoader\Compiler;
View composer-update.php
<?php
function composer_update($projectDir)
{
echo "Processing ", basename($projectDir), "\n";
passthru(sprintf('composer update --working-dir %s', escapeshellarg($projectDir)));
}
$dir = getcwd();
View nette-https-behind-proxy.php
<?php
// hack for https proxies
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) {
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https' && isset($_SERVER['SERVER_PORT']) && in_array($_SERVER['SERVER_PORT'], [80, 82])) { // https over proxy
$_SERVER['HTTPS'] = 'On';
$_SERVER['SERVER_PORT'] = 443;
} elseif ($_SERVER['HTTP_X_FORWARDED_PROTO'] === 'http' && isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 80) { // http over proxy
$_SERVER['HTTPS'] = 'Off';
View BufferedQueue.php
<?php
namespace Rohlikcz\RabbitMq;
use Rohlikcz\Identified;
use Rohlikcz\InvalidArgumentException;
use Rohlikcz\InvalidStateException;
use Doctrine\Common\Util\ClassUtils;
use Kdyby;
use Nette;
@fprochazka
fprochazka / QueryObject.php
Created May 21, 2015
QueryObject class template for PhpStorm
View QueryObject.php
<?php
namespace ${NAMESPACE};
use Nette;
use Kdyby;
use Kdyby\Doctrine\QueryBuilder;
use Kdyby\Persistence\Queryable;
View dynamicReturnTypeMeta.json
{
"methodCalls": [
{
"class": "\\Mockery",
"method": "mock",
"position": 0,
"mask": "%s|\\Mockery\\MockInterface"
},
{
"class": "\\Nette\\DI\\Container",
View nginx.conf
error_log syslog:server=unix:/var/log/nginx.sock;
http {
log_format verbose '$remote_addr - $remote_user $host "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"';
map $status $loggable {
~^[2] 0;
default 1;
}
View redis-server
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
You can’t perform that action at this time.