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 zmq | |
import threading | |
import time | |
from random import choice | |
__author__ = "Felipe Cruz <[email protected]>" | |
__license__ = "MIT/X11" | |
class ClientTask(threading.Thread): | |
"""ClientTask""" |
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
##################### urls.py ################################ | |
v1_api = Api(api_name='v1') | |
v1_api.register(QuestionAnswerResource()) | |
v1_api.register(QuestionGroupResource()) | |
v1_api.register(QuestionResource()) | |
v1_api.register(QuestionnaireResource()) | |
v1_api.register(ProfileResource()) | |
v1_api.register(ProfileQuestionnaireResource()) | |
v1_api.register(ProfileAnswerResource()) |
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
diff -r 8a7085ef70f9 pypy/translator/platform/darwin.py | |
--- a/pypy/translator/platform/darwin.py Thu Aug 18 19:10:26 2011 +0200 | |
+++ b/pypy/translator/platform/darwin.py Mon Aug 29 23:34:08 2011 -0300 | |
@@ -14,7 +14,7 @@ | |
# NOTE: GCC 4.2 will fail at runtime due to subtle issues, possibly | |
# related to GC roots. Using LLVM-GCC or Clang will break the build. | |
- default_cc = 'gcc-4.0' | |
+ default_cc = '/usr/local/bin/gcc' | |
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
diff -r 8a7085ef70f9 pypy/translator/platform/darwin.py | |
--- a/pypy/translator/platform/darwin.py Thu Aug 18 19:10:26 2011 +0200 | |
+++ b/pypy/translator/platform/darwin.py Mon Aug 29 23:34:08 2011 -0300 | |
@@ -14,7 +14,7 @@ | |
# NOTE: GCC 4.2 will fail at runtime due to subtle issues, possibly | |
# related to GC roots. Using LLVM-GCC or Clang will break the build. | |
- default_cc = 'gcc-4.0' | |
+ default_cc = '/usr/local/bin/gcc' | |
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
public class LiveBank implements Serializable{ | |
private Map<Integer, Account> accounts; | |
private AtomicInteger next_account_number = new AtomicInteger(0); | |
public LiveBank() { | |
this.accounts = new HashMap<Integer, Account>(); // concurrent hashmap maybe | |
} | |
public Account createAccount() { |
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
var win = Ti.UI.createWindow({ backgroundColor: '#fff' }); | |
win.add(Ti.UI.createLabel({ text: 'Look for the notification! It should be there now.' })); | |
win.open(); | |
win.hide(); | |
var request = Ti.Network.createHTTPClient(); | |
request.onload = function (e) { | |
Ti.API.debug(this.responseText); | |
Titanium.Android.NotificationManager.notify( | |
0, // <-- this is an ID that we can use to clear the notification later |
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
inspired by - https://github.com/cathoderay/dfa | |
(def palavra "aaaaaab") | |
(def alfabeto '("a","b")) | |
(def estados '(0,1,2)) | |
(def inicial 0) | |
(def terminal 1) | |
(def transitions | |
{[0,"a"] 0 |
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 proximo_vencimento_meses(self): | |
admissional_type = TipoPedidoExame.objects.filter( | |
Q(nome__iexact='admissional') | |
) | |
demissional_type = TipoPedidoExame.objects.filter( | |
Q(nome__iexact='demissional') | |
) | |
periodico_type = TipoPedidoExame.objects.filter( |
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
# pip requirements.txt | |
# requests==0.9.1 | |
# requests-oauth==0.2.3 | |
# -e git://github.com/simplegeo/python-oauth2.git@a83f4a297336b631e75cba102910c19231518159#egg=oauth2-dev | |
import sys | |
import requests | |
from oauth_hook import OAuthHook |
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 memorify_relation(model, relation_name, memory_relation_name): | |
# ManyRelatedManager isn't public class.. WTF.. | |
if str(getattr(model, relation_name).__class__).find('ManyRelatedManager'): | |
model.__dict__[memory_relation_name] = list(getattr(model, | |
relation_name).all()) | |
return model | |
class FastUserManager(django.contrib.auth.models.UserManager): | |
def __init__(self): | |
return super(FastUserManager, self).__init__() |