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.models.fields.files import ImageField, ImageFieldFile | |
from PIL import Image | |
import os | |
def _add_thumb(s): | |
""" | |
Modifies a string (filename, URL) containing an image filename, to insert | |
'.thumb' before the file extension (which is changed to '.jpg'). | |
""" | |
parts = s.split('.') |
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
$result = Authentication::loginUser($_REQUEST["userID"],$_REQUEST["userPass"]); | |
if (($result["status"] !== false) and ($result !== false)){ | |
$_SESSION["userTK"] = $result["userTK"]; // Token de autenticação | |
$_SESSION["userFirstName"] = $result["userFirstName"]; // Primeiro nome | |
$_SESSION["userLastName"] = $result["userLastName"]; // Ultimo nome | |
$_SESSION["userMail"] = $result["userMail"]; // Email | |
$response["status"] = true; | |
} |
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 isisdm.mapper import Document | |
from isisdm.mapper import TextField, NumberField, DateTimeField | |
class Livro(Document): | |
titulo = TextField(required=True, repeatable=True) | |
data = DateTimeField() | |
total_paginas = NumberField() |
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 | |
""" | |
>>> Dispatcher.handle_for_me('the animal who says "auau"') | |
handled by a Dog instance! | |
>>> Dispatcher.handle_for_me('the animal who says "miau"') | |
handled by a Cat instance! | |
>>> Dispatcher.handle_for_me('the animal who says "hakuna matata"') |
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
abstract class Animal { | |
public Animal successor = null; | |
abstract public void processRequest(String request); | |
} |
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
package br.padroes.gof.comportamental.strategy; | |
public class ClienteStrategy { | |
public static void main(String[] args) { Context context; | |
// Three contexts following different strategies |
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
package br.padroes.gof.comportamental.state; | |
public class AcceptedState implements State { | |
public void grantPermission(StateContext ctx) { | |
} | |
public void requestPermission(StateContext ctx){ |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE trials SYSTEM "http://localhost:8000/xml/opentrials.dtd"> | |
<trials version="1"> | |
<trial language="en" | |
status="published" | |
date_registration="2011-07-06" | |
created="2011-06-16" | |
updated="2011-08-30"> |
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
import couchdbkit | |
db_uri = 'http://localhost:5984' | |
db_name = 'scielobooks' | |
def get_monographs(): | |
try: | |
monographs = db.view('scielobooks/books') | |
except couchdbkit.ResourceNotFound: | |
raise exceptions.NotFound() |
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
import couchdbkit | |
db_uri = 'http://localhost:5984' | |
db_name = 'scielobooks' | |
def get_monographs(): | |
try: | |
monographs = db.view('scielobooks/books') | |
except couchdbkit.ResourceNotFound: | |
raise exceptions.NotFound() |
OlderNewer