Skip to content

Instantly share code, notes, and snippets.

View up1's full-sized avatar

Somkiat Puisungnoen up1

View GitHub Profile
@up1
up1 / Contributor.txt
Created December 3, 2015 03:23
PHP 7 :: Contributor
Anatol Belski
Dmitry Stogov
Xinchen Hui
Nikita Popov
Bob Weinand
Andrea Faulds
Kalle Sommer
Christoph M.
Stanislav Malyshev
Jakub Zelenka
@up1
up1 / APIServer.java
Last active December 3, 2015 14:56
Demo Spark Java
package up1.demo.api;
import static spark.Spark.get;
public class APIServer {
public static void main(String[] args) {
get("/", (req, res) -> "Hello World");
}
@up1
up1 / define_constant.php
Last active December 4, 2015 03:23
Hello PHP 7
<?php
define('ALLOWED_IMAGE_EXTENSIONS', ['jpg', 'jpeg', 'gif', 'png']);
var_dump(ALLOWED_IMAGE_EXTENSIONS);
?>
@up1
up1 / BlogServiceAPI.java
Last active December 7, 2015 04:27
Android Testing from Android Dev Summit 2015
public interface BlogServiceAPI {
void getAllBlogs();
void getBlog();
}
@up1
up1 / build.gradle
Created December 9, 2015 06:05
Gradle :: Show log of unit test
tasks.matching {it instanceof Test}.all {
testLogging.events = ["failed", "passed", "skipped"]
}
@up1
up1 / itax.feature
Created December 11, 2015 07:11
iTax pro with Calabash for android
Feature: Try to create automated test
Scenario: As a poor user I can log into app
When ทำการ login เข้าใช้งาน
And กรอกข้อมูลรายได้
And กรอกข้อมูลลดหย่อน
Then ข้อมูลต่าง ๆ แสดงในหน้าสรุป
*** Settings ***
Library Selenium2Library
#Test Teardown Close Browser
*** Testcases ***
Add product to cart
Open direct2shop
Choose product A
Add to cart
Login
@up1
up1 / gist:17edc018ca4d6f22dc37
Created January 5, 2016 16:11 — forked from takluyver/gist:26fb3b7e365dce527886
Pycon videos by views
Results of running this script: https://gist.github.com/jabbalaci/398429347c96e98aba88
Views Ups Downs Title (Speakers)
9,810 166 3 Keynote - Jacob Kaplan-Moss - Pycon 2015 (Jacob Kaplan-Moss)
7,044 64 0 Type Hints - Guido van Rossum - PyCon 2015 (Guido van Rossum)
4,742 121 0 David Beazley - Python Concurrency From the Ground Up: LIVE! - PyCon 2015 (David Beazley)
4,684 66 3 Keynote - Guido van Rossum - PyCon 2015 (Guido van Rossum)
4,272 78 1 Dan Callahan - My Python's a little Rust-y - PyCon 2015 (Dan Callahan)
2,694 34 0 How to build a brain with Python (Trevor Bekolay)
2,391 29 0 Andrew T. Baker - Demystifying Docker - PyCon 2015 (Andrew T. Baker)
@up1
up1 / BonusCalculator.java
Last active January 6, 2016 02:42
When to refactoring
public class BonusCalculator {
public double getBonus(Employee employee) {
if( employee.department == Department.IT ) {
if(employee.year >= 5) {
return 0.5 * employee.salary;
}
return 0;
} else {
return 1000 + 500 * employee.salary;
@up1
up1 / build.gradle
Created January 7, 2016 03:40
Android Library with Artifactory
apply plugin: 'com.android.library'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'
def packageName = 'codeinputlib'
def libraryVersion = '1.0.0'
buildscript {
repositories {
jcenter()