Skip to content

Instantly share code, notes, and snippets.

View sinmetal's full-sized avatar

sinmetal sinmetal

View GitHub Profile
import groovy.xml.MarkupBuilder
apply plugin: "java"
apply plugin: "war"
apply plugin: "eclipse"
// maven-publish, maven2Gradle, build-dashboard
// checkstyle, findbugs, jdepend, pmd
package org.sinmetal.xgtx;
import java.io.IOException;
import java.util.ConcurrentModificationException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.google.appengine.api.datastore.DatastoreService;
@sinmetal
sinmetal / sample.html
Last active December 17, 2015 00:59
AngularJSがDOMを生成したことを検知する方法を考える。 directive作って、function postLinkを設定してやれば、DOMが生成された時に、呼んでくれるみたいだ。
<!DOCTYPE html>
<html lang="ja" ng-app="myApp">
<head>
<meta charset="utf-8">
<title>sample</title>
<link rel="stylesheet" href="../static/stylesheets/bootstrap.min.css">
<link rel="stylesheet" href="../static/stylesheets/bootstrapSwitch.css">
</head>
<body>
<div class="row-fluid" ng-controller="mainCtrl">
@sinmetal
sinmetal / FileInfo.java
Last active December 20, 2015 01:28
Google Cloud Storage Client Libraryを適当に使ってみたサンプル。 with slim3
package org.sinmetal.appengine.sample.model.gcs;
import org.slim3.datastore.Attribute;
import org.slim3.datastore.Datastore;
import org.slim3.datastore.Model;
import com.google.appengine.api.datastore.Key;
@Model(schemaVersionName = "schemaVersion", schemaVersion = 1)
public class FileInfo {
@sinmetal
sinmetal / gaereverseproxy.go
Created February 23, 2016 06:26 — forked from pokstad/gaereverseproxy.go
Google App Engine reverse proxy in Golang
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// HTTP reverse proxy handler
package goengine
import (
"io"
package goonchk
import (
"fmt"
"net/http"
"github.com/mjibson/goon"
"google.golang.org/appengine/datastore"
)
@sinmetal
sinmetal / matchArray.bjs
Created May 27, 2016 09:41
keyword, arrayを渡して、arrayに含まれる文字を正規表現で探してマッチしたら、マッチした文字列を返すBQのUDF
function passthroughExample(row, emit) {
var output = [];
row.keyword. forEach(function(element, index, array) {
var match = row.data.match(element);
if (match) {
output.push(match[0]);
}
})
emit({output:output})
}
@sinmetal
sinmetal / gcs_sample.go
Created June 24, 2016 05:32
example google.DefaultClient()
package gcs_sample
import (
"net/http"
"fmt"
"google.golang.org/appengine"
"google.golang.org/appengine/log"
"golang.org/x/oauth2/google"
package main
import (
"net/http"
)
func init() {
http.HandleFunc("/.well-known/acme-challenge/", handlerLetsencypt)
}
@sinmetal
sinmetal / naturalLanguageAPIResponseSchema.json
Last active July 29, 2016 01:59
Cloud Natural Language APIのResponseをBigQueryに入れるためのschema
[{
"name": "entities",
"mode": "repeated",
"type": "record",
"fields": [{
"name": "mentions",
"mode": "repeated",
"type": "record",
"fields": [{
"name": "text",