Skip to content

Instantly share code, notes, and snippets.

package main
import (
"fmt"
"github.com/pistarlabs/configs"
)
func main() {
// Initialize config
// Get database host or return empty string if not exists
host := cfg.UString("database.host")
// Get database host or return default passed value if not exists
host := cfg.UString("database.host", "default")
// Get database host and error
host, err := cfg.String("database.host")
// Get development environment configuration
cfg, err = cfg.Get("development")
if err != nil {
panic(err)
}
cfg, err := Load("/path/to/config.json")
if err != nil {
panic(err)
}
{
"development": {
"database": {
"host":"localhost",
"username":"root",
"password":"12345",
"port":12345,
"name":"dev"
}
},
@pistarlabs
pistarlabs / facebook.xml
Created July 22, 2012 19:51
Facebook Detail Share in Timeline XML
<link rel="image_src" href="http://www.pistarlabs.com/assets/img/default.jpg" />
<meta property="og:title" content="Pistarlabs.com, Web Application Developer in Jakarta Indonesia"/>
<meta property="og:image" content="http://www.pistarlabs.com/assets/img/default.jpg"/>
<meta property="og:site_name" content="Pistarlabs"/>
<meta property="og:description" content="Pistarlabs is web application developer specialist and consultant based in Jakarta, Indonesia."/>
<meta property="og:type" content="website" />
<meta property="og:street-address" content="Cikoko Barat I no 24"/>
<meta property="og:locality" content="Jakarta"/>
<meta property="og:region" content="DKI Jakarta"/>
<meta property="og:postal-code" content="12770"/>
@pistarlabs
pistarlabs / opensearch.xml
Created July 22, 2012 19:44
How To Google Chrome’s Address Bar Search Website
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName>Pistarlabs.com</ShortName>
<Description>Pistarlabs Search</Description>
<InputEncoding>UTF-8</InputEncoding>
<Url type="text/html" method="GET" template="http://pistarlabs.com/blog/?s={searchTerms}"/>
<Url type="application/opensearchdescription+xml" rel="self" template="http://www.pistarlabs.com/opensearch.xml"/>
<moz:SearchForm>http://www.pistarlabs.com/blog</moz:SearchForm>
</OpenSearchDescription>