Skip to content

Instantly share code, notes, and snippets.

Avatar

Ondřej Mirtes ondrejmirtes

View GitHub Profile
View HomepagePresenterTest.php
<?php
class HomepagePresenterTest extends TestCase
{
public function testLogout()
{
$presenter = new HomepagePresenter;
$this->login();
$this->assertTrue(Environment::getUser()->isLoggedIn());
View Apache + PHP na Ubuntu
sudo apt-get install apache2 php5-cgi libapache2-mod-fastcgi
cd /etc/apache2/mods-enabled/
sudo ln -s ../mods-available/actions.load
sudo ln -s ../mods-available/actions.conf
/etc/apache2/mods-enabled/fastcgi.conf:
====================
<IfModule mod_fastcgi.c>
AddHandler fastcgi-script .fcgi
View import.php
<?php
require_once(__DIR__ . '/dibi.min.php');
dibi::connect(array(
'driver' => 'postgre',
'host' => 'localhost',
'dbname' => 'database',
'username' => 'username',
'password' => '***',
View export.php
<?php
require_once(__DIR__ . '/dibi.min.php');
dibi::connect(array(
'driver' => 'postgre',
'host' => 'localhost',
'dbname' => 'database',
'user' => 'username',
'password' => '***',
View preg_replace_101.php
<?php
echo preg_replace(array(
'~\[b\](\w+)\[/b\]~',
'~\[i\](\w+)\[/i\]~i',
'~\[u\](\w+)\[/u\]~i',
'~\[s\](\w+)\[/s\]~i',
'~\[img\](\w+)\[/img\]~i',
'~\[url=(\w+)\](\w+)\[/url\]~i',
'~\[email\](\w+)\[/email\]~i',
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.
@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 ModelLoader.php
<?php
namespace Proj;
use Nette\Debug,
Nette\Environment,
PDO,
NotORM,
NotOrmPanel,
NotORM_Structure_Convention;
@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 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