Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Filip Procházka fprochazka

🏠
Working from home
View GitHub Profile
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
View Application.js
import Kefir from 'kefir';
import {List, Stack} from 'immutable';
import {comp, filter, map} from 'transducers-js';
function register(stream, messageType, handler) {
let xform = comp(
filter(x => x.first() === messageType),
map(x => x.rest()));
stream.transduce(xform).onValue(handler);
}
@fprochazka
fprochazka / README.md
Last active Nov 23, 2018 — forked from StefanWallin/README.md
Configuring HTTPS + SPDY
View README.md