Skip to content

Instantly share code, notes, and snippets.

View SmithWebster's full-sized avatar

Andrew SmithWebster

  • NDA
  • Ukraine, Odessa
View GitHub Profile
@SmithWebster
SmithWebster / README.md
Created December 14, 2016 08:34 — forked from dciccale/README.md
Tiny Cross-browser DOM ready function in 111 bytes of JavaScript

DOM Ready

Tiny Cross-browser DOM ready function in 111 bytes of JavaScript.

<?php
function parseSms($content) {
$result = [
'code' => null,
'sum' => null,
'account' => null,
];
$code = null;
# -*- 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')
# -*- 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)
@SmithWebster
SmithWebster / main.py
Last active February 22, 2016 21:00
remove unclosed parentheses
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):