This file contains 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
dir := createTestDir([]templateFile{ | |
// T0.tmpl はT1をコールします。 | |
{"T0.tmpl", `T0 invokes T1: ({{template "T1"}})`}, | |
// T1.tmpl T2をコールするテンプレートを"T1"として定義しています。 | |
{"T1.tmpl", `{{define "T1"}}T1 invokes T2: ({{template "T2"}}){{end}}`}, | |
// T2.tmpl は"T2"としてテンプレートを定義しています。 | |
{"T2.tmpl", `{{define "T2"}}This is T2{{end}}`}, | |
}) | |
// main関数終了後、作成したディレクトリを削除します。 | |
defer os.RemoveAll(dir) |
This file contains 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
// まず、FuncMapでカスタム関数名と処理したい関数を登録します。 | |
funcMap := template.FuncMap{ | |
// "title"はテンプレートでコールされる関数名となります。 | |
"title": strings.Title, | |
} | |
// 先ほどの関数をテストするために、シンプルなテンプレートを定義します。 | |
// 私たちはいくつかの方法で入力されたテキストを表示します: | |
// - オリジナルテキスト | |
// - "title"をコール |
This file contains 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
<!doctype html> | |
<html lang="ja"> | |
<head> | |
<title>jQuery mobile with Google maps - Google maps jQuery plugin</title> | |
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" /> | |
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.min.js"></script> | |
<script type="text/javascript" src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script> | |
<script type="text/javascript" src="http://maps.google.com/maps/api/js?v=3&sensor=false&language=ja"> </script> | |
<script type="text/javascript"> | |
var cityList = [ |
This file contains 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 debug = debugT(false) | |
type debugT bool | |
func (d debugT) Printf(format string, args ...interface{}) { | |
if d { | |
log.Printf(format, args...) | |
} | |
} |
This file contains 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
1.Node.jsをダウンロード | |
http://nodejs.org/download/ | |
http://nodejs.org/dist/v0.10.5/node-v0.10.5-darwin-x64.tar.gz | |
2.解凍 | |
$ tar xvzf node-v0.10.5-darwin-x64.tar.gz | |
$ cd node-v0.10.5-darwin-x64/bin | |
3.コマンドが使えることを確認して | |
$ ./node --version |
This file contains 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
標準のnodeはソースを編集後の反映確認は、 | |
Ctrl-C押して再起動する必要があったが、 | |
ブラウザリロードで反映ができるようにするツール | |
$ npm install -g nodemon | |
$ nodemon app.js | |
で起動しておく |
This file contains 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 ( | |
"github.com/akavel/polyclip-go" | |
"github.com/akavel/polyclip-go/polyutil" | |
"image" | |
"image/color" | |
"image/draw" | |
"image/png" | |
"os" |
This file contains 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
def channel(nothing): | |
import zipfile | |
import re | |
zip = zipfile.ZipFile('channel.zip') | |
comments = '' | |
while True: | |
s = zip.open(nothing+'.txt', 'r').read() | |
comments += zip.getinfo(nothing+'.txt').comment |
This file contains 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
//pythonchallenge 6 | |
//問題:http://www.pythonchallenge.com/pc/def/channel.html | |
//ヒント:channel.zipにreadme.txtがある | |
//使い方:% go run archive_zip.go 90052 | |
package main | |
import ( | |
"archive/zip" | |
"fmt" | |
"io/ioutil" |
This file contains 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
//python challenge 8 | |
//問題 http://www.pythonchallenge.com/pc/def/integrity.html | |
package main | |
import ( | |
"compress/bzip2" | |
"fmt" | |
"io" | |
"os" | |
"strings" |
OlderNewer