Skip to content

Instantly share code, notes, and snippets.

Avatar

Ondřej Mirtes ondrejmirtes

View GitHub Profile
@ondrejmirtes
ondrejmirtes / gist:3129530
Created Jul 17, 2012
Array contains item starting with X
View gist:3129530
<?php
$array = array_filter(array('yx', 'y', 'z'));
$exists = count(array_filter($array, function($item) {
return substr($item, 0, 1) === 'x';
})) > 0;
@ondrejmirtes
ondrejmirtes / in_array.php
Created May 24, 2012
PHP WTFs - in_array()
View in_array.php
<?php
$keys = array(
'scheme',
'user',
'pass',
'host',
'port',
'path',
'query',
View mb_str_split.php
<?php
function mb_str_split($string,$string_length=1) {
if(mb_strlen($string) > $string_length || !$string_length) {
do {
$c = mb_strlen($string);
$parts[] = mb_substr($string,0,$string_length);
$string = mb_substr($string,$string_length);
}while(!empty($string));
} else {
View .bash_profile
export PS1="\u:\W $ "
#GIT bash 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="\u:\W "
export PS1=$PS1$(echo -en "\[\033[00;37m\]$BRANCH \[\033[00m\]")
View github.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC1HU7tOnkxGkEG417gQUGBpIudcaRHRNIymYwRLaYdjYLmgC5ds0aMO1i71Qh/p/AT9877DaDmXZKHQgesypc9Zjcrlz4mTA4WI8oMu14yXU8uoMJg4IJ7VM4ig5ywADUf452y/HDdxRh1XEpAp8tbCGtFYJIUj6KV7sCRl/yTIwzEr29bSQKOh8qJrY2NcCZmwEyP2p8SqZsGQBmZWdWzeVvtxDZRZWOjcUixLvJAsPAIAWL3Bgjonb/TKj+YyIOfjbEZ+ZXceucgjvTnqEaCxeCx/OgKM+bjPjNYwjjxtBRqmHzrZcE7LeLUFCSC9z8dj6SW5MGNcGN4zlQIZr+N ondrej@eduroam-95.felk.cvut.cz
View HomepageTest.java
package fm;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import static org.junit.Assert.*;
public class HomepageTest {
@Test
@ondrejmirtes
ondrejmirtes / main.js
Created Jun 29, 2011
Curvy corners - různá nastavení
View main.js
curvyCorners({
tl: { radius: 5 },
tr: { radius: 5 },
bl: { radius: 5 },
br: { radius: 5 },
antiAlias: true
}, '.box,.items,#footer .up,.grey-box,#navigation ul');
curvyCorners({
tl: { radius: 20 },
View ModelLoader.php
<?php
namespace Proj;
use Nette\Debug,
Nette\Environment,
PDO,
NotORM,
NotOrmPanel,
NotORM_Structure_Convention;
@ondrejmirtes
ondrejmirtes / ConsoleDebug.php
Created Mar 18, 2011
PHP Nette CLI comfortable debugging
View ConsoleDebug.php
<?php
namespace Tools;
use Nette\Debug;
use Nette\Environment;
use Nette\Finder;
/**
* Shows exceptions thrown in CLI mode in browser.
View gist:875109
I am writing my bachelor thesis,
I am working hardly as a developer,
my first CMS was called Nemesis.
it didn't work much better.
I am stuck with the PHP language,
I see ASP as an epic failage,
I tried Java EE last month,
that's when I needed to change my cloth.