Skip to content

Instantly share code, notes, and snippets.

View up1's full-sized avatar

Somkiat Puisungnoen up1

View GitHub Profile
@up1
up1 / sample.txt
Created January 26, 2016 15:59
Elasticsearch :: sample date
PUT log/web/1
{
"name" : "test",
"loged_date" : "2016/01/26 11:11:11"
}
PUT log/web/2
{
"name" : "test",
"loged_date" : "2016/01/27 11:11:11"
}
@up1
up1 / build.gradle
Last active February 10, 2016 08:25
Android :: JDepend
apply plugin: 'jdepend'
...
task jdepend(type: JDepend, dependsOn: 'compileDebugSources') {
classesDir file('build/intermediates/classes/debug/myproject/package')
reports {
xml {
destination 'build/reports/jdepend.xml'
}
@up1
up1 / AndroidManifest.xml
Last active February 12, 2016 12:26
Fastlane with android app
<?xml version="1.0" encoding="utf-8"?>
<manifest package="up1.hello"
xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CHANGE_CONFIGURATION" />
@up1
up1 / CallReport.java
Last active February 19, 2016 14:06
Check Null
import java.io.File;
public class CallReport {
public static void main(String ... args) {
Report report = new NotNullReport(new FileNotExistsReport(new DefaultReport()));
report.export(null); //Throw error from null
report.export(new File("existing.pdf")); //Throw error from existing file
report.export(new File("new.pdf")); //Success
@up1
up1 / MyOperationTest.java
Created February 23, 2016 02:29
Test case
public class MyOperationTest {
@Test public void
first_scenario() {
//Init
result = operation(a, b, c);
CHECK(result == true)
}
@Test public void
@up1
up1 / HelloWorldTest.java
Last active February 24, 2016 04:26
Demo of JUnit 5 (Alpha)
import org.junit.gen5.api.Test;
import static org.junit.gen5.api.Assertions.assertEquals;
public class HelloWorldTest {
@Test
public void
first_scenario() {
Hello hello = new Hello();
@up1
up1 / demo01.js
Created February 26, 2016 08:50
JavaScript :: How to create function ?
function hello() {
}
var hello = function() {
}
@up1
up1 / Dockerfile
Created February 28, 2016 07:25
Demo :: Docker + Swift
FROM swiftdocker/swift:latest
ADD src /src
@up1
up1 / build.gradle
Last active February 29, 2016 10:27
Espresso with Android M
task grantPermissions(type: Exec, dependsOn: 'installDevDebug') {
def adb = android.getAdbExe().toString()
commandLine "sh grant_permissions.sh $adb demo.up1.dev".split(" ")
}
afterEvaluate {
tasks.each { task ->
if (task.name.startsWith('connectedDevDebugAndroidTest')) {
task.dependsOn grantPermissions
@up1
up1 / first.emojic
Last active March 7, 2016 09:56
EmojiCode
πŸ‡ 🐼 πŸ‡
πŸ‡πŸ– 🏁 ➑️ πŸš‚ πŸ‡
πŸ˜€ πŸ”€Hello WorldπŸ”€
🍎 0
πŸ‰
πŸ‰