Skip to content

Instantly share code, notes, and snippets.

View hrach's full-sized avatar

Jan Škrášek hrach

View GitHub Profile
<?php
var_dump('12:00' > '11:59');
var_dump('11:30' > '11:29:00');
var_dump('11:30' > '11:30:00');
var_dump('11:30' >= '11:30:00');
@hrach
hrach / delete.php
Created March 19, 2011 16:27
Rekurzivní smazání adresáře v Nette
<?php
$dirContent = Finder::find('*')->from($directory)->childFirst();
foreach ($dirContent as $file) {
if ($file->isDir())
@rmdir($file->getPathname());
else
@unlink($file->getPathname());
}
@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 / form-macros.php
Created February 18, 2012 15:20
FormMacros old for Nette 1.0
<?php
namespace Nette\Templates;
use Nette;
use Nette\String;
use Nette\Forms\Form;
/**
* Form macros
*
@hrach
hrach / macros.php
Created March 10, 2012 00:20
Signaly Form macros
<?php
/**
* @license MIT license
*/
namespace Nextras;
use Nette,
Nette\Latte,
Nette\Latte\MacroNode,
@hrach
hrach / .bashrc
Last active October 12, 2016 12:07
Git config
alias gui='git gui&'
alias gitk='gitk --all &'
source /c/dev/git-bash-tools/completion.bash # find it in your git installation path
hg_ps1() {
hg prompt "{ {branch}}{ at {bookmark}}{{status}}" 2> /dev/null
}
function color_my_prompt {
@hrach
hrach / composer.bat
Created September 24, 2012 20:52
Composer runnery na windows (SH verze pro Git bash)
@echo off
if "%PHPBIN%" == "" set PHPBIN=php.exe
"%PHPBIN%" "C:/Program Files (x86)/wamp/bin/php/php5.4.6/composer.phar" %*
@hrach
hrach / gist:3947722
Created October 24, 2012 18:00
markdown code source
```
```abc
```
$('.ameta').each(function() {
var i = $(this).find('.a').text();
i = i.substring(0, i.length - 3).replace(',','');
var d = $(this).find('.d').text();
d = d.substring(0, d.length - 3).replace(',','');
$(this).parents('li').data('rank', i - d);
});
var l = $('.contrib-data');
var list = l.find('li').sort(function(a,b){ return $(b).data('rank') - $(a).data('rank'); });
l.find('li').remove();
@hrach
hrach / query.sql
Last active December 13, 2015 23:19
PostgreSQL subselect
CREATE TABLE book (
id serial NOT NULL,
author_id int NOT NULL,
translator_id int,
title varchar(50) NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE book_tag (
book_id int NOT NULL,