Skip to content

Instantly share code, notes, and snippets.

@kohendrix
kohendrix / index.ejs
Last active February 28, 2019 08:42
Google Sign-in Express + pjs
<!DOCTYPE html>
<html>
<head>
<title><%= title %></title>
<link rel="stylesheet" href="/stylesheets/style.css" />
<script src="https://apis.google.com/js/platform.js" async defer></script>
<meta name="google-signin-client_id" content="<%= clientIdUrl %>" />
<script>
// called by google client
function onSignIn(googleUser) {
@kohendrix
kohendrix / docker-compose.yml
Last active March 1, 2019 07:21
node + mysql setup
version: '3'
services:
app:
build:
context: .
dockerfile: ./node/Dockerfile
container_name: node_app
ports:
- '3000:3000'
@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,
@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 / 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 / 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 / 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 / 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 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 / 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;
};