Skip to content

Instantly share code, notes, and snippets.

View jiripudil's full-sized avatar

Jiří Pudil jiripudil

View GitHub Profile
@milo
milo / fid-remove.js
Created April 20, 2017 12:46
Flash message _fid parameter remove.
(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);
@xrstf
xrstf / letsencrypt.md
Last active April 18, 2023 05:01
Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

This document details how I setup LE on my server. Firstly, install the client as described on http://letsencrypt.readthedocs.org/en/latest/using.html and make sure you can execute it. I put it in /root/letsencrypt.

As it is not possible to change the ports used for the standalone authenticator and I already have a nginx running on port 80/443, I opted to use the webroot method for each of my domains (note that LE does not issue wildcard certificates by design, so you probably want to get a cert for www.example.com and example.com).

Configuration

For this, I placed config files into etc/letsencrypt/configs, named after <domain>.conf. The files are simple:

@milo
milo / PersistentUploadControl.php
Created August 18, 2015 11:17
Persistent file upload control for #nettefw
<?php
namespace App\Controls;
use App\Model\Entities;
use Nette\DirectoryNotFoundException;
use Nette\Forms;
use Nette\Http;
use Nette\Utils\Html;
@hrach
hrach / dynamicReturnTypeMeta.json
Last active April 11, 2017 10:35
Dynamic Return Type
{
"methodCalls": [
{
"class": "\\Mockery",
"method": "mock",
"position": 0,
"mask": "%s|\\Mockery\\MockInterface"
},
{
"class": "\\Nette\\DI\\Container",
@klimesf
klimesf / SignPresenter.phpt
Last active August 29, 2015 14:13
Nette\Tester + Facebook\Webdriver
<?php
namespace Test\Presenters\AdminModule;
use Tester;
use Tester\Assert;
use DesiredCapabilities;
use RemoteWebDriver;
use WebDriverBy as By;
<?php
use Nette\Application\UI\Presenter;
use Nette\DI\CompilerExtension;
/**
* Auto register presenters as services
* @author Martin Bažík <martin@bazo.sk>
@oroce
oroce / README.md
Created June 12, 2014 07:51
nginx request id
@juzna
juzna / flow.md
Last active March 14, 2016 17:28
Cooperative Multitasking Components in Nette Framework example

Cooperative Multitasking, Components, Nette & Flow

On GitHub I provide example or Cooperative Multitasking components on a single site served by Nette Framework. These components need to process several network requests to render themselves, which is normally slow.

This example takes advantage of yield operator (available since PHP 5.5) to switch between tasks, Flow as scheduler and Rect as parallel http client.

This post introduces the Flow framework and cooperative multitasking in general.

The Example Application

<?php
error_reporting(E_ALL);
class StringTypeHandler {
public function length() {
return strlen($this);
}
}
@enumag
enumag / bardump.php
Created December 11, 2012 22:28
Nette\Diagnostics\Debugger::barDump shortcut
<?php
use \Nette\Diagnostics\Debugger;
/**
* Nette\Diagnostics\Debugger::barDump shortcut.
* @author Jáchym Toušek
* @param mixed $value
*/
function bd($value)