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
import json | |
from collections import OrderedDict | |
from tastypie.serializers import Serializer | |
from tastypie import fields | |
from tastypie.resources import Resource | |
from django.core.serializers.json import DjangoJSONEncoder | |
class OrderedSerializer(Serializer): | |
def to_json(self, data, options=None): | |
options = options or {} |
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
index 146ac15..647a826 100644 | |
--- a/tests/core/tests/resources.py | |
+++ b/tests/core/tests/resources.py | |
@@ -1404,6 +1404,24 @@ class ModelResourceTestCase(TestCase): | |
self.assertTrue("resource_uri" in data) | |
self.assertTrue("title" in data) | |
self.assertTrue("is_active" in data) | |
+ | |
+ def test_post_list_duplicate(self): | |
+ self.assertEqual(Note.objects.count(), 6) |
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 is_dj = false; | |
var timeout_handler = 0; | |
function get_slot(){ | |
if(is_dj){ | |
if (timeout_handler){ | |
clearInterval(timeout_handler); | |
} | |
return; | |
} |
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
from myapp.models import MyModel, RelatedModel | |
from django.views.generic import UpdateView | |
class ModelCreateUpdateView(UpdateView): | |
model = MyModel | |
def get_object(self, *args, **kwargs): | |
related_id = self.kwargs.get('related_id') | |
related_model = RelatedModel.objects.get(pk=related_id) |
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
javascript:(function(g,d,f){if(f)d.info("Session found:",f);else return d.warn("No session found!");var h={check:10,wait:500},b=g.autodj={api:g[f],available:function(a){return b.api.taken_dj_map[a]<0},spot:function(){return b.api.become_dj.data("spot")},become:function(a){b.api.callback("become_dj",a)},waiter:function(a){return function(){return b.available(a)?(b.become(a),a):(-1)}},seated:function(a){return b.api.djs[a]&&b.api.djs[a][0]===b.api.myuserid},wait:function(a,c){var e=c!==void 0, | |
a=a||h.check,c=c||b.spot();b.seated(c)?d.warn("Spot",c,"taken!"):(e&&d.error("Spot",c,"missed. Restarting..."),d.info("Polling @",a,"ms"),b.check(a,b.waiter(c)))},check:function(a,c){setTimeout(function(){var e=c.call(b);e>0?(d.warn("Spot",e,"open..."),setTimeout(function(){b.wait(a,e)},h.wait)):b.check(a,c)},a)}}})(window,console,function(g,d,f,h,b,a,c,e,i,j,k){try{return g(d)[f](h)[b][a][c][e]()[i](j)[k]}catch(l){return null}}(jQuery,".invite_dj","data","events","click",0,"handler","toString","match", | |
/\{\s*(.+)\./,1)); |
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
""" | |
Rolls up a huge number of rolemaster characters, | |
calculates the equivalent values using point-buy, | |
aggregates the results. | |
""" | |
number_of_rolls_per_stat = 3 | |
minimum_stat_roll = 11 | |
number_of_characters = 100000 #pretty consistant at this number, use more if you feel like it | |
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
import json | |
import random | |
import re | |
import sys | |
from pprint import pprint | |
from subprocess import check_output | |
from collections import defaultdict | |
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
# Installing OpenCV python libs on mac to work with virtualenv | |
# OpenCV 2.4.3 | |
# Python 2.7.3 installed with brew | |
# assuming you have virtualenv, pip, and python installed via brew | |
# assuming $WORKON_HOME is set to something like ~/.virtualenvs | |
# using homebrew - make sure we're current | |
brew update |
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
#!/usr/bin/python | |
# By Brad Goodman | |
# http://www.bradgoodman.com/ | |
# brad@bradgoodman.com | |
####################### Fill in settings below ####################### | |
USERNAME="your@emailaddress.com" | |
PASSWORD="your_total_comfort_password" |
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
# app id can be found in the URL to the game's store page | |
cd ~/.steam/steam/steamapps/compatdata/32370 # this is for Star Wars: Knights of the Old Republic; change 32370 to the app id of target game | |
# This is for Proton 6.3; update as needed, especially if using something like Glorious Eggroll. | |
STEAM_COMPAT_DATA_PATH=`pwd` WINEPREFIX=`pwd`/pfx "~/.steam/root/steamapps/common/Proton 6.3/proton" run /path/to/executable.exe |
OlderNewer