Skip to content

Instantly share code, notes, and snippets.

def db_choices(table, id):
from django.db import connection as C
return C.cursor().execute(
'SELECT %s, LongTextA FROM %s' % (id,table)
) and C.cursor().fetchall()
@gvidon
gvidon / talks.py
Last active December 10, 2015 22:29
#!/usr/bin/env python
# Requirements: requests, lxml
import requests
from lxml import html
TALKNAME = "Caching Django"
COLOR = '\033[1;34m'
END = '\033[0m'
def talk_text((N, E)):
Я: Потому что в таких документах не принято использовать отчество. Я думал уникального номера моего свидетельства будет достаточно.
ОНА: нет, не верно, отчество обязательно. а вот номер св-ва нам не нужен в таких документах
<x-main id="properties-list" class="-module-items-list" hidden>
<x-captions></x-captions>
<x-list></x-list>
</x-main>
$('.touch-me')
.addClass('again')
.prop('hidden', false)
.html('I\'m touched!');
$('.btn').addClass('active')
.siblings().removeClass('active');
$('.option').addClass('active')
.siblings().removeClass('active')
.parent().addClass('expand');
$('#gallery-tip').after((
this.layout.settings = (new exports.SettingsFormView({app: this.app, parent: this})).render()
).el);
@gvidon
gvidon / gist:e6b03c261dbe0d190b93
Last active August 29, 2015 14:05
External call of component method
<body>
<tasks-list></tasks-list>
<script>window.addEventListener('polymer-ready', function() {
document.querySelector('tasks-list').reset(new Backbone.Collection([
{title: 'Minification deployment script'},
{title: 'Refine Vagrantfile'},
{title: 'Fix header markup'}
]))
})</script>
@gvidon
gvidon / gist:5cbdfa92a6a72da76489
Last active August 29, 2015 14:05
Component itself
<polymer-element name="tasks-list">
<template>
<link rel="stylesheet" href="style.css">
<template repeat="{{ tasks }}"><div>{{ title }}</div></template>
</template>
<script>Polymer({reset: function(collection){ this.tasks = collection.toJSON() }})</script>
</polymer-element>
this.$el.fadeOut((function() { this.remove() }).bind(this))