Skip to content

Instantly share code, notes, and snippets.

@janpecha
janpecha / verifyIC.php
Created February 16, 2023 06:16 — forked from dg/verifyIC.php
Ověření rodného čísla a IČ
<?php
function verifyIC($ic)
{
// be liberal in what you receive
$ic = preg_replace('#\s+#', '', $ic);
// má požadovaný tvar?
if (!preg_match('#^\d{8}$#', $ic)) {
return FALSE;
@janpecha
janpecha / leanmapper-entity-test.php
Last active July 24, 2020 09:56
Lean Mapper entity testing
<?php
// LeanMapper 3.4.2
require __DIR__ . '/vendor/autoload.php';
class AppMapper extends \LeanMapper\DefaultMapper
{
protected $defaultEntityNamespace = '';
}
@janpecha
janpecha / SenderFacade.php
Last active June 20, 2020 08:19
Model with LeanMapper + Nette Forms
<?php
namespace App\Model;
use Libs\IDateTimeFactory;
class SenderFacade
{
/** @var IDateTimeFactory */
@janpecha
janpecha / styles.css
Created June 28, 2014 19:16
Satis Theme tunning
/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.8.0r4
*/
html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var,optgroup{font-style:inherit;font-weight:inherit;}del,ins{text-decoration:none;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:baseline;}sub{vertical-align:baseline;}legend{color:#000;}input,button,textarea,select,optgroup,option{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;}input,button,textarea,select{*font-size:100%;}body{font:13px/1.231 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-sma
<?php
// $foo = Mage::getModel('.....
// $bar = Mage::getModel('.....
$transaction = Mage::getModel('core/resource_transaction');
$transaction->addObject($foo);
$transaction->addObject($bar);
$transaction->save(); // runs save on all objects. On error -> rollback
@janpecha
janpecha / index.html
Last active December 25, 2015 10:49
MiniTypro - a tiny CSS framework
<!DOCTYPE html>
<html lang="cs">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="minitypro.css">
<title>MiniTypro - basic example</title>
</head>
<body>
@janpecha
janpecha / readme.md
Last active December 20, 2015 22:28
Závislé scrollbary u HTML elementů - když se vertikálně scroluje s jedním, zároveň se automaticky scroluje i v druhém (samozřejmě v poměru vzhledem k výšce (obsahu)).

Závislé scrollbary u HTML elementů - když se vertikálně scroluje s jedním, zároveň se automaticky scroluje i v druhém (samozřejmě v poměru vzhledem k výšce (obsahu)).

Pro fungující navázání event handlerů v příkladu vyžaduje mini-JS-knihovnu Jasno (https://github.com/janpecha/jasno). Lze nahradit voláním addEventListener() (v Opeře, FF, Chrome,... ne v IE).

Live demo: http://janpecha.iunas.cz/demos/scrollbars/

@janpecha
janpecha / black_list_gen.php
Last active October 14, 2015 02:18
JP's domain blacklist
<?php
/** BlackList Generator from domain list
*
* @author Jan Pecha, <janpecha@email.cz>
* @version 2013-01-26-1
*/
$content = file($_SERVER['argv'][1]);
$domains = array();
@janpecha
janpecha / youtube.css
Last active October 13, 2015 17:58
Youtube design tuning
/** Youtube Tuning CSS
* @author Jan Pecha, 2012-2013
* @license New BSD License
* @version 2013-08-16-1
*/
/*player-width player-height*/
/* Zarovnani na stred */
#yt-masthead, #page-container, #alerts, #footer-hh, #masthead-subnav, #content-container {
width: 1124px !important;
margin: 0 auto !important;
@janpecha
janpecha / gist:3717794
Created September 13, 2012 21:25
Piškvorky :)
Private Sub Form_Load()
' Naberem promenne
xxx = False
'' Naplneni pomocnych poli
relX(0) = 1
relX(1) = 1
relX(2) = 0
relX(3) = -1
'---
relY(0) = 0