Skip to content

Instantly share code, notes, and snippets.

View nosix's full-sized avatar

nosix nosix

View GitHub Profile
@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 / 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 / README.txt
Last active December 7, 2016 05:08
Thymeleaf 2.1.5 snippet (ja)
https://github.com/nosix/thymeleaf-snippet-ja に移動
@nosix
nosix / pidep
Last active December 16, 2016 17:02
bash command to deploy and run python on remote Raspberry Pi.
#!/bin/bash
CMD=`basename $0`
usage() {
echo "Usage: $CMD [-r script] [-d dst] [-s src]" 1>&2
}
COMMAND=
DST=
@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 / after.kt
Created September 4, 2017 06:04
convert deprecated @nativeGetter/@nativeSetter to inline extension function
external interface MethodMap
inline operator fun MethodMap.get(propertyName: String): Function<Any>? = this.asDynamic()[propertyName]
inline operator fun MethodMap.set(propertyName: String, value: Function<Any>?) {
this.asDynamic()[propertyName] = value
}
@nosix
nosix / generated_sample.js
Last active September 5, 2017 03:07
union type in Kotlin/JS
function sample$lambda() {
return 'Bar';
}
function sample() {
var v1 = 'Foo';
var v2 = sample$lambda;
}
@nosix
nosix / MainActivity.kt
Last active May 26, 2018 02:22
DialogFragment for Android (SDK 22) in Kotlin 1.0.2
class MainActivity : AppCompatActivity(), SeekDialogFragment.SeekDialogListener {
companion object {
private val TAG = MainActivity::class.qualifiedName;
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
@nosix
nosix / ExampleTest.kt
Created July 12, 2018 03:56
pass JSONCompareMode to JSONAssert when testing with WebTestClient
@RunWith(SpringRunner::class)
@SpringBootTest
@AutoConfigureWebTestClient
class ExampleTests {
@Autowired
private lateinit var client: WebTestClient
@Test
fun test_of_get() {
client.get().uri("/api/todo")
@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">
...