Skip to content

Instantly share code, notes, and snippets.

View jiripudil's full-sized avatar

Jiří Pudil jiripudil

View GitHub Profile
@jiripudil
jiripudil / LatteExtractor.php
Last active March 22, 2020 12:41
Symfony/Translation keys extraction from Nette and Latte
<?php
declare(strict_types=1);
namespace App\Infrastructure\Localization\Extractor;
use Latte\Engine;
use Nette\Application\UI\ITemplateFactory;
use Nette\Bridges\ApplicationLatte\Template;
use Nette\Utils\Finder;
@jiripudil
jiripudil / README.md
Created November 19, 2018 07:52
Running and compiling a PhpStorm plugin
  1. Open File | Project Structure.
  2. In Platform Settings | SDK, add an Intellij Platform Plugin SDK pointing to an installation of PhpStorm.
  3. In Project Settings | Libraries, add a Java library with two files from the installation of PhpStorm: plugins/php/lib/php.jar and plugins/php/lib/php-openapi.jar.
  4. In Project Settings | Modules, set the Module SDK to the SDK created in step 2.
  5. At the same place, add the library created in step 3 to the module if it's not there already. Then set its Scope to Provided and make sure the Export checkbox is unchecked.

Now you should be able to create a Plugin-type run configuration and run the plugin. To build a final jar file, use Build | Prepare Plugin Module For Deployment.

<?php
declare(strict_types = 1);
namespace App\Application;
use Slim\App;
interface ApplicationConfigurator
@jiripudil
jiripudil / tooltip.html
Last active October 26, 2016 07:12
Purce CSS tooltip - demo: https://jsfiddle.net/yp1tL5ft/
<span data-tooltip="Look ma, I am a tooltip!">Hover over me!</span>
@jiripudil
jiripudil / @layout.latte
Created October 25, 2016 14:31
Nette ♥ webpack-dev-server
<!DOCTYPE html>
<html lang="cs">
<head>
<title>{block title}Foo{/block}</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="{$bundlePath}/styles.css" rel="stylesheet">
</head>
<body>
{include #content}

Keybase proof

I hereby claim:

  • I am jiripudil on github.
  • I am jiripudil (https://keybase.io/jiripudil) on keybase.
  • I have a public key whose fingerprint is 78A0 8508 7D11 76DD 9F25 24B8 D334 4DC7 AAE0 703D

To claim this, I am signing this object:

@jiripudil
jiripudil / partial.php
Created January 9, 2015 10:53
Helper function for partial application in PHP
<?php
function partial(callable $closure, ...$partialArgs) {
return function (...$args) use ($closure, $partialArgs) {
return call_user_func($closure, ...$partialArgs, ...$args);
};
}
// demo
@jiripudil
jiripudil / fuck
Created October 16, 2013 11:10
A script that comes in handy when you are dealing with Unix problems and you get desperate.
#!/bin/sh
if [ -z $1 ]; then
echo "Don't swear!" # or similar motivating phrase
exit 2
fi
case $1 in
you)
sudo reboot
@jiripudil
jiripudil / spinner.html
Created August 17, 2013 17:32
Pure JavaScript spinner
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Pure JS spinner</title>
<style>
#spinner { font-size: 6em; }
</style>
@jiripudil
jiripudil / gist:5627154
Last active December 17, 2015 14:49
Snippet that allows you to inspect elements in Google Chrome Dev Tools with a single click
document.addEventListener('click', function (e) {
// the combination can be changed easily
// in this case it is Ctrl + Shift + MMB
if (e.button == 1 && e.ctrlKey && e.shiftKey) {
// fire up Inspector focused on the clicked element
inspect(e.target);
// prevent default action (e.g. do not click through links)
e.preventDefault();
// prevent the event from bubbling further through the DOM
e.stopImmediatePropagation();