JavaScriptのオブジェクトを理解する。(買い物カゴを作成する)
- カートが持つ情報
- カートに入っている商品
- カートの中の合計金額
 
| application: you-app-name-here | |
| version: 1 | |
| runtime: python | |
| api_version: 1 | |
| default_expiration: "30d" | |
| handlers: | |
| - url: /(.*\.(appcache|manifest)) | |
| mime_type: text/cache-manifest | 
| // +build !windows | |
| // +build !appengine | |
| package metrics | |
| import ( | |
| "syscall" | |
| ) | |
| const ( | 
| // 即時関数を作成する 定義しつつ即実行 + 匿名関数 | |
| // 作成する理由 -> グローバルオブジェクトを汚染しない為 | |
| (function ($, windows) { // $をjQueryのショートカットとしてこの範囲でだけ使う | |
| var a = 100; | |
| })(jQuery, widows); | |
| // windowオブジェクトは一番大きいオブジェクト | |
| // window.b で 以下は参照出来る | 
| // ListBottle returns an array of view: default. | |
| func (m *BottleDB) ListBottleFullScan(ctx context.Context, accountID int) []*app.BottleRelation { | |
| defer goa.MeasureSince([]string{"goa", "db", "bottle", "listbottle"}, time.Now()) | |
| var native []*Bottle | |
| var objs []*app.BottleRelation | |
| err := m.Db.Scopes(BottleFilterByAccount(accountID, m.Db)). | |
| Table(m.TableName()). | |
| Preload("BottleCategories"). | |
| Preload("Account"). | 
| package resource | |
| import ( | |
| . "github.com/VG-Tech-Dojo/Logbook-server/design/constant" | |
| "github.com/VG-Tech-Dojo/Logbook-server/design/media" | |
| . "github.com/goadesign/goa/design" | |
| . "github.com/goadesign/goa/design/apidsl" | |
| ) | |
| var _ = Resource("users", func() { | 
| <%@page import="my.beans.db.MyDBAccess01"%> | |
| <%@ page language="java" contentType="text/html; charset=UTF-8" | |
| pageEncoding="UTF-8"%> | |
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |
| <html> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
| <title>Insert title here</title> | |
| </head> | |
| <body> | 
| // SetGithubID ContextにGithubIDを格納する | |
| func SetGithubID(parents context.Context, GithubID string) context.Context { | |
| return context.WithValue(parents, ContextGithubIDKey, GithubID) | |
| } | |
| // GetGithubID Contextに入っているGithubIDを取り出す | |
| func GetGithubID(ctx context.Context) (string, error) { | |
| v := ctx.Value(ContextGithubIDKey) | |
| token, ok := v.(string) | |
| if !ok { | 
| box: michilu/docker-goapp | |
| build: | |
| after-steps: | |
| - install-packages: | |
| packages: ruby | |
| - wantedly/pretty-slack-notify: | |
| webhook_url: $SLACK_WEBHOOK_URL | |
| channel: notification | |
| steps: | |
| - script: | 
| package main | |
| import "fmt" | |
| type Person interface { | |
| Greet() string | |
| SetGreet(string) | |
| SetName(string) | |
| GetName() string | |
| } |