Skip to content

Instantly share code, notes, and snippets.

View yagi2's full-sized avatar
❤️
I love Virtual World.

Itsuki Aoyagi yagi2

❤️
I love Virtual World.
View GitHub Profile
@yagi2
yagi2 / MinimumLruCache.kt
Last active October 31, 2019 06:57
Minimum LruCache class written in Kotlin
import java.util.LinkedHashMap
/**
* NOTE: Be careful when using it because it does not handle errors.
*
* @param maxSize maximum number of entries in the cache.
* @param sizeOf returns the size of entry for key, and value in user defined units. the default returns 1 so that size is the number of entries.
*/
class MinimumLruCache<K, V>(private val maxSize: Int, private val sizeOf: (key: K, value: V) -> Int) {
@yagi2
yagi2 / AndroidActual.kt
Created September 12, 2019 13:27
技術書典7 「私はマルチプラットフォームアプリ ケーション開発の夢をみるか?」 サンプルコード
actual fun getHandTextEachPlatform(type: JankenHandType): String {
return when (type) {
JankenHandType.STONE -> "🔥"
JankenHandType.SCISSORS -> "💧"
JankenHandType.PAPER -> "🍀"
}
}

Keybase proof

I hereby claim:

  • I am yagi2 on github.
  • I am yagi2 (https://keybase.io/yagi2) on keybase.
  • I have a public key ASC-KF2tnWom_xRNagQxvYEhXkJgI6uHbvNTQw1p7eL91wo

To claim this, I am signing this object:

@yagi2
yagi2 / Piyo.kt
Last active May 23, 2019 13:18
RecyclerView擬似コード2
// アクティビティクラス
class MainActivity : AppCompatActivity {
override fun onCreate(savedInstanceState: Bundle) {
...
// アダプター作成
val adapter = HogeRecyclerViewAdapter()
// RecyclerViewにアダプターをセット
@yagi2
yagi2 / Hoge.kt
Last active May 23, 2019 13:19
RecyclerView疑似コード
// アクティビティクラス
class MainActivity : AppCompatActivity {
override fun onCreate(savedInstanceState: Bundle) {
...
// アダプター作成
val adapter = HogeRecyclerViewAdapter()
// RecyclerViewにアダプターをセット
ζ*'ヮ')ζ < ./gradlew clean --stacktrace 15:23:00
Parallel execution with configuration on demand is an incubating feature.
> Configure project :app
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Failed to notify project evaluation listener.
@yagi2
yagi2 / keymap.c
Last active January 16, 2018 02:25
/* Default
* ,-----------------------------------------------------------------------------------.
* | Tab | / | , | . | F | Q | M | R | D | Y | P | Bksp |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Ctrl | A | O | E | I | U | G | T | K | S | N | Enter|
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| Z | X | C | V | W | B | H | J | L | ; |'/Sft |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Esc |Adjust| Alt | GUI |英数/L |Space |Space |かな/R | Left | Up | Down |Right |
* `-----------------------------------------------------------------------------------'
@yagi2
yagi2 / keymap.c
Last active January 16, 2018 02:24
/* Default
* ,-----------------------------------------------------------------------------------.
* | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Ctrl | A | S | D | F | G | H | J | K | L | ; | Enter|
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | N | M | , | . | / |'/Sft |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Esc | Adjust| Alt | GUI |英数/L |Space |Space |かな/R | Left | Up | Down |Right|
* `-----------------------------------------------------------------------------------'
@yagi2
yagi2 / mmm.rb
Created July 13, 2015 01:40
Mラジ自動保存スクリプト
# -*- coding: utf-8 -*-
# cron: 0 12 * * 5 /path/to/ruby /path/to/mmm.rb >/dev/null 2>&1
if Time.now.friday? && ((Time.now.day > 7 && Time.now.day <= 14) || (Time.now.day > 21 && Time.now.day <= 28)) then
mmm_day = Time.now.strftime("%Y%m%d").to_s
rtmpdump = '/usr/bin/rtmpdump'
mmm_stream_url = "rtmp://051.mediaimage.jp/marine-str/media/mp3:mmm" + mmm_day
current = '/home/hoge/Dropbox/agqr'
save_dir = "#{current}/data/flv"
@yagi2
yagi2 / README
Last active December 27, 2018 06:12 — forked from ybenjo/README.md
agqr自動録画(forkしてオレオレedit)
forkしてつかってます。
fork元との変更点はRubyのバージョンのせいですが.to_hの廃止,currentを直書き,flvがいらないものに関しては自動削除。
僕が書いてるcronは
29,59 * * * * /hoge/piyo/bin/ruby /hoge/huga/poko/agqr.rb
agqr.rbとschedule.yamlは同じディレクトリに,そしてそのディレクトリにはdataディレクトリを作ってその中にflvとmp3を作りましょう。
schedule.yamlのかきかた