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
_pad2 = function (v) { return (v < 10) ? ('0' + v) : ('' + v); } | |
utc_offset = function (dt) { | |
var tzoffset = 'Z', offset=dt.getTimezoneOffset(); | |
if (offset != 0) { | |
tzoffset = (offset < 0) ? '+' : '-'; | |
offset = Math.abs(offset); | |
tzoffset += _pad2(Math.floor(offset/60)) + ':' + _pad2(offset%60); | |
} | |
return tzoffset; |
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
/*jshint browser: true, nomen: false, eqnull: true, trailing:true */ | |
/* global habitable, console */ | |
var mycalendar = (function (ns, core) { | |
"use strict"; | |
var schema = core.schema, | |
Schema = schema.Schema; | |
ns.ICalendarEvent = new Schema({ |
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 datetime | |
import pkg_resources | |
import re | |
import smtplib | |
import socket | |
import threading | |
import time | |
from App.config import getConfiguration | |
from plone.break_core import VulnerabilityCheck as VC |
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
// premise: | |
// all items in collection of AJAX-loaded content have about same complexity. | |
// | |
// first item in a collection should be loaded as quickly as possible, as it | |
// is the first item to be seen. | |
// | |
// But generally, larger batch sizes are more efficient, for fewer requests | |
// | |
// the closer to the end of the collection, the larger the batch size. | |
// |
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 os | |
import re | |
import sys | |
import urllib2 | |
from z3c.pt.language import Parser | |
defines = { | |
'template_id' : 'template/getId', | |
'normalizeString' : 'nocall:context/@@plone/normalizeString', |
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
[buildout] | |
parts = | |
productdistros | |
instance | |
zopepy | |
solr-download | |
solr-instance | |
extends = | |
http://download.zope.org/Zope2/index/2.12.3/versions.cfg | |
http://dist.plone.org/release/4.0.1/versions.cfg |
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
[buildout] | |
extensions = buildout.extensionscripts | |
extension-scripts = ${buildout:directory}/src/osdetect.py:osdetect | |
parts = | |
opt | |
bdb-source | |
bdb-build | |
openssl-build | |
zlib | |
sasl-build |
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 zope.interface import Interface | |
class IMediaEncodingPolicy(Interface): | |
""" | |
Utility interface, to determine options for transcoding based on | |
container and/or stream metadata, which is assumed to be a dict matching | |
the avprobe JSON schema, with two primary keys of 'format' (container), | |
and 'streams' -- merged from two respective avprobe commands: |
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
# somewhere in zodbupdate, likely at the end of update.py, | |
# add a monkey-patch for RelStorage to have a record_iternext() method: | |
# relstorage monkey patch for zodbupdate compatibility | |
# BIG caveat: FileStoreage record_iternext() is only current records; this | |
# will only ever work on a history-free or zero-day-packed | |
# RelStorage, and as such it is a hack. | |
import itertools | |
from relstorage.storage import RelStorage |
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
# compare package names in PyPI for possible typosquatting | |
# WARNING: slow O(n^2), even if optimized, may yield 1000+ results | |
import time | |
from lxml import html | |
import urllib2 | |
LISTURL = 'https://pypi.python.org/simple/' | |
OlderNewer