Skip to content

Instantly share code, notes, and snippets.

View yanap's full-sized avatar

yanap yanap

View GitHub Profile
自分のPCのホームディレクトリに .gitconfig おいてる
```
[user]
name = yanap
email = yanap1214@gmail.com
[core]
editor = vim -c \"set fenc=utf-8\"
precomposeunicode = true
quotepath = false
@yanap
yanap / diy_pc.md
Last active May 2, 2025 16:44
diy pc
<input type="button" value="Say hello" onClick="showAndroidToast('Hello Android!')" />
<script type="text/javascript">
function showAndroidToast(toast) {
Android.showToast(toast);
}
</script>
package main
import (
"fmt"
"runtime"
)
func main() {
runtime.Breakpoint()
fmt.Println("Hello world!!")
brew install go
package main
import (
"fmt"
"math"
)
type ErrNegativeSqrt float64
func (e ErrNegativeSqrt) Error() string {
@yanap
yanap / fibonacci.go
Created July 21, 2014 14:09
Exercise: Fibonacci closure
package main
import "fmt"
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() int {
a := 0
b := 1
return func() int {
@yanap
yanap / map.go
Created July 20, 2014 13:41
A Tour of Go ◀▶ Exercise: Maps
package main
import (
"code.google.com/p/go-tour/wc"
"strings"
)
func WordCount(s string) map[string]int {
ss := strings.Fields(s);
num := len(ss)
@yanap
yanap / Slices.go
Last active August 29, 2015 14:04
Exercise: Slices
package main
import "code.google.com/p/go-tour/pic"
func Pic(dx, dy int) [][]uint8 {
ret := make([][]uint8, dy);
for y := 0; y < dy; y++ {
ret[y] = make([]uint8, dx);
for x := 0; x < dx; x++ {
//ret[y][x] = uint8(x^y);
@yanap
yanap / file0.go
Created July 15, 2014 15:13
A Tour of Go, Exercise: Loops and Functions ref: http://qiita.com/yanap/items/5f1085a828bdef8ab310
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {
z := float64(2.)
s := float64(0)