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
class MasterSlaveRouter(object): | |
def db_for_read(self, model, **hints): | |
return 'slave' | |
def db_for_write(self, model, **hints): | |
return 'master' | |
def allow_relation(self, obj1, obj2, **hints): | |
db_list = ('master', 'slave') | |
if obj1.state.db in db_list and obj2.state.db in db_list: |
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
class ExcludedWordManager(models.Manager): | |
def get_excluded(self, test_words): | |
temp_set = set(test_words.split(' ')) | |
r = redis.from_url(settings.REDIS_HOST) | |
all_excluded_words = r.smembers('excluded_words') | |
return temp_set & all_excluded_words |
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
TwitterHTTPError: Twitter sent status 429 for URL: 1.1/lists/members.json using parameters: (include_entities=True&oauth_consumer_key=WxzxqiokugfvlpOeimIWhA&oauth_nonce=12535491098363119979&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1351220378&oauth_token=295947098-cf77TdPKQUwTfj7jXzfWTsEnKIux15msekPLLh4&oauth_version=1.0&owner_screen_name=FXNetworks&slug=soa&oauth_signature=jDhLaC5OGX7CEPSUZXvieEFZ%2FnM%3D) | |
details: ?VJ-*?/*V???V?M-.NLOU?R | |
J,IU????,QH?HNMMIMQ?QJ?OJZX????????(8 |
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
{ | |
"source":"web", | |
"entity_id":"261226756424491008", | |
"entities":{ | |
"urls":[ | |
{ | |
"expanded_url":"http://www.facebook.com/meanstinks", | |
"display_url":"facebook.com/meanstinks", | |
"indices":[ | |
75, |
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
[ | |
{ | |
"keys": ["super+alt+right"], | |
"command": "set_layout", | |
"args": | |
{ | |
"cols": [0.0, 0.5, 1.0], | |
"rows": [0.0, 0.5, 1.0], | |
"cells": | |
[ |
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
var fb = { | |
fbArr:['','','Fizz','','Buzz','Fizz','','','Fizz','Buzz','','Fizz','','','FizzBuzz'], | |
next:function(){ | |
var first_slot = this.fbArr.shift(); | |
this.fbArr.push(first_slot); | |
console.log(first_slot); | |
} | |
} | |
fb.next(); | |
while(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
var fb = { | |
fbArr:['','','Fizz','','Buzz','Fizz','','','Fizz','Buzz','','Fizz','','','FizzBuzz'], | |
next:function(){ | |
var index = this.count(); | |
var total = this.total(); | |
console.log(total + ':' + this.fbArr[index]) | |
}, | |
count:function(){ | |
if(typeof(arguments.callee.index) == 'undefined')arguments.callee.index =-1; | |
arguments.callee.index ++; |