Skip to content

Instantly share code, notes, and snippets.

@kuy
kuy / bool.md
Created July 23, 2017 17:03
Bool
curl -XPOST 'localhost:9200/_search?pretty' -H 'Content-Type: application/json' -d'
{
  "query": {
    "bool" : {
      "must_not" : {
        "term" : { "choice" : "A" }
      },
      "must" : {
 "term" : { "choice" : "B" }
@kuy
kuy / problem.md
Created July 23, 2017 16:57
Problem
curl -XPOST 'localhost:9200/_search?pretty' -H 'Content-Type: application/json' -d'
{
  "query": {
    "term" : { "choice" : "B" } 
  }
}
'
@kuy
kuy / answers.md
Created July 23, 2017 15:32
Answers
curl -XPUT 'localhost:9200/answers/user/1?pretty' -H 'Content-Type: application/json' -d'
{
    "user" : 1,
    "choice" : [ "A", "B", "C" ]
}
'
@kuy
kuy / mapping.md
Created July 23, 2017 15:18
Mapping
curl -XPUT 'localhost:9200/answers?pretty' -H 'Content-Type: application/json' -d'
{
  "mappings": {
    "user": {
      "_all":       { "enabled": false  },
      "properties": {
        "user":   { "type": "integer" },
        "choice": { "type": "keyword" }
 }
Starting Step #1
Step #1:
Step #1: > foo@ build /app
Step #1: > ls ./node_modules/redux-tower && npm run build:tower && ./node_modules/.bin/webpack
Step #1:
Step #1: README.md
Step #1: decls
Step #1: package.json
Step #1: react.js
Step #1: webpack.config.js
@kuy
kuy / ERROR-01
Last active April 19, 2017 17:37
// ...
Starting Step #1
Step #1:
Step #1: > foo@ build /app
Step #1: > npm run build:tower && ./node_modules/.bin/webpack
Step #1:
Step #1:
Step #1: > foo@ build:tower /app
Step #1: > ./node_modules/.bin/babel ./node_modules/redux-tower/src --out-dir ./node_modules/redux-tower/lib --ignore __tests__
FROM mhart/alpine-node:7.9.0
RUN apk update && apk add git
RUN mkdir /app
WORKDIR /app
COPY package.json /app
RUN npm install
COPY . /app
CMD ["npm", "run", "build"]
steps:
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'app-build', '-f', 'Dockerfile.build', '.']
- name: 'gcr.io/cloud-builders/docker'
args: ['run', '-v', '/workspace/src:/app/src', '-v', '/workspace/build:/app/build', 'app-build']
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'gcr.io/foo/bar:v1', '.']
images:
- 'gcr.io/foo/bar:v1'
// ...
"scripts": {
// ...
"build": "npm run build:tower && ./node_modules/.bin/webpack",
"build:tower": "./node_modules/.bin/babel ./node_modules/redux-tower/src --out-dir ./node_modules/redux-tower/lib --ignore __tests__",
// ...
},
// ...
"dependencies": {
// ...
@kuy
kuy / timer.ml
Created April 2, 2017 15:12
Periodic timer using OCaml + Core + Async.
open Core.Std
open Async.Std
let rec timer () =
after (sec 5.)
>>= fun _ ->
print_endline "Hello";
timer ()
let _ =