Skip to content

Instantly share code, notes, and snippets.

View up1's full-sized avatar

Somkiat Puisungnoen up1

View GitHub Profile
@up1
up1 / working_with_popup.txt
Created March 17, 2015 01:46
Robot framework with popup
*** Settings ***
Library Selenium2Library
*** Testcases ***
Open website without popup
Open Browser http://www.kuala-lumpur.ws chrome
Maximize Browser Window
Add Cookie cms_COUT_Domain B path=\/ domain=www.kuala-lumpur.ws
Execute Javascript jQuery(document).ready()
@up1
up1 / hamming.py
Last active August 29, 2015 14:17
Shorter code
def hamming(a, b):
return sum(x != y for x, y in map(None, a, b))
@up1
up1 / google_robot.txt
Created March 20, 2015 02:14
Robot framework :: Template with Google
*** Settings ***
Library Selenium2Library
*** Variables ***
${GOOGLE URL} http://www.google.com
${KEYWORD INPUT} lst-ib
${SEARCH BUTTON} btnG
*** Testcases ***
ทดสอบค้นหา Google
@up1
up1 / index.txt
Created March 25, 2015 00:46
Elasticsearch 1.5
POST /myindex
{
"settings": {
"number_of_shards": 2,
"data_path": "/tmp/myindex"
}
}
@up1
up1 / coverage.txt
Last active August 29, 2015 14:17
php 7
$ ./configure --enable-gcov
$ make lcov
@up1
up1 / MyGradeCalculate.java
Last active August 29, 2015 14:17
Demo espresso
package com.example;
import android.test.ActivityInstrumentationTestCase2;
import android.test.suitebuilder.annotation.LargeTest;
import com.example.somkiat.calculate.MyActivity;
import com.example.somkiat.calculate.R;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
@up1
up1 / example.txt
Last active August 29, 2015 14:17
Elasticsearch :: Distinct Result
เท่าที่มา สิ่งที่บอกว่า Solr ทำได้คือ แบบนี้
http://blog.jteam.nl/2009/10/20/result-grouping-field-collapsing-with-solr/
ทำให้สามารถ distinct result กลับออกมาเพียง กลุ่มละ 1 ตัวได้
ตัวอย่างข้อมูล 3 ข้อมูล
PUT ec/product/1
{
"name" : "ABC",
@up1
up1 / demo.txt
Last active August 29, 2015 14:17
Elasticsearch Top Hit
PUT ec/product/1
{
"name" : "ABC",
"price" : 123,
"category" : ["1", "2"]
}
PUT ec/product/2
{
@up1
up1 / Point.java
Created March 31, 2015 04:59
Java 9
value class Point {
int x;
int y;
Point(int x, int y) { this.x = x; this.y = y }
}
@up1
up1 / import.txt
Last active August 29, 2015 14:18
Elasticsearch DSL
การ import ข้อมูลเข้า Elasticsearch
ใช้เครื่องมือตัวนี้
https://github.com/taskrabbit/elasticsearch-dump
เมื่อติดตั้งเสร็จใช้คำสั่งดังนี้
$elasticdump \
--bulk=true \
--input=homepro.json \