Skip to content

Instantly share code, notes, and snippets.

View up1's full-sized avatar

Somkiat Puisungnoen up1

View GitHub Profile
@up1
up1 / sql.txt
Created May 1, 2015 08:07
How-old.net
SELECT
System.Timestamp AS OutTime,
Face.gender AS Gender,
Count(*) AS Count
FROM
StreamInput
GROUP BY HoppingWindow(second,10,1),
Face.gender
@up1
up1 / Checkout.java
Last active August 29, 2015 14:20
Shopping Cart
while (!cart.isEmpty()) {
shipping.ship(cart.takeNext(), ???);
}
@up1
up1 / example.java
Last active August 29, 2015 14:20
Counting Line
- // This file contains 3 lines of code
1 public interface Dave {
- /**
- * count the number of lines in a file
- */
2 int countLines(File inFile); // not the real signature!
3 }
@up1
up1 / build.gradle
Created May 10, 2015 07:29
Android Studio 1.2 + Testing
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
}
}
public String say(int number) {
if( number%3 == 0 )
return "Fizz";
if( number%5 == 0 )
return "Buzz";
return number+"";
}
@up1
up1 / build.gradle
Last active August 29, 2015 14:21
Android Code Coverage
android {
...
buildTypes {
...
debug {
debuggable true
testCoverageEnabled = true
}
@up1
up1 / step_01.java
Last active August 29, 2015 14:22
Refactoring :: Rule of Three
private void askQuestion() {
if (currentCategory() == "Pop")
System.out.println(pop.removeFirst());
if (currentCategory() == "Science")
System.out.println(science.removeFirst());
if (currentCategory() == "Sports")
System.out.println(sport.removeFirst());
if (currentCategory() == "Rock")
System.out.println(rock.removeFirst());
}
@up1
up1 / first.java
Last active August 29, 2015 14:22
Test smell :: Magic number
public class BowlingGameTest {
@Test
public void perfectGame() throws Exception {
roll(10, 12);
assertThat(game.score(), is(equalTo(300)));
} }
@up1
up1 / Cargo.toml
Last active September 21, 2020 11:59
Hello world with Rust :: web application
[package]
name = "simple-web"
version = "0.1.0"
authors = ["somkiat <[email protected]>"]
[dependencies.nickel]
git = "https://github.com/nickel-org/nickel.rs.git"
@up1
up1 / post.txt
Last active August 29, 2015 14:22
Robotframework :: post item on kaidee.com
*** Settings ***
Library Selenium2Library
#Test Teardown Close Browser
*** Testcases ***
Post my book on Kaidee
Open Browser http://www.kaidee.com/posting/
Maximize Browser Window