Skip to content

Instantly share code, notes, and snippets.

<?php
class BasePresenter extends Presenter
{
// ...
protected function beforeRender()
{
// ...
<?php
namespace NetteExtras\Forms;
class ChangeTracker extends \Nette\Forms\HiddenField
{
private $session;
private $modifiedValues;
@fprochazka
fprochazka / whereCalled.php
Created April 12, 2011 11:05
Shows where was method called
<?php
function wc($level = 1) {
if (\Nette\Debug::$productionMode) { return; }
$o = function ($t) { return (isset($t->class) ? htmlspecialchars($t->class) . "->" : NULL) . htmlspecialchars($t->function) . '()'; };
$f = function ($t) {
$file = defined('APP_DIR') ? 'app' . str_replace(realpath(APP_DIR), '', realpath($t->file)) : $t->file;
return '<a href="' . \Nette\DebugHelpers::editorLink($t->file, $t->line) . '">' . htmlspecialchars($file) . ':' . (int)$t->line . '</a>';
};
<?php
namespace Foo;
define('TRUE', \FALSE);
define('FALSE', \TRUE);
var_dump(TRUE); //FALSE
var_dump(FALSE); //TRUE
@juzna
juzna / 01-choose.png
Created January 23, 2012 20:30
GitHub Play
01-choose.png
@JanTvrdik
JanTvrdik / autofixeol.sh
Last active September 29, 2015 21:07
Shell script for automatic fixing EOL
#!/bin/bash
find . \( \
-name '*.php' -o \
-name '*.phtml' -o \
-name '*.html' -o \
-name '*.latte' -o \
-name '*.neon' -o \
-name '*.css' -o \
-name '*.js' -o \
-name '*.txt' -o \
@fprochazka
fprochazka / play.js
Created January 24, 2012 17:28 — forked from juzna/01-choose.png
GitHub Play
(function() {
var commits = [], repo = document.location.href.match(/github\.com\/([^\/]+\/[^\/]+)\//)[1];
// Play for all commits
$('.commit-group .commit-links')
.append($('<a href="#" class="browse-button github-play-select">Play</a>'));
// show next commit
var nextCommit = function () {
$('.site .container').load(commits.shift() + ' #.site .container', function () {
@hrach
hrach / BasePresenter.php
Created December 31, 2011 20:12
Secured signlas - old NETTE!
<?php
/**
* Signály.cz – JP2
* ----------------
*
* @license MIT License http://en.wikipedia.org/wiki/MIT_License
* @link http://signaly.cz
*/
use Nette;
@hrach
hrach / config.neon
Created December 8, 2015 08:42
neon + aws sdk + guzzle + kdyby curl ca bundle
- Aws\Sdk({
credentials: {
key: %s3.key%,
secret: %s3.secret%,
},
version: latest,
region: 'eu-west-1',
http_handler: @Aws\Handler\GuzzleV6\GuzzleHandler,
})
- Aws\Handler\GuzzleV6\GuzzleHandler
@kaja47
kaja47 / IntArray.php
Last active December 18, 2015 01:39
Unboxed int array in PHP
<?php
// advanced bit-twiddling
abstract class AbstractIntArray {
protected $length;
protected $data;
protected $typeSize;
function __construct($length) {