Skip to content

Instantly share code, notes, and snippets.

<?php
require_once './vendor/autoload.php';
$username = '%username%';
$password = '%password%';
$to = '%to%';
$body =
<<<BODY
@Invis1ble
Invis1ble / Twig\Node\Module.php
Created August 19, 2014 23:46
Twig compiler tweak: shows name of rendered template
protected function compileDisplayBody(Twig_Compiler $compiler)
{
$filename = $this->getAttribute('filename');
$compiler->write("echo '<!-- START " . $filename . (null !== $this->getNode('parent') ? " (has parent)" : '') . " -->';\n");
$compiler->subcompile($this->getNode('body'));
if (null !== $this->getNode('parent')) {
if ($this->getNode('parent') instanceof Twig_Node_Expression_Constant) {
$compiler->write("\$this->parent");
} else {
@Invis1ble
Invis1ble / check-ip.php
Last active January 21, 2017 03:47
Small console script for checking IP address
#!/usr/bin/env php
<?php
error_reporting(E_ALL);
ini_set('display_errors', 'On');
set_time_limit(0);
$triesNumber = 5;
$timeout = 5;
@Invis1ble
Invis1ble / MenuBuilder.php
Last active March 3, 2020 10:04 — forked from nateevans/MenuBuilder.php
KNP Menu Bundle with Bootstrap 3 and Font Awesome 4 (+ fixed several bugs)
<?php
namespace Acme\HelloBundle\Menu;
use Knp\Menu\FactoryInterface;
use Symfony\Component\DependencyInjection\ContainerAware;
class MenuBuilder extends ContainerAware
{
public function mainMenu(FactoryInterface $factory, array $options)
@Invis1ble
Invis1ble / regexp-date-validation.php
Last active March 15, 2017 09:15
Regular expression for date validation. Just for fun.
$pattern =
'/^
# year
(?!0000)\pN{2}(?:(
(?:
# leap year
([02468])|[13579])(?(2)[048]|[26]))(?(?<=00)(?(?<=[02468].{3})(?<=[048].{2})|(?<=[26].{2})))|
# non-leap year
\pN{2}
)
@Invis1ble
Invis1ble / TimezoneType.php
Last active March 25, 2017 21:47 — forked from mylk/TimezoneType.php
A modified Symfony Forms "timezone" type that also displays the timezone offset
<?php
/**
* A modified version of the original symfony form type that adds the timezone offset.
*
* Original version at:
* https://github.com/symfony/symfony/blob/2.7/src/Symfony/Component/Form/Extension/Core/Type/TimezoneType.php
*/
/*
* Installation:
@Invis1ble
Invis1ble / http-service-watchdog.php
Created September 6, 2017 13:44
Node.js HTTP service watchdog
#!/usr/bin/env php
<?php
ini_set('display_errors', 'On');
error_reporting(E_ALL);
set_time_limit(0);
@Invis1ble
Invis1ble / AppBundle.php
Last active November 23, 2017 07:59
Disable Symfony 3.3 AclVoter
<?php
namespace AppBundle;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use AppBundle\DependencyInjection\Compiler\DisableAclVoterPass;
@Invis1ble
Invis1ble / torrc
Last active December 24, 2021 22:09
tor node blacklist
ExcludeExitNodes {af},{am},{by},{cn},{hk},{hu},{ir},{kz},{kg},{md},{rs},{ru},{ro},{rs},{tj},{tm},{ua},{uz},{ve},{??}
ExcludeNodes {af},{am},{by},{cn},{hk},{hu},{ir},{kz},{kg},{md},{rs},{ru},{ro},{rs},{tj},{tm},{ua},{uz},{ve},{??}
@Invis1ble
Invis1ble / rxjs-diagrams.md
Created December 26, 2018 22:08 — forked from PCreations/rxjs-diagrams.md
Super Intuitive Interactive Diagrams to learn combining RxJS sequences by Max NgWizard K