Skip to content

Instantly share code, notes, and snippets.

@varver
varver / mogo_write.go
Last active August 29, 2015 14:02
Insert and retrieve data from mongodb with golang.
/*
Insert and retrieve data from mongodb with golang .
*/
package main
import (
"fmt"
"labix.org/v2/mgo"
// "labix.org/v2/mgo/bson"
@varver
varver / Nosql DB Test.txt
Created June 9, 2014 07:44
No Sql Data Write Test Results
We tried 1 million records and results were like .
riak took 20 minutes
mongodb took 2 minutes
GDBM took 20 seconds
Level DB took 12 seconds .
@varver
varver / validation_plugin.js
Last active August 29, 2015 14:03
javascript plugin for form validation . Easily add custom validations in less than a minute .
// plugin to be used for validating widgets for forms or anything with defined rules
/*
////////////////////////////////////////////////////////////////////////////////////////
How to use ?
1) Add class = "validator" to element which has to be validated.
2) Add comma separated validation constraints in attribute called validator in that element like : validator="required,url"
(validators are defined in function called "Check_Validation" you can add more validators here .)
Example = <input name="url" value="http://google.com" class="validator" , validator="required,url">
@varver
varver / cookie_jar_golang.go
Last active June 7, 2022 13:04
Login to a website with this golang code using persistent cookies or cookie jar .
package main
import (
"os"
"encoding/xml"
"strings"
"log"
"runtime/debug"
)
@varver
varver / pprof.go
Created May 11, 2015 12:50
Profiling go code with pprof , example .
package main
import (
"fmt"
"runtime"
"sync"
"github.com/davecheney/profile"
)
func main() {
package main
import (
"fmt"
)
func decorator(f func(s string)) func(s string) {
return func(s string) {
fmt.Println("Started")
@varver
varver / get_image_size.go
Created September 4, 2015 13:02
Get size and format of any image present online or on disk in golang (go)
package main
import (
"bytes"
"fmt"
"github.com/varver/rextro"
_ "golang.org/x/image/bmp"
_ "golang.org/x/image/webp"
"image"
_ "image/gif"
@varver
varver / golang_job_queue.md
Created September 12, 2016 20:59 — forked from harlow/golang_job_queue.md
Job queues in Golang
@varver
varver / geospatial-querying-with-go-and-mongodb.go
Last active November 26, 2016 22:37 — forked from icchan/geospatial-querying-with-go-and-mongodb.go
Geospatial Querying with GoLang and MongoDB
package main
import (
"encoding/json"
"fmt"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
"log"
)