Skip to content

Instantly share code, notes, and snippets.

<?php
use Nette;
/**
* @author Jáchym Toušek <enumag@gmail.com>
*/
class SessionPanelExtension extends Nette\Config\CompilerExtension
{
@enumag
enumag / IvoryFilter.php
Last active December 19, 2015 07:09
Ivory Filter for Arachne Resources
<?php
namespace Media33;
class IvoryFilter extends \Nette\Object implements \Arachne\Resources\IFilter
{
/** @var \Ivory\Compiler */
protected $compiler;
@enumag
enumag / AnnotationsExtension.php
Last active December 19, 2015 03:29
Doctrine Annotations Extension
<?php
/**
* This file is part of the Kdyby (http://www.kdyby.org)
*
* Copyright (c) 2008 Filip Procházka (filip@prochazka.su)
*
* For the full copyright and license information, please view the file license.txt that was distributed with this source code.
*/
@enumag
enumag / formMessages.js
Created May 31, 2013 19:44
Form messages
/**
* Display error message.
*/
Nette.addError = function(elem, message) {
var el = $(elem);
el.closest('.control-group').addClass('error');
el.closest('.controls').children('.help-inline').remove();
el.closest('.controls').append(' ', $('<p>', {
text: message,
'class': 'help-inline'
@enumag
enumag / UserFormFactory.php
Created February 4, 2013 22:03
FormFactory
<?php
namespace App;
class UserFormFactory extends \Nette\Object
{
/**@var \Model\UserRepository */
private $userRepository;
<?php
namespace App;
class UserStorage extends \Nette\Http\UserStorage
{
/** Log-out reason */
const IDENTITY_CHANGED = 16;
@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)
@enumag
enumag / gist:1944602
Created February 29, 2012 21:35
Incrementation test
<?php
class Timer {
public static $time = array();
public static $last;
public static function start($name = NULL) {
static $i = 0;
@enumag
enumag / mixins.iss
Created February 16, 2012 21:51
ISS mixins
@gradient-x($left, $right: $left) {
background-image: -o-linear-gradient(left,$left,$right);
background-image: -ms-linear-gradient(left,$left,$right);
background-image: -moz-linear-gradient(left,$left,$right);
background-image: -webkit-gradient(linear,left top,right top,color-stop(0,$left),color-stop(1,$right));
$ie: 'progid:DXImageTransform.Microsoft.gradient(startColorStr=' . iergba($left) . ',EndColorStr=' . iergba($right) . ',GradientType=1)';
%filter: $ie;
-ms-filter: $ie;
}
@enumag
enumag / gist:1847959
Created February 16, 2012 21:23
ISS helper
/**
* @param string
* @param string
* @return bool
*/
function issCheck($dir, $out) {
if (!file_exists($out)) {
return TRUE;
}
$time = filemtime($out);