View models.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
class BaseFileField(models.FileField): | |
""" | |
Allow to define abstract class and don't hardcode upload_to path for each FileField | |
class BaseFile(models.Model): | |
name = models.CharField( |
View models.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
class FileAppIdFolderMixin(models.Model): | |
def upload_to(self, filename): | |
return '{app}/{id}/{filename}'.format( | |
app=self._meta.app_label, | |
id=self.id, | |
filename=filename |
View colorful.theme.bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Bash-it theme inspired by theme "Sexy" and "Bobby" themes | |
# https://gist.github.com/hansek | |
if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then | |
export TERM=gnome-256color | |
elif [[ $TERM != dumb ]] && infocmp xterm-256color >/dev/null 2>&1; then | |
export TERM=xterm-256color | |
fi | |
if [ -t 1 ]; then |
View solarized.theme.bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Bash-it theme based on Solarized colors | |
# https://gist.github.com/hansek | |
if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then | |
export TERM=gnome-256color | |
elif [[ $TERM != dumb ]] && infocmp xterm-256color >/dev/null 2>&1; then | |
export TERM=xterm-256color | |
fi | |
# Solarized |
View hansek.theme.bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Hansek Bash Prompt, inspired by theme "Sexy" and "Bobby" | |
# thanks to them | |
if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then | |
export TERM=gnome-256color | |
elif [[ $TERM != dumb ]] && infocmp xterm-256color >/dev/null 2>&1; then | |
export TERM=xterm-256color | |
fi | |
if tput setaf 1 &> /dev/null; then |
View gist:8594656
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT od.product_id, | |
pl.name, | |
pl.link_rewrite, | |
p.reference, | |
i.id_image, | |
product_shop.show_price, | |
cl.link_rewrite category, | |
p.ean13, | |
COUNT(*) AS product_count | |
FROM ps_order_detail od |
View gist:8594678
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT o.id_order | |
FROM ps_orders o | |
LEFT JOIN ps_order_detail od ON (od.id_order = o.id_order) | |
WHERE o.valid = 1 | |
AND od.product_id = 991 |
View coext.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var COEX = function(config) { | |
config = config || {}; | |
COEX.superclass.constructor.call(this, config); | |
}; | |
Ext.extend(COEX, Ext.Component, { | |
page: {}, | |
window: {}, | |
grid: {}, |
View workshops.structure.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE IF NOT EXISTS `cx_workshop` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`title` varchar(250) NOT NULL, | |
`date` int(20) NOT NULL DEFAULT '0', | |
`time_start` time DEFAULT NULL, | |
`time_end` time DEFAULT NULL, | |
`capacity` int(11) NOT NULL, | |
`description` text NOT NULL, | |
`status` int(11) NOT NULL, | |
`annex` varchar(250) NOT NULL, |
View CMPtest.snippet.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// inicializace balíčku | |
$path = MODX_CORE_PATH .'components/workshops/'; | |
$result = $modx->addPackage('workshops', $path .'model/', 'cx_'); | |
if (! $result) { | |
return 'Failed to add package'; | |
} | |
else { | |
$output = '<p>Package added</p>'; |
NewerOlder