This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"code.google.com/p/goweb/goweb" | |
"net/http" | |
) | |
type MyController struct{} | |
// for GET /api |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://play.golang.org/p/TC1PoskmV2 | |
package main | |
import "fmt" | |
type Foo struct { | |
n int | |
} | |
func (foo Foo) String() string { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var data = [10, 20, 30, 40]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="chart"> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var data = [10, 20, 30, 40]; | |
var chart = d3.select('#chart'); | |
chart.selectAll("div") | |
.data(data) | |
.enter() | |
.append("div") | |
.style("width", function(d) { | |
return d * 10 + "px"; | |
}).text(function(d) { | |
return d; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="chart"> | |
<div style="width:100px;"> | |
10 | |
</div> | |
<div style="width:200px;"> | |
20 | |
</div> | |
<div style="width:300px;"> | |
30 | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#chart div { | |
background-color: steelblue; | |
text-align: right; | |
padding: 3px; | |
margin: 1px; | |
color: white; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a = sb.observable(10); | |
var b = sb.observable(a()); | |
// バインディング | |
sb.binding().sync(a,b).bind(); | |
// a -> bの通知が走りbも100になる。 | |
a(100); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a = sb.observable(10); | |
var b = sb.observable(a()); | |
// バインディング | |
sb.binding(a).computed(b, function(){ | |
return a() * 2; | |
}); | |
// bはaの2倍の値(200)がセットされる。 | |
a(100); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var data = [ | |
sb.observable(10), | |
sb.observable(20), | |
sb.observable(30), | |
sb.observable(40) | |
]; | |
// Create binding | |
var b = sb.d3.binding().transition() | |
.style("width", function(d) { |