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
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
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
<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
// ==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
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
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
class VectorWrapperBase { | |
public: | |
virtual ~VectorWrapperBase() {} | |
virtual void reserve(unsigned int n) = 0; | |
virtual VectorWrapperBase* clone() const = 0; | |
}; | |
inline VectorWrapperBase* new_clone(const VectorWrapperBase& a) { | |
return a.clone(); | |
} |
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
# http://stackoverflow.com/questions/11409942/function-subseq-python-need-thoughts | |
function is_sub(s1, s2): | |
let L1 be the length of s1 and L2 the length of s2 | |
1. if L2 > L1, s2 is definitely not a subset of s1, so return False | |
2. if the first L2 elements in s1 equals to s2, then s2 is a subset. return True. | |
3. otherwise, make a recusive call to determine if s2 is a subset of s1[1:] and return the result. | |
p.s. You might find the slice notation useful. See http://stackoverflow.com/a/509295/115845 |
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
#include "kd3/kdtree.h" | |
void some_function(void) { | |
double *x, *y, *z; /* array of points */ | |
size_t i, j; /* loop indices */ | |
x = malloc(sizeof(double) * SIZE); | |
y = malloc(sizeof(double) * SIZE); | |
z = malloc(sizeof(double) * SIZE); |