Tiny Cross-browser DOM ready function in 111 bytes of JavaScript.
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 | |
function parseSms($content) { | |
$result = [ | |
'code' => null, | |
'sum' => null, | |
'account' => null, | |
]; | |
$code = null; |
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
# -*- coding: utf-8 -*- | |
from django.core.management.base import BaseCommand, CommandError | |
from project.main.models import Product | |
class Command(BaseCommand): | |
help = u'Products actions' | |
def handle(self, *args, **options): | |
products = Product.objects.values('category__name', 'name', 'price') |
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
# -*- coding: utf-8 -*- | |
from __future__ import unicode_literals | |
from django.db import models | |
# Create your models here. | |
class Category(models.Model): | |
name = models.CharField('Группа товара', max_length=64) |
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
import re | |
import sys | |
# 'up' is unclosed-parentheses | |
def cut_up_regexp(text): | |
pattern = re.compile(r'\([^\)]+$') | |
return pattern.sub('', text) | |
def cut_up(text): |