Skip to content

Instantly share code, notes, and snippets.

View nosix's full-sized avatar

nosix nosix

View GitHub Profile
@nosix
nosix / AngularJSDialect.kt
Last active November 22, 2016 09:06
Spring Boot (1.4.2.RELEASE) + Thymeleaf (2.1.5) configuration sample (no escape single quote)
package xxx.thymeleaf
import org.thymeleaf.processor.IProcessor
import org.thymeleaf.spring4.dialect.SpringStandardDialect
class AngularJSDialect : SpringStandardDialect() {
companion object {
private val attributes = arrayOf(
"ng-class", "ng-model", "ng-show",
@nosix
nosix / Client.kt
Last active August 25, 2017 00:45
Usage of SQLite for Android (API Level 21) in Kotlin 1.0.4
package xxx
import android.content.Context
import xxx.Database
import xxx.SampleDB
class Client(context: Context) {
private val db = Database(context, SampleDB())
@nosix
nosix / Capture.kt
Created September 18, 2016 08:40
Taking a snapshot of the screen for Android (SDK 21) in Kotlin 1.0.3
package xxx
import android.content.Context
import android.graphics.Bitmap
import android.graphics.PixelFormat
import android.hardware.display.DisplayManager
import android.hardware.display.VirtualDisplay
import android.media.ImageReader
import android.media.projection.MediaProjection
import android.util.Log
@nosix
nosix / AndroidManifest.xml
Last active September 24, 2021 06:42
Floating App for Android (SDK 21) in Kotlin 1.0.3
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="xxx">
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<application
...
<service android:name=".FloatingAppService"/>
@nosix
nosix / activity_main.xml
Last active September 15, 2016 08:44
FloatingActionButton for Android (SDK 24)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="org.anyspirit.nsetting.MainActivity">
<android.support.design.widget.FloatingActionButton
@nosix
nosix / AndroidManifest.xml
Last active September 14, 2016 14:18
How to use Android Service API
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="xxx">
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission
android:name="android.permission.PACKAGE_USAGE_STATS"
tools:ignore="ProtectedPermissions" />
@nosix
nosix / README.txt
Last active December 7, 2016 05:08
Thymeleaf 2.1.5 snippet (ja)
https://github.com/nosix/thymeleaf-snippet-ja に移動
@nosix
nosix / text-to-speech.html
Created September 7, 2016 10:06
Text to Speech using Watson
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Text to Speech</title>
</head>
<body>
<div id="text-to-speech">
<input type="text" name="speech-text" placeholder="Sentence">
@nosix
nosix / AndroidManifest.xml
Last active November 17, 2022 14:17
Writting to external storage (SD card) for Android (SDK 23) in Kotlin 1.0.3.
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="xxx">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
...
</manifest>
@nosix
nosix / AndroidManifest.xml
Last active November 13, 2018 18:40
How to resolve the memory leak for Android (SDK 22) in Kotlin 1.0.2. (InputMethodManager refer to RecyclerView)
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="xxx">
<application
android:name=".MyApplication"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name">
...