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
#!/bin/sh | |
build_if_not_exists() { | |
# Param $1: name of image | |
# Param $2: path to build context | |
images=`docker images |grep -e ^$1[[:space:]]` | |
if [ -z "$images" ]; then | |
echo building $1 | |
docker build -t $1 $2 | |
else |
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 RouteNode(object): | |
def __init__(self, segment, responder=None): | |
self._children = [] | |
self.segment = segment | |
self.responder = responder | |
def traverse(self, segments, index=0, seg_count=None): | |
if seg_count is None: | |
seg_count = len(segments) |
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
/** | |
* Calculate number of seats in the Swedish parliament for an arbitrary number | |
* of parties, from the total number of votes and each party's result as a | |
* percentage of the total vote. Return an array containing the parties' respective | |
* number of seats. | |
* | |
* The seats are distributed using a "Modified Sainte-Laguë method" algorithm where | |
* the first divisor is 1.4. | |
* | |
* In short, each party is given a "comparison value" based on the total number |
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
// This example uses the stereoscopic rendering feature of Away3D that | |
// has not yet been merged into any of the main branches. At the time | |
// of writing this, the below code requires the "stereofeature" branch | |
// of Away3D. | |
// | |
// The running demo can be found here: | |
// https://dl.dropbox.com/u/1560087/away3d/stereo/Basic_Stereo.html | |
// | |
// Note that this feature may or may not make it into main Away3D. | |
// |