Skip to content

Instantly share code, notes, and snippets.

type NormalizedQuery struct {
// sorted list of keys which are looked up by where.
Simple_where_keys list{String}
// sorted list of keys which are looked as where in
Where_in_keys list[String]
}
@sheki
sheki / gist:6117048
Created July 30, 2013 21:16
LUIZ RIBERIO YOU SUCK
getCode of `facebook` is promising: code ; however, the step returns nothing. Fix the step by returning the expected values OR by returning a Promise that promises said values.
at Object.exec (/home/luiz/minesweeper/node_modules/everyauth/lib/step.js:68:11)
at RouteTriggeredSequence.start (/home/luiz/minesweeper/node_modules/everyauth/lib/stepSequence.js:46:39)
at RouteTriggeredSequence.routeHandler (/home/luiz/minesweeper/node_modules/everyauth/lib/routeTriggeredSequence.js:13:13)
at Object.<anonymous> (native)
at nextMiddleware (/home/luiz/minesweeper/node_modules/everyauth/node_modules/connect/lib/middleware/router.js:175:25)
at param (/home/luiz/minesweeper/node_modules/everyauth/node_modules/connect/lib/middleware/router.js:183:16)
at pass (/home/luiz/minesweeper/node_modules/everyauth/node_modules/connect/lib/middleware/router.js:191:10)
at Object.router [as handle] (/home/luiz/minesweeper/node_modules/everyauth/node_modules/connect/lib/middleware/router.js:197:6)
at
@sheki
sheki / gist:6117050
Created July 30, 2013 21:16
LUIZ RIBERIO YOU SUCK
getCode of `facebook` is promising: code ; however, the step returns nothing. Fix the step by returning the expected values OR by returning a Promise that promises said values.
at Object.exec (/home/luiz/minesweeper/node_modules/everyauth/lib/step.js:68:11)
at RouteTriggeredSequence.start (/home/luiz/minesweeper/node_modules/everyauth/lib/stepSequence.js:46:39)
at RouteTriggeredSequence.routeHandler (/home/luiz/minesweeper/node_modules/everyauth/lib/routeTriggeredSequence.js:13:13)
at Object.<anonymous> (native)
at nextMiddleware (/home/luiz/minesweeper/node_modules/everyauth/node_modules/connect/lib/middleware/router.js:175:25)
at param (/home/luiz/minesweeper/node_modules/everyauth/node_modules/connect/lib/middleware/router.js:183:16)
at pass (/home/luiz/minesweeper/node_modules/everyauth/node_modules/connect/lib/middleware/router.js:191:10)
at Object.router [as handle] (/home/luiz/minesweeper/node_modules/everyauth/node_modules/connect/lib/middleware/router.js:197:6)
at
@sheki
sheki / compound_index_creater.py
Last active December 23, 2015 07:59
The algorithm to flatten MongoQueries so that they can be represented by a single query key
# Converts a Query JSON into a flat key.
#{
# "where": {
# "activityDistance": {
# "$gte": 2.5
# },
# "accumulatedTotalDistance": {
# "$lte": 10695
# },
# "
type files map[string]map[string]string
func (f *files) UnmarshalJSON(data []byte) error {
fmt.Println("GOT : ", string(data))
*f = make(map[string]map[string]string)
if err := json.Unmarshal(data, f); err == nil {
return nil
}
m := make(map[string]string)
if err := json.Unmarshal(data, &m); err != nil {
@sheki
sheki / doom.js
Created February 21, 2014 22:18
mongo_script
MongoDB shell version: 2.2.2
connecting to: test
> c = db.test
test.test
> c.insert{a : 10, b:10}
Fri Feb 21 14:15:27 SyntaxError: missing ; before statement (shell):1
> c.insert({a : 10, b:10})
> c.insert({a : 11, b:11})
> c.find()
{ "_id" : ObjectId("52fc16614a1d457dfe834cae"), "a" : 1234, "b" : 5678 }
@sheki
sheki / gist:9177431
Created February 23, 2014 21:17
Mt Tamalapais camping.
MOUNT TAMALPAIS - Alice Eastwood Camping 3/08
We have room for up to 50 campers, so feel free to invite some friends/coworkers.
15 parking spaces available - so carpooling is encouraged.
$10 per person
*When: Saturday, 3/08*
Checkin time: 2PM Saturday
Checkout time: 12pm Sunday
c.find({$query:{}, $maxScan:1}).explain()
{
"cursor" : "BasicCursor",
"isMultiKey" : false,
"n" : 0,
"nscannedObjects" : 3,
"nscanned" : 3,
"nscannedObjectsAllPlans" : 3,
"nscannedAllPlans" : 3,
"scanAndOrder" : false,
@sheki
sheki / .vimrc
Created September 4, 2014 19:24
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" " alternatively, pass a path where Vundle should install plugins
" "call vundle#begin('~/some/path/here')
"
" " let Vundle manage Vundle, required
@sheki
sheki / gist:b47180a562975993a48e
Created October 31, 2014 00:51
nscanned_mongos
db['collection_name'].find({
$maxScan:500000,
$explain:true,
$query:{
"$and":[
{
"$or":[
{"_id":"NOvRVdV0ru"},
{"deviceIds":"id123"}
]