Skip to content

Instantly share code, notes, and snippets.

if (Meteor.isClient) {
Test = new Meteor.Collection("test");
Meteor.subscribe("testsub");
}
if (Meteor.isServer) {
Test = new Meteor.Collection("test", { connection: null });
Meteor.publish("testsub", function () {
return Test.find();
});
@estark37
estark37 / gist:5216851
Created March 21, 2013 21:16
O(n^4) Solution to Project Euler problem #82
# How much does it cost to get from (i1, j) to (i2, j) by going up
# or down only?
def sum_to(i1, i2, j, matrix):
x1 = min(i1, i2)
x2 = max(i1, i2)
return sum([matrix[x][j] for x in range(x1, x2+1)])
# Returns the minimum path sum that goes from any entry in the
# leftmost column to entry (i, j).
def compute_min_path_entry(i, j, matrix, min_path):