Skip to content

Instantly share code, notes, and snippets.

View paraya3636's full-sized avatar

Keisuke Miura paraya3636

  • IGNIS LTD.
  • Japan, Tokyo, Ebisu
View GitHub Profile
@paraya3636
paraya3636 / sample.xml
Last active July 2, 2018 13:40
youtube sample.xml
<?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=".MainActivity">
<fragment
android:id="@+id/youtubePlayer"
@paraya3636
paraya3636 / test.kt
Last active July 2, 2018 09:48
Test
interface SampleInterface {
fun getText(context: Context): String
fun getValue(context: Context): Int
}
@paraya3636
paraya3636 / TopToBottomGradientDrawable.kt
Created May 16, 2018 09:14
[Android] programmatically gradient drawable
class TopToBottomGradientDrawable(startColor: Int, endColor: Int, width: Int, height: Int) : GradientDrawable(Orientation.TOP_BOTTOM, arrayOf(startColor, endColor).toIntArray()) {
init {
shape = RECTANGLE
bounds = Rect(0, 0, width, height)
}
}
@paraya3636
paraya3636 / resolveClass
Created March 7, 2018 05:10
fixed: WildcardTypeImpl cannot be cast to java.lang.Class
private Class<?> resolveClass(Type type) {
Class<?> clazz;
try {
clazz = (Class<?>) type;
} catch (ClassCastException e) {
Type wildcardType = ((WildcardType) type).getUpperBounds()[0];
clazz = (Class<?>) wildcardType;
}
return clazz;
}
@paraya3636
paraya3636 / TypeConverter.kt
Created February 16, 2018 09:12
Crash free j2k
fun variableNullability(variable: PsiVariable): Nullability = Nullability.Nullable
fun methodNullability(method: PsiMethod): Nullability = Nullability.Nullable
@paraya3636
paraya3636 / Camera.cs
Created February 2, 2018 04:45
追従するカメラ
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Camera : MonoBehaviour {
public Transform target;
void Start () {
target = GameObject.FindWithTag("Player").transform;
}
@paraya3636
paraya3636 / transparent_toolbar
Created July 20, 2017 06:04
Change toolbar alpha by ScrollView
// Notify scroll
class ObservableScrollView : ScrollView {
interface OnScrollChangeListener {
fun OnScrollChangeListener(scrollView: ObservableScrollView, x: Int, y: Int, oldX: Int, oldY: Int)
}
var onScrollChangeListener: OnScrollChangeListener? = null
constructor(context: Context) : this(context, null)
constructor(context: Context, attrs: AttributeSet?) : this(context, attrs, 0)
constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : super(context, attrs, defStyleAttr)
@paraya3636
paraya3636 / simpleModel.py
Created February 14, 2017 04:30
AND演算 by Python3.5 & Chainer1.12
#!/usr/bin/env/ python
# coding:utf-8
import numpy as np
import chainer.links as L
from chainer import functions as F
from chainer import Variable, optimizers, Chain
class Model(Chain):
def __init__(self):
@paraya3636
paraya3636 / simpleModel.py
Created February 14, 2017 04:27
OR演算 Python3.5&Chainer1.12
#!/usr/bin/env/ python
# coding:utf-8
import numpy as np
import chainer.links as L
from chainer import functions as F
from chainer import Variable, optimizers, Chain
class Model(Chain):
def __init__(self):
@paraya3636
paraya3636 / simpleModel.py
Last active February 14, 2017 04:09
与えられた値を2倍にする by Python3.5 & Chainer1.12
#!/usr/bin/env/ python
# coding:utf-8
import numpy as np
import chainer.links as L
from chainer import functions as F
from chainer import Variable, optimizers, Chain
class Model(Chain):
def __init__(self):