- 2 Flesh Golems (Block, Mighty Blow, Guard, Break Tackle)
- 2 Wights
- 1 Werewolf
- 1 Ghoul
- 5 Zombies
- 3 RR -> Werewolf -> Ghoul
import Foundation | |
struct TeamStats { | |
let elements: [TeamStat] | |
} | |
extension TeamStats: Decodable { | |
enum CodingKeys: String, CodingKey { | |
case overallteamstandings | |
} |
redis.call('ZUNIONSTORE', KEYS[1], 1, KEYS[2]) | |
local lbound, ubound = ARGV[1], ARGV[2] | |
if lbound ~= '-inf' then | |
lbound = lbound:sub(1, 1) == '(' and lbound:sub(2) or '('..lbound | |
redis.call('ZREMRANGEBYSCORE', KEYS[1], '-inf', lbound) | |
end | |
if ubound ~= '+inf' then | |
ubound = ubound:sub(1, 1) == '(' and ubound:sub(2) or '('..ubound | |
redis.call('ZREMRANGEBYSCORE', KEYS[1], ubound, '+inf') | |
end |
//require jquery.cookie.js | |
var csrftoken = $.cookie('csrftoken'); | |
function csrfSafeMethod(method) { | |
return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method)); | |
} | |
$.ajaxSetup({ | |
crossDomain: false, | |
beforeSend: function(xhr, settings) { | |
if (!csrfSafeMethod(settings.type)) { | |
xhr.setRequestHeader("X-CSRFToken", csrftoken); |
from time import time | |
from django.conf import settings | |
from statsd import Connection, Timer | |
class StatsDStopWatchMiddleware(object): | |
def __init__(self): | |
connection = Connection( | |
host=getattr(settings, 'STATSD_HOST', None), | |
port=getattr(settings, 'STATSD_PORT', None) |
#Doctest isn't palindrome# A brief introduction about [Test-driven development][1] using [doctest][2] @ [Mobile World Congress 2013][3] in Barcelona.
##Abstract## Talking about Web development, requirements are fickle and ever-changing. The most trivial request could be the straw that breaks the camel's back. [Test-driven development][1] ( TDD ) is the best weapon in our hands; the [doctest][2] is the simplest tool to explore its efficiency. And let's face it, palindromes fascinate everyone.
###Issue != Requirements### Everyday a developer has to face the problem to understand his/her requestors (employers, line managers, collegues). Unfortunately the request isn't usually clear and comprehensive, because sometimes the problem is not clear to those who ask us to solve it. Language barriers can make the problem worse. However, an example is more enlightening than thousand words. And what if we could write these examples in a language more related to us?
from django import http | |
from django.conf import settings | |
XS_SHARING_ALLOWED_ORIGINS = getattr(settings, 'XS_SHARING_ALLOWED_ORIGINS', '*') | |
XS_SHARING_ALLOWED_METHODS = getattr(settings, 'XS_SHARING_ALLOWED_METHODS', ['POST', 'GET', 'OPTIONS', 'PUT', 'DELETE', 'PATCH']) | |
XS_SHARING_ALLOWED_HEADERS = getattr(settings, 'XS_SHARING_ALLOWED_HEADERS', ['Content-Type', 'Date', 'Location', 'Server', 'Vary']) | |
class XsSharing(object): | |
def process_request(self, request): | |
if 'HTTP_ACCESS_CONTROL_REQUEST_METHOD' in request.META: |
#TDD and Unittest#
Ispirato al tutorial di Jason Diamond:
- [Test-Driven Development in Python - Parte 1][1]
- [Test-Driven Development in Python - Parte 2][2]
##Problema##
from multiprocessing import Process | |
from flask import Flask | |
import requests | |
import unittest2 as unittest | |
app = Flask(__name__) | |
@app.route('/hello/') | |
@app.route('/hello/<user>') |
import hashlib | |
import StringIO | |
import httplib | |
import urllib2 | |
import os | |
import errno | |
import time | |
from threading import RLock | |
cache_lock = RLock() |