Skip to content

Instantly share code, notes, and snippets.

View gatesvp's full-sized avatar

Gaëtan Perrault gatesvp

View GitHub Profile
@gatesvp
gatesvp / nested_docs.js
Created January 27, 2011 08:28
An example of using nested docs. Or basically a hash table instead of an array of js objects.
var x = {_id: 1, 'tags' : { 'castle' : { 'n' : 10 }, 'age' : { 'n' : 2 } } };
var y = {_id: 2, 'tags' : { 'keep' : { 'n' : 2 }, 'castle' : { 'n' : 6 } } };
var z = {_id: 3, 'tags' : { 'keep' : { 'n' : 5 }, 'cats' : { 'n' : 6 } } };
db.doc.save(x);
db.doc.save(y);
db.doc.save(z);
// find all docs
db.doc.find();
// Get a the current collection size.
var storage = db.foo.storageSize();
var total = db.foo.totalSize();
print('Storage Size: ' + tojson(storage));
print('TotalSize: ' + tojson(total));
print('-----------------------');
print('Running db.repairDatabase()');
@gatesvp
gatesvp / MediaShoutExport.ps1
Created November 20, 2010 20:30
Copy all files for a given MediaShout presentation (along with the presentation) into a single folder. Update the presentation to use the locally referenced files, this way the presentation is actually self-contained.
# Select-FileDialog Function #
# Created by Hugo Peeters #
# http://www.peetersonline.nl #
###############################
# Note: store in your profile for easy use
# Example use:
# $file = Select-FileDialog -Title "Select a file" -Directory "D:\scripts" -Filter "Powershell Scripts|(*.ps1)"
function Select-FileDialog
use cookie;
/**
* Cookie to lookups process
*/
create_new_lookup = function(x) {
var ins = new Array;
var outs = new Array;
for(var i in x.maps) {
@gatesvp
gatesvp / Node Install
Created October 23, 2010 05:48
Just a quick series of lines to install node.js, assuming a basically blank Linux install
# Apt-get basic build and git
sudo apt-get install build-essential
sudo apt-get git-core
# Set up a folder for Node.js, then download and build
mkdir node_src
cd node_src
git clone git://github.com/ry/node.git # may take a few minutes
cd node
./configure