Skip to content

Instantly share code, notes, and snippets.

@pei0804
pei0804 / app.yaml
Created February 20, 2017 01:38 — forked from darktable/app.yaml
GAE: App.yaml designed for serving a static site on Google App Engine (Python). Copy your static html and files into a folder called "static" next to app.yaml. Contains a bunch of mimetype declarations from html5boilerplate's .htaccess. May not be neces
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 (
@pei0804
pei0804 / intro.js
Last active May 11, 2017 07:17
WA42
// 即時関数を作成する 定義しつつ即実行 + 匿名関数
// 作成する理由 -> グローバルオブジェクトを汚染しない為
(function ($, windows) { // $をjQueryのショートカットとしてこの範囲でだけ使う
var a = 100;
})(jQuery, widows);
// windowオブジェクトは一番大きいオブジェクト
// window.b で 以下は参照出来る
@pei0804
pei0804 / README.md
Last active May 18, 2017 06:50
WA42カート

オブジェクト指向でJavaScriptプログラミング

JavaScriptのオブジェクトを理解する。(買い物カゴを作成する)

カートの仕様

  • カートが持つ情報
    • カートに入っている商品
    • カートの中の合計金額
@pei0804
pei0804 / helper.go
Created May 19, 2017 12:49
goa-sample-model
// 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() {
@pei0804
pei0804 / DB.jsp
Last active June 29, 2017 15:49
MA42
<%@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 {
@pei0804
pei0804 / wercker.yml
Last active August 25, 2017 08:49
goa-gae-wercker
box: michilu/docker-goapp
build:
after-steps:
- install-packages:
packages: ruby
- wantedly/pretty-slack-notify:
webhook_url: $SLACK_WEBHOOK_URL
channel: notification
steps:
- script:
@pei0804
pei0804 / main.go
Created October 14, 2017 13:51
gointerface
package main
import "fmt"
type Person interface {
Greet() string
SetGreet(string)
SetName(string)
GetName() string
}