Skip to content

Instantly share code, notes, and snippets.

@xavi-
xavi- / gist:08bd6a81e7861c29bffb
Created September 24, 2015 23:53 — forked from kvigen/gist:c5aa7e2d17e13769d929
oplog-converter
type ChangeEntry struct {
Namespace string
Type string // insert, update, or delete
ID string // the unique identifier of the object
Object map[string]interface{} // There are limitations on this object...
}
func convertOp(op map[string]interface{}) (*ChangeEntry, error) {
// Note that this has only been tested for the Mongo 2.4 format
@xavi-
xavi- / gist:633087
Created October 18, 2010 21:21 — forked from jimbojw/gist:583389
Interview gist -- Can candidate read, debug, and fix code?
// For each of the following code fragments:
// a. what does the code do?
// b. what did the author intend for it to do?
// c. how would you fix it?
// NOTE: all code samples work exactly the same in all browsers
// 1. object literals
var data = [ { high: 100, low: 81 }, { high: 93, low: 73 }, { high: 60, low: 32 } ];
function getAverages(data) {
var avgs = [];