Skip to content

Instantly share code, notes, and snippets.

View masylum's full-sized avatar
💅
Being fantastic

Pau Ramon Revilla masylum

💅
Being fantastic
View GitHub Profile

Rectify

Takes a grid and returns an optimal set of rectangles that fills that grid

For example, the following grid:

[[1,1,0,1,1],
 [1,1,1,1,1],
 [0,1,1,1,0]]
@masylum
masylum / node_omngodb_groups.js
Created October 19, 2010 16:20
Async with For Loop 2
var login_counts = [],
j = 30;
for (;j > 0;j--) {
tday.setDate(tday.getDate()+1);
yday.setDate(tday.getDate()+1);
// scope
(function (index, query) {
collection.find({date: query},function (err, cursor) {
@masylum
masylum / node_mongo_groups.js
Created October 19, 2010 16:13
Async with For Loop
var login_counts = [],
j = 30,
// functions scope
add_count = function (index, query) {
collection.find({date: query},function (err, cursor) {
cursor.count(function (err, count) {
login_counts[index] = count;
});
});
};