Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# essentials
sudo apt-get install git curl emacs24 vim cowsay
# sublime
sudo add-apt-repository ppa:webupd8team/sublime-text-2
sudo apt-get update
sudo apt-get install sublime-text
@pavel-shvetsov
pavel-shvetsov / meteor_mongodb_search.coffee
Last active September 1, 2015 14:54
Simple mongodb search with meteor by using regular expressions. It tries to match all provided fields with the provided keywords. Inspired from http://www.stephentcannon.com/2013/11/meteor-alternative-to-mongodb-full-text.html
RegExp.quote = (str) ->
(str + "").replace /([.?*+^$[\]\\(){}|-])/g, "\\$1"
Meteor.Collection::search = (options, cb) ->
if options?.keywords?.length >= 3 and _.isString(options.keywords) and options.fields.length >= 1
query =
'$or': []
keywords = options.keywords.split " "
/*
|
|
| THANKS Fats! he did the hard work
|
|
*/
/*
|