Skip to content

Instantly share code, notes, and snippets.

@seti123
seti123 / gist:8787151
Created February 3, 2014 16:30
Update docs in Mongo DB with RegEx match
db.test.find('/MyPattern/i.test(JSON.stringify(this))').forEach (function(x) { x.tags='test';db.test.save(x) } );
@seti123
seti123 / gist:8786564
Created February 3, 2014 15:56
Import all .json files in directory to MongoDB
ls().forEach (function (f) { if (/\.json/i.test(f)) { db.test.insert (JSON.parse(cat(f))); } });
@seti123
seti123 / map-controller (angular)
Last active December 23, 2015 00:39
Google Maps marker update from angular controller, iframe embedded in bootstrap tab (which cause normally "trouble" in repainting map
// this is snipped inside the angular controller, which got geo positions after loading data from a REST source ...
for (var i=0; i<list.length; i++)
{
var opts = {"title": list[i].title};
var marker={};
if (list[i].latitude && list[i].longitude )
{
// this is not a google marker, just save pos/title in an object
marker = {lat: list[i].latitude,
lon: list[i].longitude,