Skip to content

Instantly share code, notes, and snippets.

View dinopetrone's full-sized avatar

Dino Petrone dinopetrone

  • BLITZ
  • Santa Monica, CA
View GitHub Profile
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:
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
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
@dinopetrone
dinopetrone / gist:3949605
Created October 24, 2012 23:32
props you need
{
"source":"web",
"entity_id":"261226756424491008",
"entities":{
"urls":[
{
"expanded_url":"http://www.facebook.com/meanstinks",
"display_url":"facebook.com/meanstinks",
"indices":[
75,
[
{
"keys": ["super+alt+right"],
"command": "set_layout",
"args":
{
"cols": [0.0, 0.5, 1.0],
"rows": [0.0, 0.5, 1.0],
"cells":
[
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){
@dinopetrone
dinopetrone / gist:3252273
Created August 3, 2012 22:41
fizbuzz on crack
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 ++;