I hereby claim:
- I am dirceu on github.
- I am dirceu (https://keybase.io/dirceu) on keybase.
- I have a public key whose fingerprint is A579 3DB2 9503 B761 4E56 230C 6556 5D74 27B9 EF6E
To claim this, I am signing this object:
# Author: Dirceu Pereira Tiegs <dirceutiegs@gmail.com> | |
# | |
# Script to roll dices (used to play D&D). Example: | |
# | |
# >> require 'dices' | |
# >> 3.d6 | |
# => 10 | |
# >> 3.d6+7 | |
# => 14 | |
# >> 1.d4+2.d8+1.d12+3 |
# Author: Dirceu Pereira Tiegs <dirceutiegs@gmail.com> | |
# | |
# Script usado para gerar nomes de tavernas | |
# | |
class Array | |
def pick | |
self.sort_by {rand}[0] | |
end | |
end |
I hereby claim:
To claim this, I am signing this object:
ibook:~ dirceu$ # primeiro criamos uma working copy do repositório | |
ibook:~ dirceu$ # isso pode demorar porque o git copia o projeto TODO, | |
ibook:~ dirceu$ # todas as revisões | |
ibook:~ dirceu$ git-svn clone https://dev.xxxxx/projetofoo/trunk projetofoo | |
ibook:~ dirceu$ cd projetofoo | |
ibook:projetofoo dirceu$ # agora é fazer alterações e commits a vontade... | |
ibook:projetofoo dirceu$ vi meuarquivo.py | |
ibook:projetofoo dirceu$ git commit -a -m 'Alterando foo porque bar' | |
ibook:projetofoo dirceu$ # ... e branches! 'git branch NOME' cria um novo branch, | |
ibook:projetofoo dirceu$ # 'git checkout NOME' troca de branch. o branch padrão é 'master' |
from django.test import TestCase | |
from django.core import mail | |
from myproject.myapp.views import send_some_emails | |
class FooTestCase(TestCase): | |
def test_email_subject(self): | |
send_some_emails() | |
self.assertEquals(mail.outbox[0].subject, 'My subject') | |
# | |
# Script to generate a Malvados (http://www.malvados.com.br) feed. | |
# | |
# Author: Dirceu Pereira Tiegs <dirceutiegs@gmail.com> | |
# | |
# You can see the result on http://dirceu.info/malvados.xml. | |
# | |
require 'rssify' | |
# -*- coding: utf-8 -*- | |
from StringIO import StringIO | |
from Products.CMFCore.utils import getToolByName | |
from zope.app.component.hooks import setSite | |
from zope.app.component.interfaces import ISite, IPossibleSite | |
from Products.Five.site.localsite import enableLocalSiteHook | |
from collective.lead.interfaces import IDatabase |
def ATSAObjectField_get(self, instance, **kwargs): | |
__traceback_info__ = (self.getName(), instance, kwargs) | |
storage = self.getStorage(instance) | |
original_storage = config.storages.get(instance.__class__.__name__ + self.getName(), None) | |
if original_storage: | |
storage = original_storage | |
try: | |
kwargs['field'] = self | |
r = storage.get(self.getName(), instance, **kwargs) | |
except AttributeError: |
$ tree > t | |
$ python repeated_files_on_tree.py |
# The following code can be used to delete an object that is return POSKeyErrors | |
# on a ZODB database. Run it using 'zopectl debug'. Tested with Zope 2.9. | |
container_id = '/path/to/container' | |
screwed_object_id = 'screwed_obj' | |
from ZODB.POSException import POSKeyError | |
import transaction | |
obj = app.unrestrictedTraverse(container_id) | |
obj._objects = tuple(filter(lambda i,n = id: i['id'] != n, obj._objects)) |