Skip to content

Instantly share code, notes, and snippets.

View zemirco's full-sized avatar

Mirco Zeiss zemirco

View GitHub Profile
@zemirco
zemirco / gist:5467583
Created April 26, 2013 14:03
Twitter Bootstrap overwrite Express images folder
[class^="icon-"],[class*=" icon-"] {
background-image:url("../images/glyphicons-halflings.png");
}
.icon-white,
.nav-pills>.active>a>[class^="icon-"],
.nav-pills>.active>a>[class*=" icon-"],
.nav-list>.active>a>[class^="icon-"],
.nav-list>.active>a>[class*=" icon-"],
.navbar-inverse .nav>.active>a>[class^="icon-"],
@zemirco
zemirco / gist:5586728
Created May 15, 2013 19:40
node proxy basic auth
var cors_proxy = require("corsproxy");
var http_proxy = require("http-proxy");
cors_proxy.options = {
// this is not working
target: "user:pw@https://mirco.cloudant.com/pouchdb"
};
http_proxy.createServer(cors_proxy).listen(1234, function() {
console.log('cors proxy server listening on port 1234')
});
@zemirco
zemirco / a.html
Created January 28, 2016 14:39
go nested html templates
{{ define "title" }}
a
{{ end }}
{{ define "body" }}
<p>
some content in file a
</p>
{{ end }}
func get(w http.ResponseWriter, r *http.Request) *HTTPError {
// get some logged in user
user := GetUserFromContext(r)
// create error and result channel
errchan := make(chan error, 2)
friendsChan := make(chan []Friend)
CarsChan := make(chan []Cars)
// get friends
go func() {
friends, err := db.GetFriends(user.Name)
@zemirco
zemirco / data.tsv
Last active September 16, 2016 15:37
d3 v4 pie chart
region fruit count
East Apples 53245
West Apples 28479
South Apples 19697
North Apples 24037
Central Apples 40245
East Oranges 200
South Oranges 200
Central Oranges 200
@zemirco
zemirco / index.html
Last active June 4, 2018 20:07
d3 simple
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<style>
.line {
@zemirco
zemirco / index.html
Created June 4, 2018 20:09
d3 class
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<style>
.line {
@zemirco
zemirco / index.html
Created June 6, 2018 14:02
d3 update
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
</head>
<body>
@zemirco
zemirco / index.html
Created June 18, 2018 08:31
d3 update without key function
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
</head>
<body>
@zemirco
zemirco / cache.go
Last active October 8, 2022 09:58
golang database layer with cache
type CacheInterface interface {
Get(key string) ([]byte, error)
Set(key string, value interface{}) error
}
// Cache implements CacheInterface.
type Cache struct {
// wrap redis pool connection
// or whatever you need
}