Skip to content

Instantly share code, notes, and snippets.

View viirya's full-sized avatar
:octocat:

Liang-Chi Hsieh viirya

:octocat:
View GitHub Profile
@viirya
viirya / gist:1558006
Created January 4, 2012 01:47 — forked from tty/gist:298175
# Basic text search with relevancy for MongoDB.
# See http://blog.tty.nl/2010/02/08/simple-ranked-text-search-for-mongodb/
# Copythingie 2010 - Ward Bekker - ward@tty.nl
#create (or empty) a docs collection
doc_col = MongoMapper.connection.db('example_db').collection('docs')
doc_col.remove({})
#add some sample data
doc_col.insert({ "txt" => "it is what it is"})
@viirya
viirya / distance.js
Created June 5, 2012 07:22 — forked from clauswitt/distance.js
Get the distance between two (world) coordinates - a nodejs module
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* */
/* Simple node js module to get distance between two coordinates. */
/* */
/* Code transformed from Chris Veness example code - please refer to his website for licensing */
/* questions. */
/* */
/* */
/* Latitude/longitude spherical geodesy formulae & scripts (c) Chris Veness 2002-2011 */
/* - www.movable-type.co.uk/scripts/latlong.html */