Skip to content

Instantly share code, notes, and snippets.

View mhujer's full-sized avatar
🏠
Working remotely

Martin Hujer mhujer

🏠
Working remotely
View GitHub Profile
@mhujer
mhujer / index.php
Created September 10, 2011 10:45
FirePHP example for Google Chrome
<?php
require_once('FirePHPCore/fb.php');
fb('Hello Chrome!', FirePHP::WARN);
fb(array(
'first' => 'line',
'second' => array(
1,
2,
3 => array(
'foo',
@mhujer
mhujer / Module.php
Created December 10, 2011 18:35
Laděnka Module for ZF2 (proof of concept)
<?php
namespace Ladenka;
use Zend\Debug;
use Zend\Module\Consumer\AutoloaderProvider,
Zend\EventManager\StaticEventManager,
Nette\Diagnostics\Debugger;
@mhujer
mhujer / gist:2158624
Created March 22, 2012 14:27
Unexpected PHP behaviour when comparing number strings.
<?php
$a = '00020001000200120005';
$b = '00020001000200120003';
var_dump($a == $b); //true
var_dump($a === $b); //false
var_dump(strcmp($a, $b)); //1
@mhujer
mhujer / gist:2730719
Created May 19, 2012 12:43
Found 6 Zend Framework issues during ZF training
Hi.
On this Thursday and Friday (17th and 18th May 2012), I was giving Zend Framework training. We went through all the stuff necessary for creating ZF apps. Surprisingly, even in those often basic features, my students or me found some issues:
1) http://framework.zend.com/issues/browse/ZF-10690 this one was fixed just in ZF2, but not in ZF 1 trunk (and was marked as Resolved)
2) http://framework.zend.com/issues/browse/ZF-10803 We stumbled accross this one when working on simple decorators
3) http://framework.zend.com/issues/browse/ZF-8211 When we created a base controller, Zend_Tool stopped working (this was also "Resolved")
4) http://framework.zend.com/issues/browse/ZF-12213 During practice of writing own validators, one student was getting erorrs, beacuse of usage of $this->_error() without parameters. He said he copied this part from manual :)
5) http://framework.zend.com/issues/browse/ZF-12214 When setting up basic file cache, we stumbled accross not very good error message when invalid directory is pro
@mhujer
mhujer / gist:3046301
Created July 4, 2012 09:18
ZF2 failing tests on Windows (version d71b9ff712f2cebf406ea559e55f691404debfe6)
Zend/Acl:
PHPUnit 3.6.11 by Sebastian Bergmann.
Configuration read from I:\xampp\zf2\tests\phpunit.xml
................................................................. 65 / 68 ( 95%)
...
Time: 0 seconds, Memory: 4.75Mb
@mhujer
mhujer / gist:4488331
Created January 8, 2013 21:55
E-maily přes seznam smtp padají do spamu - myslím, že vím proč
Přítelkyně narazila na tohle - http://napoveda.seznam.cz/forum/viewtopic.php?f=14&t=14998 -
emaily poslané z outlooku přes smtp se vrátí a v hlavičce je:
Received: from adela (kxjema00.knet.vse.cz [146.102.105.99])
by email-relay1.ng.seznam.cz (Seznam SMTPD UNKNOWN@UNKNOWN) with ESMTP;
Tue, 08 Jan 2013 22:29:20 +0100 (CET)
From: =?iso-8859-2?B?QWTpbGEgSmVtZWzta2924Q==?=
---snip---
X-Smtpd: UNKNOWN@UNKNOWN
X-Session: 2
@mhujer
mhujer / git-svnlike-export.sh
Last active December 10, 2015 23:55
Export files from GIT repository to SVN-like structure
#!/bin/bash
# git-svnlike-export.sh
#
# Simple scripts that allows you to export GIT repository to SVN-like strukture
#
# I created it to check that our SVN repo was properly migrated to GIT.
# I than compared SVN directory with this export with Total Commander's
# synchronize directories feature
#
@mhujer
mhujer / gist:5418848
Created April 19, 2013 08:06
Nastavení AdBlock pro Bonami.cz
Pokud vám občas někdo pošle odkaz na Bonami.cz a vy se tam nechcete registrovat, tak to jde snadno řešit.
Běžte do Adblock -> Options -> Customize -> Manually edit your filters "Edit" a nakonec přidejte toto:
www.bonami.cz##DIV[class="loginOverlay-container"]
www.bonami.cz##DIV[class="overlay"]
@mhujer
mhujer / fix-photos-names-morava.php
Last active December 20, 2015 05:29
Useful snippets for renaming photos from different cameras
<?php
/**
* Useful snippets for renaming photos from different cameras
*/
function fixUppercaseExtensions()
{
foreach (glob('*.JPG') as $photo) {
$newName = str_replace('.JPG', '.jpg', $photo);
rename($photo, $newName);
echo sprintf('Renamed %s -> %s', $photo, $newName) . PHP_EOL;
@mhujer
mhujer / .bashrc
Last active April 27, 2016 09:25 — forked from VasekPurchart/.bashrc
GIT global configuration and enhancements
# used by Git (commit messages, rebase, ...)
export EDITOR=vim
# GIT bash current branch
# by HABR (modified by Dundee)
export PSORIG="$PS1"
function GITBRANCH() {
BRANCH="$(git branch 2>/dev/null | grep '*' | cut -d" " -f2-)"
if [ -n "$BRANCH" ] ; then
export PS1=$PSORIG$(echo -en "\[\033[01;33m\]$BRANCH > \[\033[00m\]")