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
def enem2ufmg(nota): | |
if 0 <= nota <= 118.2600: | |
resultado = 0.005306951 * nota | |
elif 118.2600 < nota < 936.1355: | |
resultado = 0.0 | |
resultado += -1.7988096645 * nota | |
resultado += (4.18317311423 / 10 ** 2) * nota ** 2 | |
resultado -= (4.01229829463 / 10 ** 4) * nota ** 3 |
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 import SubfieldBase | |
from django.db.models.fields import PositiveIntegerField | |
class MultipleOptions(object): | |
def __init__(self, options, value=None): | |
self.options = options | |
try: | |
self._value = int(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
''' | |
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'. |
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
(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.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
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
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
""" | |
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
1. | |
MyModule = (function() { | |
var a, b, c; | |
a = function() { | |
}; | |
b = function() { | |
}; | |
OlderNewer