Skip to content

Instantly share code, notes, and snippets.

View feyyazesat's full-sized avatar

Feyyaz Esatoglu feyyazesat

View GitHub Profile
#!/bin/bash
# include config
# config example below:
#
#
# Example deploy_config.sh
#
# dev_env() {
@feyyazesat
feyyazesat / connectionpoolingimplementation.go
Created March 17, 2015 18:56 — forked from rday/gist:3504712
an example of connection pooling implementation.
/**
This function creates a connection to the database. It shouldn't have to know anything
about the pool, It will be called N times where N is the size of the requested pool.
*/
func initCirrusConnections() (interface{}, error) {
dbserver, _ := configFile.GetString("default", "dbserver")
dbuser, _ := configFile.GetString("default", "dbuser")
dbpass, _ := configFile.GetString("default", "dbpass")
db := autorc.New("tcp", "", dbserver, dbuser, dbpass)
@feyyazesat
feyyazesat / connectionpooling.go
Last active August 29, 2015 14:17 — forked from rday/gist:3504674
An example of connection pooling.
type InitFunction func() (interface{}, error)
type ConnectionPoolWrapper struct {
size int
conn chan interface{}
}
/**
Call the init function size times. If the init function fails during any call, then
the creation of the pool is considered a failure.
- http://www.alexedwards.net/blog/golang-response-snippets
- https://devcharm.com/articles/8/go-nethttp-handlers/
- http://openmymind.net/Things-I-Wish-Someone-Had-Told-Me-About-Go/
- https://elithrar.github.io/article/custom-handlers-avoiding-globals/
- https://elithrar.github.io/article/map-string-interface/
- https://elithrar.github.io/article/approximating-html-template-inheritance/
- http://blog.golang.org/error-handling-and-go
- https://golang.org/doc/articles/wiki/
- https://medium.com/@benbjohnson/structuring-applications-in-go-3b04be4ff091
- https://justinas.org/best-practices-for-errors-in-go/
{
"events":[
{
"title":"the foo party",
"lat":1111,
"long":1111,
"description":"go to the party, surely you will have fun!",
"startDate":1111 // unixtimestamp
}
]