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
class VectorWrapperBase { | |
public: | |
virtual ~VectorWrapperBase() {} | |
virtual void reserve(unsigned int n) = 0; | |
}; | |
template <typename T> | |
class VectorWrapper: public VectorWrapperBase { | |
public: | |
typedef T data_type; |
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
typedef std::map<std::string, boost::any> VectorMap; | |
typedef std::pair<std::string, boost::any> VectorMapValue; | |
class VectorStore { | |
public: | |
template <typename T> | |
void RegisterVec(std::string vec_name) { | |
std::pair<VectorMap::iterator, bool> ret; | |
ret = map_.insert(VectorMapValue(vec_name, std::vector<T>())); |
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
// ==UserScript== | |
// @name GForge SCM Syntax Highlighter | |
// @version 1.1.1 | |
// @namespace http://shawnchin.github.com | |
// @description Provides syntax highlighting for CVS/SVN/Git Code Viewer | |
// @include http://*/gf/project/*/scm*/?action=browse&*view=markup* | |
// @include http://*/gf/project/*/scmgit/*;a=blob;* | |
// ==/UserScript== | |
// Note that GForge already loads jQuery (a rather old version!) |
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
<flame_model version="3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:noNamespaceSchemaLocation='http://flame.ac.uk/schema/xmml_v3.xsd'> | |
<model_name>Circles</model_name> | |
<model_version>02</model_version> | |
<model_description>...</model_description> | |
<environment> | |
<variable type="double" name="width" /> | |
<variable type="double" name="height" /> |
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
class PathPrefixMatch(object): | |
""" | |
Trie-based path prefix mathching utility | |
Usage: | |
path_prefixes = ("/hello/world/", "/test/") | |
p = PathPrefixMatch(path_prefixes) | |
p.add_path("/test2") # add another path | |
p.match("/test2/drive/x.txt") # returns "/test2" |
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 __future__ import absolute_import | |
import re | |
from functools import partial | |
from inspect import getargspec | |
from django.conf import settings | |
from django.template.context import (Context, RequestContext, | |
ContextPopException) | |
from django.utils.importlib import import_module |
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
/* | |
Dummy header file for complex.h | |
This file suppresses the relevant keywords and replaces constants/functions | |
with dummy ones so splint doesn't choke. | |
Keywords derived from : | |
http://pubs.opengroup.org/onlinepubs/009604499/basedefs/complex.h.html | |
*/ |
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
# | |
# Based on multiprocessing.sharedctypes.RawArray | |
# | |
# Uses posix_ipc (http://semanchuk.com/philip/posix_ipc/) to allow shared ctypes arrays | |
# among unrelated processors | |
# | |
# Usage Notes: | |
# * The first two args (typecode_or_type and size_or_initializer) should work the same as with RawArray. | |
# * The shared array is accessible by any process, as long as tag matches. | |
# * The shared memory segment is unlinked when the origin array (that returned |
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/env python | |
import itertools | |
from dateutil import parser | |
jumpwords = set(parser.parserinfo.JUMP) | |
keywords = set(kw.lower() for kw in itertools.chain( | |
parser.parserinfo.UTCZONE, | |
parser.parserinfo.PERTAIN, | |
(x for s in parser.parserinfo.WEEKDAYS for x in s), | |
(x for s in parser.parserinfo.MONTHS for x in s), |
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
/* scroll page so obj is visible in current view with | |
* a _minimum_ bottom margin of "bottom_margin" (default:20). | |
* -- requires jQuery -- | |
*/ | |
function scroll_to(obj, bottom_margin, speed) { | |
bottom_margin = bottom_margin || 20; | |
var target_height = obj.height() + bottom_margin; | |
var visible_height = $(window).height(); | |
var scroll_top = obj.offset().top; | |
if (target_height < visible_height) { |