If we detect angular is present, we can expose a directive:
<ANY moment date="scope.myDate" format="'lll'"></ANY>
'use strict';
/**
# License: MIT | |
# django-rest-framework mixin | |
class CachedReprMixin(serializers.ModelSerializer): | |
''' | |
mixin for ModelSerializer subclass whose model has a 'modified' field. | |
assuming the model has a 'modified' field: | |
modified = models.DateTimeField(auto_now=True) |
If we detect angular is present, we can expose a directive:
<ANY moment date="scope.myDate" format="'lll'"></ANY>
'use strict';
/**
Requests are handled by flask
, a bunch of urls are inserted in the object store (redis
)
and arguments are put on the queue (redis
again) for workers to consume. More workers
would mean more items processed in parallel.
Other possible implementations:
multiprocessing
module for consuming all cpus.multiprocessing.managers.SyncManager
for distributing task to other machines.# code snippet from django.utils.autoreload (BSD license) | |
# https://github.com/django/django/blob/master/django/utils/autoreload.py | |
def code_changed(): | |
global _mtimes, _win | |
for filename in gen_filenames(): | |
stat = os.stat(filename) | |
mtime = stat.st_mtime | |
if _win: | |
mtime -= stat.st_ctime |
-- mirror the bugzilla milestones in another picklist | |
-- developers have their own target milestones (the default picklist for milestones) | |
-- support engineers have their own support milestones which is a custom field. | |
-- milestones -> cf_support_milestone | |
delimiter // | |
CREATE TRIGGER cf_milestones_insert | |
AFTER INSERT ON milestones | |
FOR EACH ROW |
-- example mysql triggers that change column values | |
-- before they are inserted/updated. | |
-- use case: when building code that comes from a git repository | |
-- we want to track the branch information, but some of the jobs | |
-- building the product use references rather than short names. | |
-- e.g. refs/remotes/origin/my/branch rather than origin/my/branch. | |
delimiter // |
#!/usr/bin/env python | |
# This example shows how to use multiprocessing with an initializer function. | |
# We take advantage of that to make the workers each have a custom initial | |
# load. And in particular example, we will make the workers sleep. | |
# Because we make them sleep different amounts, one of them is going to be | |
# ready much before the others, and thus we can guess easily which worker | |
# will do most of the work. | |
# | |
# see https://stackoverflow.com/questions/26693797/python-multiprocessing-process-number |
[tox] | |
envlist = py{26,27,33} | |
[testenv] | |
commands = python setup.py test |
language: python | |
python: | |
- "2.7" | |
install: | |
- pip install tox | |
script: | |
- tox |
@context = { 'myhash' => { 'b' => 'B', 'a' => 'A', 'c' => 'C' } } | |
@template = Liquid::Template.parse("{{ myhash | keys | to_ul }}") | |
@template.render(@context) # => "<ul><li>b</li><li>a</li><li>c</li></ul>" | |
@template = Liquid::Template.parse("{{ myhash | keys | sort | to_ul }}") | |
@template.render(@context) # => "<ul><li>a</li><li>b</li><li>c</li></ul>" |