Skip to content

Instantly share code, notes, and snippets.

for b in manymanymanybrains:
doc = b.getObject()
@jean
jean / gist:1339288
Created November 4, 2011 13:16
total_allocations
sources = ['FPL','RAL']
financebrains = index.dbsearch({'doctype': u'FinanceData', 'funding_source': sources, 'year': 2010})
total_allocations = 0
allocations_by_source = {}
for b in financebrains:
for row in doc.getItem('financial_data'):
for source in sources:
@jean
jean / Vagrantfile
Created February 17, 2012 06:07
Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
#njj From http://devops.me/2011/10/10/vagrant-tricks-and-troubleshooting/
# config.vm.memory_size = 800
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
@jean
jean / gist:2554476
Created April 30, 2012 00:40
Proofreading Software and Silicon
Proofreading Software and Silicon: http://softwareandsilicon.com/
Changes are sequential.
Sorry for the lack of diffs: I was reading in an anal app on a phone that doesn't allow edit or even copy/paste.
= Chapter 1 =
s/since we could it was only/since it was only/
@jean
jean / gist:4153656
Created November 27, 2012 11:04
Logging attainment
ratings_per_output:
{'def077b2d8a9623f66e9d14b569e977f': {'2010/11-4': {'attained': 0, 'total': 2, 'not_attained': 2, 'attained_late': 0},
'2010/11-2': {'attained': 0, 'total': 2, 'not_attained': 2, 'attained_late': 0}},
'd05cfa5ffe2340421dcfdfcf5b32020c': {'2010/11-4': {'attained': 0, 'total': 1, 'not_attained': 1, 'attained_late': 0},
'2010/11-5': {'attained': 0, 'total': 1, 'not_attained': 1, 'attained_late': 0}},
'343706558fd8d80ae5b6d9ea1edfcd2d': {'2010/11-4': {'attained': 0, 'total': 2, 'not_attained': 0, 'attained_late': 2}},
'df133063aae4429bff44e23c9a97ea69': {'2010/11-4': {'attained': 1, 'total': 1, 'not_attained': 0, 'attained_late': 0},
'2010/11-2': {'attained': 0, 'total': 1, 'not_attained': 1, 'attained_late': 0},
'2010/11-3': {'attained': 0, 'total': 1, 'not_attained': 1, 'attained_late': 0}},
'd48f1ce97cc2182c98080a6ce1465008': {'2010/11-
@jean
jean / gist:4153782
Created November 27, 2012 11:29
Report log (complete)
Reporting on 5 EA for SP 95d1f81230cf75d713cbd555b9fad318, 2010/11-1
------
2012-11-27T13:44:07 INFO Plomino App: pgSubprogrammePoWPerformancesReport/display_report
summary
ratings_per_output: {}
ratings_per_period: None
------
2012-11-27T13:44:09 INFO Plomino App: pgSubprogrammePoWPerformancesReport/display_report
summary
ratings_per_output:
@jean
jean / gist:4154656
Created November 27, 2012 14:57
Report log (complete, with EA and EAPoW ids)
Reporting on 5 EA for SP 95d1f81230cf75d713cbd555b9fad318, 2010/11-1
------
2012-11-27T17:51:26 INFO Plomino App: pgSubprogrammePoWPerformancesReport/display_report
ea: a2782402da9e491b1b6a00699921ff07, 8 eapows
------
2012-11-27T17:51:26 INFO Plomino App: pgSubprogrammePoWPerformancesReport/display_report
ea: a2782402da9e491b1b6a00699921ff07, eapow: 97e6ef1cc26e626da72dfb759d2d1195
------
2012-11-27T17:51:26 INFO Plomino App: pgSubprogrammePoWPerformancesReport/display_report
summary
@jean
jean / gist:4257114
Created December 11, 2012 08:50
Rendered datagrid
<div id="sp_deliverables_datagrid_wrapper" class="dataTables_wrapper" role="grid">
<div class="fg-toolbar ui-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix"></div>
<table id="sp_deliverables_datagrid" class="display dataTable">
<thead>
<tbody role="alert" aria-live="polite" aria-relevant="all">
<tr class="odd">
<td class="">An edited test IMDIS activity</td>
<td class="">Project 15-P1 (00626) : (15-P1)-Scientific support package for global and national climate change information</td>
<td class="">
<script>
@jean
jean / plominodb-badfieldnames.xml
Created December 14, 2012 09:30
Plomino gets confused by some field names, e.g. 'action'.
<plominodatabase id="test">
<design>
<dbsettings version="1.16">
<AboutDescription type="Products.Archetypes.Field.TextField"><![CDATA[]]></AboutDescription>
<UsingDescription type="Products.Archetypes.Field.TextField"><![CDATA[]]></UsingDescription>
<IndexAttachments type="Products.Archetypes.Field.BooleanField">False</IndexAttachments>
<FulltextIndex type="Products.Archetypes.Field.BooleanField">True</FulltextIndex>
<IndexInPortal type="Products.Archetypes.Field.BooleanField">False</IndexInPortal>
<debugMode type="Products.Archetypes.Field.BooleanField">False</debugMode>
<StorageAttachments type="Products.Archetypes.Field.BooleanField">False</StorageAttachments>
@jean
jean / gist:5410552
Created April 18, 2013 06:14
Setup Plone for invokeFactory
# Setup Plone for invokeFactory ... there must be a better way
from zope.component.hooks import setSite
setSite(plone)
from sys import stdin, stdout
from ZPublisher.HTTPRequest import HTTPRequest
from ZPublisher.HTTPResponse import HTTPResponse
from ZPublisher.BaseRequest import RequestContainer