Skip to content

Instantly share code, notes, and snippets.

@kohendrix
kohendrix / MyAlertDialog.kt
Created February 2, 2019 04:32
DialogFragment sample
class MyAlertDialog: DialogFragment(){
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
return AlertDialog.Builder(activity)
.setMessage("Hello")
.setPositiveButton("OK") { _,_ -> dismiss() }
.create()
}
}
@kohendrix
kohendrix / index.js
Created February 5, 2019 08:51
Babel + es6 + Nodemon sample
'use strict';
var p = console.log;
import obj from './test_module';
(function() {
p('obj', obj);
try {
p('circleArea', obj.circleArea(5));
@kohendrix
kohendrix / test_module.js
Created February 5, 2019 08:52
Babel + es6 + Nodemon sample
'use strict';
var p = console.log;
const EQUATOR_KM = 6378;
var circleArea = radius => {
return Math.pow(radius, 2) * Math.PI;
};
@kohendrix
kohendrix / build.gradle
Created February 7, 2019 06:53
ext sample. project level
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.11'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
@kohendrix
kohendrix / build.gradle
Created February 7, 2019 06:54
ext sample. app level
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
applicationId "com.example.koheiando.twittervolleysample"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
@kohendrix
kohendrix / build.gradle
Created February 7, 2019 07:44
BuildTypes sample
...
buildTypes {
release {
debuggable false
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
zipAlignEnabled true
}
staging {
@kohendrix
kohendrix / btn_layout.xml
Created February 13, 2019 07:19
Android Button Animation Sample
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
xmlns:tools="http://schemas.android.com/tools"
@kohendrix
kohendrix / btn_on_click.xml
Created February 13, 2019 07:24
Android Button Animation Sample
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale
android:fromXScale="1.0"
android:toXScale="0.6"
android:fromYScale="1.0"
android:toYScale="0.6"
android:pivotX="50%"
android:pivotY="50%"
android:duration="300"
@kohendrix
kohendrix / ButtonAnimationFragment.kt
Created February 13, 2019 07:42
Android Button Animation Sample
override fun onViewCreated(view: View?, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
view?.apply {
// animation button
findViewById<Button>(R.id.btn).let { animBtn ->
animBtn.setOnClickListener {
animBtn.startAnimation(AnimationUtils.loadAnimation(activity, R.anim.btn_on_click))
}
}
}
@kohendrix
kohendrix / dynamo_client.js
Last active February 27, 2019 06:04
dynamodb client
const AWS = require('aws-sdk');
const config = require('config');
const p = console.log;
AWS.config.logger = console;
AWS.config.update({
sslEnabled: config.aws.sslEnabled,
accessKeyId: config.aws.accessKeyId,
secretAccessKey: config.aws.secretAccessKey,
region: config.aws.region,