Skip to content

Instantly share code, notes, and snippets.

@koifish082
koifish082 / 0_reuse_code.js
Created March 20, 2014 03:57
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@koifish082
koifish082 / toString.kt
Last active March 28, 2018 01:37
Kotlin - cast to String
val milliSec: Int = getMilliSec()
val milliSecStr: String = milliSec.toString()
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
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"
android:orientation="vertical"
android:background="@color/black"
tools:context=".presentation.view.profile.MyProfileFragment">
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".presentation.view.profile.MyProfileFragment">
<android.support.v7.widget.Toolbar
android:id="@+id/myProfileToolbar"
class MyProfileAdapter(
private var items: List<Favorite>,
private val myProfileViewModel: MyProfileViewModel,
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
// -----------------
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
when (viewType) {
TYPE_HEADER -> {
return MyProfileViewHolderHeader(LayoutInflater
@koifish082
koifish082 / list_utils.py
Created August 24, 2018 01:02
list_key_exist: It's like array_key_exists in php
class ListUtil:
@staticmethod
def list_key_exist(sample_list, index):
if len(sample_list) > index:
print(sample_list[index])
return
print("-1")
from typing import List
from PIL import Image
import os
from zipfile import ZipFile, ZIP_DEFLATED
import glob
class Resize:
def __init__(self, root_dir_path: str, resize_param_list: List[object]):
package presentation.utils;
import javafx.embed.swing.SwingFXUtils;
import javafx.scene.image.ImageView;
import javafx.scene.image.WritableImage;
import org.apache.batik.transcoder.TranscoderException;
import org.apache.batik.transcoder.TranscoderInput;
import org.apache.batik.transcoder.image.PNGTranscoder;
import java.awt.image.BufferedImage;
import java.io.FileNotFoundException;
package presentation;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.concurrent.Task;
import javafx.stage.Stage;
import presentation.navigator.MenuNavigator;
public class MainApp extends Application {
package jp.co.sample.presentation.navigation;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.support.v4.app.FragmentManager;
import jp.co.sample.R;
import jp.co.sample.utils.DialogUtils;
import timber.log.Timber;