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 -*- | |
import os | |
from Queue import Queue | |
from urlparse import urlparse | |
from threading import Thread, Lock | |
import requests | |
CHUNCK_SIZE = 8192 |
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 datetime | |
from functools import partial | |
converter_data = lambda d: datetime.datetime.strptime( | |
d, '%Y-%m-%d %H:%M:%S' | |
) | |
DATAS = map(converter_data, | |
"""2012-09-13 11:30:46 | |
2013-01-28 19:36:31 |
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
1. | |
MyModule = (function() { | |
var a, b, c; | |
a = function() { | |
}; | |
b = function() { | |
}; | |
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
""" | |
Para mais informações sobre o bug: | |
https://github.com/django-debug-toolbar/django-debug-toolbar/pull/298 | |
https://github.com/django-debug-toolbar/django-debug-toolbar/pull/316 | |
""" | |
# debug_toolbar/utils/tracking/db.py | |
class NormalCursorWrapper(object): |
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 re | |
import sys | |
import doctest | |
def pluft(itens, texto, limite=None, mais=None): | |
''' | |
Tipos dos parametros: | |
@param {iterable} itens |
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 datetime | |
def step_by_month(date): | |
if date.month == 12: | |
return datetime.date(date.year + 1, 1, 1) | |
return datetime.date(date.year, date.month + 1, 1) | |
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
ko.bindingHandlers.current = { | |
init: function(element, valueAccessor, allBindingsAccessor, viewModel) { | |
ko.utils.registerEventHandler(element, 'click', function() { | |
var observable = valueAccessor(), $element = $(element); | |
$element.parent().children().removeClass('current'); | |
if (observable() === viewModel) { | |
observable(null); | |
return; |
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
(function($, window, undefined) { | |
var _create_hidden_field, _dump_form_data; | |
$.syncPost = function(url, data) { | |
var form = $('<form></form') | |
.attr('method', 'post') | |
.attr('action', url); | |
_dump_form_data(form, data); |
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
ko.bindingHandlers.checkedForComplex = { | |
init: function(element, valueAccessor, allBindingsAccessor, viewModel) { | |
ko.utils.registerEventHandler(element, 'click', function() { | |
var observable = valueAccessor(); | |
observable(viewModel); | |
}); | |
}, | |
update: function(element, valueAccessor, allBindingsAccessor, viewModel) { | |
var value = ko.utils.unwrapObservable(valueAccessor()); |
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
''' | |
Toda vez que um usuario se autentica, a sessao dele | |
e completamente apagada. Porem, muitas vezes outros dados | |
nao referentes a autenticacao sao inseridos la. | |
Com esse backend, e possivel definir uma lista de | |
chaves e/ou uma funcao, que ira avaliar entre os | |
indices presentes no hashmap da sessao, quais devem | |
ser mantidos mesmo quando 'alguem der descarga'. |