This file contains hidden or 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 import forms | |
from django.core.validators import email_re | |
from django.utils.encoding import smart_unicode | |
from django.utils.translation import ugettext_lazy as _ | |
import re | |
# Наше поле для валидации | |
class ContactField(forms.Field): | |
def validate(self, value): |
This file contains hidden or 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
$objMail = new Lib_Sent(); | |
$objMail->to = array('email кому отсылаем письмо'); | |
$objMail->from = 'email от кого будет письмо'; | |
$objMail->subject = 'Заголовок письма'; | |
$objMail->body = 'Текст письма.'; | |
$objMail->add_attachment("Содержание атача. Предварительно нужно считать из файла", | |
"название файла", "application/octet-stream"); | |
$objMail->send(); |
This file contains hidden or 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
package | |
{ | |
import states.LiveState; | |
import states.PeerState; | |
import states.state.IConnection; | |
import flash.net.NetStream; | |
public class Connections | |
{ | |
private var peerState:PeerState; | |
private var liveState:LiveState; |
This file contains hidden or 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
//Функция вызывается при клике по кнопке | |
public function onClick(event:Event) : void | |
{ | |
// Пробегаем по массиву композиций и формируем массив для | |
// загрузки "urlLoader" | |
while (i < this.arrMusic.length) | |
{ | |
// Формируем Request | |
var urlRequest:URLRequest = new URLRequest(); | |
urlRequest.url = ''; // ссылка куда грузим файл |
This file contains hidden or 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.contrib.auth.models import User | |
user = User.objects.get(pk=5) | |
user.set_password('super-sekrit') | |
user.save() |
This file contains hidden or 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
/** | |
* SELECT2 | |
* | |
* Renders Select2 - jQuery based replacement for select boxes | |
* | |
* Requires an 'options.values' value on the schema. | |
* Can be an array of options, a function that calls back with the array of options, a string of HTML | |
* or a Backbone collection. If a collection, the models must implement a toString() method | |
*/ | |
Backbone.Form.editors.Select2 = Backbone.Form.editors.Base.extend({ |
This file contains hidden or 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.models.signals import post_init | |
def track_data(*fields): | |
""" | |
Tracks property changes on a model instance. | |
The changed list of properties is refreshed on model initialization | |
and save. | |
>>> @track_data('name') |
This file contains hidden or 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
[color] | |
ui = true | |
[user] | |
email = [email protected] | |
name = xxxx.xxxx | |
[giggle] | |
main-window-maximized = true | |
main-window-geometry = 430x176+343+25 | |
history-view-vpane-position = 285 | |
main-window-view = HistoryView |
This file contains hidden or 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 -*- | |
""" | |
Скрипт для скачивания музыки с сайта vkontakte.ru (vk.com) | |
Запуск: | |
python vkcom_audio_download.py | |
Принцип работы: | |
Скрипт проверяет сохраненный access_token. Если его нет или срок истек, | |
то открывается страница в браузере с запросом на доступ к аккаунту. |
This file contains hidden or 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 requests | |
r = requests.get('https://api.instagram.com/v1/users/search?q=mkispb&count=1&access_token=...') | |
user_id = None | |
for user in r.json()['data']: | |
if user['username'] == 'mkispb': | |
user_id = user['id'] |
OlderNewer