Skip to content

Instantly share code, notes, and snippets.

View felipecruz's full-sized avatar

Felipe Cruz felipecruz

  • Berlin, Germany
View GitHub Profile
import zmq
import threading
import time
from random import choice
__author__ = "Felipe Cruz <[email protected]>"
__license__ = "MIT/X11"
class ClientTask(threading.Thread):
"""ClientTask"""
##################### 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())
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'
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'
@felipecruz
felipecruz / can_you_lead_account_current_ammount_to_inconsistency.java
Created September 21, 2011 20:33
can_you_lead_account_current_ammount_to_inconsistency.java
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() {
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
@felipecruz
felipecruz / dfa.clj
Created November 27, 2011 00:06
dfa.clj
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
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(
# 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
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__()