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
function setInputSelection(input, startPos, endPos) { | |
if (input.setSelectionRange) { | |
input.focus(); | |
input.setSelectionRange(startPos, endPos); | |
} else if (input.createTextRange) { | |
var range = input.createTextRange(); | |
range.collapse(true); | |
range.moveEnd('character', endPos); | |
range.moveStart('character', startPos); | |
range.select(); |
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 Event(models.Model): | |
pass | |
class EventContent(models.Model): | |
event = models.OneToOneField(Event, primary_key=True, related_name='%(class)s') | |
type = 'default_event' |
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
Handlebars.registerHelper('trans', function(fn) { | |
return gettext(fn(this)); | |
}); |
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 | |
import random | |
import smtplib | |
from email.mime.text import MIMEText | |
from email.Header import Header | |
from email.Utils import formataddr | |
# settings | |
charset = 'UTF-8' | |
subject = u'Анонимный Дед Мороз, Почтовая служба Деда Мороза' |
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
// | |
// VERSION 1.4.3 | |
(function () { | |
resetProperty = function ( obj ) { | |
for ( var property in obj ) { | |
obj[property] = undefined; | |
} | |
}; |
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 | |
import smtplib | |
from email.mime.text import MIMEText | |
from email.Header import Header | |
from email.Utils import formataddr | |
# settings | |
charset = 'UTF-8' | |
subject = u'Тема' | |
sender_addr = 'mail@domain.com' |
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
class BehaviorSource(object): | |
def get_behavior(self, unit_data, state_data): | |
raise NotImplementedError | |
class LocalAIBehaviorSource(BehaviorSource): | |
pass | |
class GlobalAIBehaviorSource(BehaviorSource): |
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
# -*- encoding: utf-8 -*- | |
import logging | |
from twisted.python import log | |
from twisted.trial import unittest | |
from twisted.internet import defer, reactor, protocol | |
from twisted.internet.protocol import Protocol, Factory | |
observer = log.PythonLoggingObserver() | |
observer.start() |
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 functools import wraps | |
def check_authorization(f): | |
@wraps(f) | |
def wrapper(*args, **kwargs): | |
if get_user_id(request): | |
response = f(*args, **kwargs) | |
else: | |
response = redirect('/') |
OlderNewer