Skip to content

Instantly share code, notes, and snippets.

Miloslav Hůla milo

Block or report user

Report or block milo

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
@milo
milo / php-oci8-debian.md
Last active Mar 29, 2019
Oracle OCI8 extension on Linux Debian
View php-oci8-debian.md

Oracle Instant Client libraries installation

Download Oracle Instant Client libraries (URL may change, already happened few times). Be sure you download correct (x64 or x32) architecture. And correct version. I'm using Instant Client 10.1.0.5.0 with Oracle 10g, 11g and 12c and PHP 5.6, 7.1 and 7.2. Never hit any problem with such setup but my queries are quite simple.

Extract libraries into directory you prefer. I'm using /usr/local/lib/oracle. File tree follows:

/usr/local/lib/oracle/
    /instantclient-10.1.0.5.0/
        /sdk/
        /libclntsh.so -> libclntsh.so.10.1
        /libclntsh.so.10.1
@milo
milo / ServiceCollectionsExtension.php
Created Oct 3, 2018
Nette DI service collections
View ServiceCollectionsExtension.php
<?php
declare(strict_types=1);
namespace App;
use Nette\DI\CompilerExtension;
/**
@milo
milo / CsvResponse.php
Last active Jun 25, 2018
CSV response for Nette Application
View CsvResponse.php
<?php
declare(strict_types=1);
namespace App\Responses;
use Nette\Application;
use Nette\Http;
@milo
milo / vhost.conf
Created Nov 22, 2017
Apache proxy to localhost port with WebSockets
View vhost.conf
#
# Proxy for local running .NET application on port 5000
#
# a2enmod proxy proxy_http proxy_wstunnel
#
<VirtualHost *:443>
ServerName example.com
ServerAdmin webmaster@example.com
@milo
milo / Crypt.php
Last active Jan 28, 2019
Crypt with OpenSSL
View Crypt.php
<?php
/**
* Copyright (c) 2015 Miloslav Hůla (https://github.com/milo)
*/
namespace Milo;
final class Crypt
@milo
milo / fid-remove.js
Created Apr 20, 2017
Flash message _fid parameter remove.
View fid-remove.js
(function (w, timeout) {
setTimeout(function () {
var url = w.location.toString();
if (w.history && w.history.replaceState && url.indexOf('_fid=') !== -1) {
w.history.replaceState({}, null, /[?&]_fid=[^&]+$/.test(url)
? url.replace(/[?&]_fid=[^&]+/, '')
: url.replace(/([?&])_fid=[^&]+&/, '$1')
);
}
}, timeout || 2000);
@milo
milo / PersistentUploadControl.php
Created Aug 18, 2015
Persistent file upload control for #nettefw
View PersistentUploadControl.php
<?php
namespace App\Controls;
use App\Model\Entities;
use Nette\DirectoryNotFoundException;
use Nette\Forms;
use Nette\Http;
use Nette\Utils\Html;
@milo
milo / post-merge
Created Jul 23, 2015
Git hook for purging cache
View post-merge
#!/bin/sh
# Save as .git/hooks/post-merge
# Set execute bit like: chmod ug+x .git/hooks/post-merge
purgePath="temp/cache"
echo
echo -n "HOOK [Purge cache]: "
if [ -d "$purgePath" ]; then
@milo
milo / Bootstrap3Renderer.php
Created Jun 3, 2015
Bootstrap3 renderer for Nette Framework forms
View Bootstrap3Renderer.php
<?php
namespace Milo\NetteForms\Rendering;
use Nette\Forms;
use Nette\Forms\Controls;
/**
* Simple Bootstrap3 renderer for Nette Framework forms.
*
@milo
milo / local-composer-deps-bothers.md
Created Dec 8, 2014
Why local composer dependencies bothers (sucks)
View local-composer-deps-bothers.md

This is reaction to article Using local packges as composer dependencies.

The described technique bothers for two main things (mentioned on the article end):

  • after every dependency package change (even one single character) you have to commit changes
  • after that you have to call composer update (on big project, you have to wait few seconds for autoload.php is created)

My best technique is:

  • create project by composer with all dependencies
  • drop developed dependencies from composer.json and run composer update (or just delete them in vendor folder)
  • clone all dependencies into project/libs-dev/... subdirecotries (or link them by file system links)
You can’t perform that action at this time.