Skip to content

Instantly share code, notes, and snippets.

<?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 / 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
@janpecha
janpecha / adminer.css
Created July 2, 2012 11:00
Adminer Skin (based on default Nette Adminer skin)
/* CSS by Brade - www.bradezone.com */
/* Icons by Hever [hev.cz] - June 2009, ver 0.1.3 */
/* Used icons: Silk icon set 1.3 by Mark James --- http://www.famfamfam.com/lab/icons/silk/ */
/* modified by davidgrudl */
/* modified by Jan Pecha, <janpecha@email.cz>, 2012-09-16 */
body {
background: #FFF;
color: #333;
@janpecha
janpecha / style.css
Created July 23, 2012 22:15
Piratskenoviny.cz Better Style
@import url('typro.css');
body {
border-top: 6px solid #222;
padding-bottom: 3em;
}
body * {
font-family: inherit !important;
font-size: inherit !important;
@janpecha
janpecha / ytdl
Created August 23, 2012 17:17
Shortcut for youtube-dl
#!/bin/bash
# saves the path to this script's directory
dir=` dirname $0 `
# absolutizes the path if necessary
if echo $dir | grep -v ^/ > /dev/null; then
dir=` pwd `/$dir
fi
@janpecha
janpecha / .htaccess
Last active October 9, 2015 14:37
Dynamické subdomény pomocí .htaccess
### Source code moved to https://github.com/janpecha/htaccess-subdomains/ ###
## Custom Error Pages
#ErrorDocument 404 /errors/e404.html
<IfModule mod_dir.c>
DirectorySlash Off
</IfModule>
Options -Indexes
@janpecha
janpecha / nakn.js
Last active October 9, 2015 23:37
Vylepšení formuláře pro zadání čísla parcely na nahlizenidokn.cuzk.cz - automaticky přejde na další políčko při stisknutí lomítka. ZATÍM JEN PRO OPERU.
/** Vylepseni formulare na Nahlizeni do katastru nemovistosti
*
* @author Jan Pecha, <janpecha@email.cz>
* @version 2013-08-12-2
* @license New BSD License
*/
function nah_SelectAreaFormHelper()
{
var el = document.getElementById('ctl00_bodyPlaceHolder_txtParcis');
@janpecha
janpecha / convert2mp3
Created September 2, 2012 17:23
Converting media files to MP3. Vyžaduje `ffmpeg`.
#!/bin/bash
# saves the path to this script's directory
dir=` dirname $0 `
# absolutizes the path if necessary
if echo $dir | grep -v ^/ > /dev/null; then
dir=` pwd `/$dir
fi
@janpecha
janpecha / Nette Action Method
Created September 5, 2012 16:14
Gedit3 Snippets for Nette Framework
public function action${1:Default}()
{
$0
}
@janpecha
janpecha / changes.txt
Created September 6, 2012 22:36
Hezčí vyhledávací pole na CSFD.cz
* 2012-09-09
- políčko nepřekrývá "uživatelskou zónu", když je uživatel přihlášen, ale zmenší svoji šířku.