Skip to content

Instantly share code, notes, and snippets.

View jakul's full-sized avatar
🏳️‍🌈
LGBT and proud

Craig Blaszczyk jakul

🏳️‍🌈
LGBT and proud
View GitHub Profile
db.remove({'id': 1000})
db.remove({'id': 7054})
db.remove({'id': 7055})
db.remove({'id': 7056})
db.remove({'id': 7713})
db.remove({'id': 8045})
db.remove({'id': 8133})
db.remove({'id': 8589})
db.remove({'id': 8604})
db.remove({'id': 8631})
> db.xxx.insert({'colours':['red']})
> db.xxx.insert({'colours':['red']})
> db.xxx.insert({'colours':['blue']})
> db.xxx.insert({'colours':['blue', 'red']})
> db.xxx.insert({'colours':['green']})
> db.xxx.find({ $or: [{"colours": {$in: ['red']}}}] }).count()
Wed Apr 9 15:47:41.383 SyntaxError: Unexpected token }
> db.xxx.find({ $or: [{"colours": {$in: ['red']}}] }).count()
3
> db.xxx.find({ $or: [{"colours": {$in: ['blue']}}] }).count()
if numbers.count() > 0:
phone_no_1 = numbers[0]
else:
phone_no_1 = PhoneNumber()
phone_no_1.content_object = self.instance.user
phone_no_1.number = self.cleaned_data['phone_no_1']
# ensure this one is marked as the default one
phone_no_1.is_default = True
@jakul
jakul / gist:9395379
Created March 6, 2014 17:45
users and practices with multiple plhone numbers / addresses
pns = PhoneNumber.objects.filter(content_type=38L).order_by('object_id').values_list('object_id', flat=True)
pns2 = [(key, len(list(group))) for key, group in groupby(pns)]
[(key, freq) for key, freq in pns2 if freq> 2]
3
31
38
pns = Address.objects.filter(content_type=38).order_by('object_id').values_list('object_id', flat=True)
if __name__ == '__main__':
print('a')
# check PCTs are consistent
print(set(PCT_TO_CCG.keys()).difference(set(PCTS)))
print(set(PCTS).difference(PCT_TO_CCG.keys()))
# check CCGs are consistent
# print(set(CCGS).difference(PCT_TO_CCG.values()))
print(set(PCT_TO_CCG.values()).difference(set(CCGS)))
TRELLO_LISTS_BY_ACCOUNT_MANAGER = {u'2 days til job start and unfilled': {u'Practice Account Management - Scott': u'52e27982eb9ad20156fec4a1',
u'Practice Account Management - Will': u'52e2796ad827fdd30a77c25d',
u'Practice Hurdles': u'52d9467dcae05385643b8287'},
u'Applications waiting for +2 days': {u'Practice Account Management - Scott': u'52e27982eb9ad20156fec494',
u'Practice Account Management - Will': u'52e2796ad827fdd30a77c250',
u'Practice Hurdles': u'513e18c643c045b510000285'},
u'First application on job': {u'Practice Account Management - Scott': u'52e27982eb9ad20156fec497',
u'Practice Account Management - Will': u'52e2796ad827fdd30a77c253',
u'Practice Hurdles': u'513dcca79f5174900f001ee8'},
u'First completed job': {u'Practice Account Management - Scott': u'52e27982eb9ad20156fec490',
In [5]: dir(PracticeProfile)
Out[5]:
['DoesNotExist',
'Meta',
'MultipleObjectsReturned',
'__class__',
'__delattr__',
'__dict__',
'__doc__',
'__eq__',
# CSS
.like-red .red {
display:block;
}
.like-red .green {
display:none;
}
In [29]: # dict of it system names which each locum can use, keyed by locum profile id
In [30]: from profiles.models import *
In [31]: from django.con
django.conf django.contrib
In [31]: from django.contrib.
django.contrib.admin django.contrib.csrf django.contrib.humanize django.contrib.sessions django.contrib.webdesign
django.contrib.admindocs django.contrib.databrowse django.contrib.localflavor django.contrib.sitemaps
(networklocum)root@roslin:/srv/networklocum/releases/current/networklocum/networklocum# cat /var/log/m-mandrake.log | grep '"thumbs_up":\[null,true\]}' | grep '\"reset_thumbs_up\":true'
[DEBUG ] 2013-12-18 22:05:14,456 - Message received on NL:mandrake:handlers: {"id":2956,"type":"job","differences":{"modified":["2013-12-18T13:05:01.000Z","2013-12-18T22:05:14.334Z"],"thumbs_up":[null,true]},"announce_type":"object_updated","reset_thumbs_up":true,"source":"nlapi"}
[DEBUG ] 2013-12-18 22:05:15,688 - Message received on NL:mandrake:handlers: {"id":2950,"type":"job","differences":{"modified":["2013-12-17T13:05:01.000Z","2013-12-18T22:05:15.665Z"],"thumbs_up":[null,true]},"announce_type":"object_updated","reset_thumbs_up":true,"source":"nlapi"}
[DEBUG ] 2013-12-18 22:05:16,438 - Message received on NL:mandrake:handlers: {"id":2957,"type":"job","differences":{"modified":["2013-12-18T18:05:01.000Z","2013-12-18T22:05:16.426Z"],"thumbs_up":[null,true]},"announce_type":"object_updated","reset_thumbs_up":true,"sourc