Skip to content

Instantly share code, notes, and snippets.

@imathis
imathis / set-game.js
Created April 8, 2016 15:34
Some simple javascript to power a game of Set.
var Deck = {
reset: function() {
this.size = 0
this.cards = []
while(this.size < 81) {
this.cards.push(Card.new(this.size))
this.size += 1
}
this.shuffle()
@alexbevi
alexbevi / DEMO.md
Last active January 24, 2023 21:09
Ruby on Rails Global Summit 23: Ruby on Rails and MongoDB

Install Rails 7

# make sure rails is setup
gem install rails                                                                                                          
# output
@hweller1
hweller1 / hybrid_search_example.py
Last active March 1, 2024 00:58
basic example showing how to use reciprocal rank fusion to join results of a vector and full text search on indexes built from the same collection, with the same query
import os
import pymongo
os.environ["OPENAI_API_KEY"] = '<openai API key>'
import openai
### SETUP
@hweller1
hweller1 / rrf_via_unionWith.py
Last active February 23, 2024 09:40
Perform reciprocal rank fusion using $push to expose rank, and $unionWith and $group to join result sets of vector search and full text search
import pymongo
import time
from sentence_transformers import SentenceTransformer
from companies import names # list of company names in a separate python file
### DESCRIPTION
"""
Search against the Sphere dataset using vector search results fused with full text search results via reciprocal rank fusion.