Skip to content

Instantly share code, notes, and snippets.

@clintongormley
clintongormley / gist:1088986
Created July 18, 2011 09:19
Create index for partial matching of names in ElasticSearch
# First, create the synonyms file /opt/elasticsearch/name_synonyms.txt
# with the contents:
#
# rob,bob => robert
#
## CREATE THE INDEX WITH ANALYZERS AND MAPPINGS
curl -XPUT 'http://127.0.0.1:9200/test/?pretty=1' -d '
{
@Maff-
Maff- / jsdomjquery.js
Created February 16, 2011 19:33
Demo setup of jsdom + htmlparser + jquery on Node (v0.4.0). Not sure if this is the right way to do it, please fork/comment if you have suggestions.
/**
* jsdom + htmlparser + jQuery @ Node v0.4.0
* use npm to install jsdom & htmlparser:
* $ npm install jsdom@0.1.23
* $ npm install htmlparser
*
* Note: not sure what versions work or not
*
* https://github.com/tmpvar/jsdom
* https://github.com/tautologistics/node-htmlparser
@AndrewRayCode
AndrewRayCode / gist:825583
Created February 14, 2011 07:15
recursive read directory in node.js returning flattened list of files and directories
function readDir(start, callback) {
// Use lstat to resolve symlink if we are passed a symlink
fs.lstat(start, function(err, stat) {
if(err) {
return callback(err);
}
var found = {dirs: [], files: []},
total = 0,
processed = 0;
function isDir(abspath) {