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 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 dynamicReturnTypeMeta.json
{
"methodCalls": [
{
"class": "\\Mockery",
"method": "mock",
"position": 0,
"mask": "%s|\\Mockery\\MockInterface"
},
{
"class": "\\Nette\\DI\\Container",
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
View bootstrap.php
<?php
require __DIR__ . '/../vendor/autoload.php';
$configurator = new Nette\Configurator;
$configurator->setDebugMode(TRUE); // debug mode MUST NOT be enabled on production server
$configurator->enableDebugger(__DIR__ . '/../log');
$configurator->setTempDirectory(__DIR__ . '/../temp');
View .phpstorm.meta.php
<?php
// .phpstorm.meta.php
namespace NEON_META { // we want to avoid the pollution
$CONFIG_KEYS = [
'dibi' => [ 'host' => '', 'dbname' => '', 'user' => '', 'password' => '' ], // unobstrusive static definition
'nette' => \Nette\Config\Extensions\NetteExtension::$defaults, // no problem the property is actually not static
'nette' => [
'session' => [
View gist:4030362
/**
* Acquires an indexing lock if possible.
*
* @return boolean
*/
private function acquireLock()
{
$redis = $this->getRedis();
if ($redis->setNX(self::LOCK_KEY, $this->getTimeout())) {
@fprochazka
fprochazka / gist:3644347
Created Sep 5, 2012 — forked from dg/gist:3644321
Texy on nette.org
View gist:3644347
<?php
/**
* Texy parser for wiki page.
*/
class Parser extends Nette\Object
{
/**
* @return void
@fprochazka
fprochazka / gist:3207083
Created Jul 30, 2012
Get random table row with doctrine DQL in Symfony2
View gist:3207083
<?php
//
// Theory (for MySQL): http://jan.kneschke.de/projects/mysql/order-by-rand/
//
class QuestionRepository extends EntityRepository
{
public function findOneRandom()
{
$em = $this->getEntityManager();
@fprochazka
fprochazka / play.js
Created Jan 24, 2012 — forked from juzna/01-choose.png
GitHub Play
View play.js
(function() {
var commits = [], repo = document.location.href.match(/github\.com\/([^\/]+\/[^\/]+)\//)[1];
// Play for all commits
$('.commit-group .commit-links')
.append($('<a href="#" class="browse-button github-play-select">Play</a>'));
// show next commit
var nextCommit = function () {
$('.site .container').load(commits.shift() + ' #.site .container', function () {
You can’t perform that action at this time.