Skip to content

Instantly share code, notes, and snippets.

View wakwak3125's full-sized avatar
💭
😎 📱

Ryo Sakaguchi wakwak3125

💭
😎 📱
View GitHub Profile
@wakwak3125
wakwak3125 / FizzBuzzKotlin.kt
Last active August 29, 2015 14:23
Simple FizzBuzz Kotlin.
fun main(args : Array<String>) {
val fzbz = ::FzBz
fzbz(1000)
}
// countの数までFizzBuzzする
fun FzBz(count : Int) {
for (i in 1..count) {
if (i % 3 == 0 && i % 5 == 0){println("FizzBuzz")}
else if (i % 3 == 0) {println("Fizz")}
else if (i % 5 == 0) {println("Buzz")}
@wakwak3125
wakwak3125 / NabeAtsu.kt
Created June 27, 2015 04:42
ナベアツをKotlinで…
fun main(args : Array<String>) {
for(num in 1..40){
val aho1 = num % 3 == 0
val aho2 = num.toString().contains("3")
val result = if (aho1 || aho2){
"アホ"
} else{
num
}
@wakwak3125
wakwak3125 / ChangeSnackBarTextColorSample
Last active January 11, 2016 15:59
SnackBarの文字色を自由に設定する方法 ref: http://qiita.com/wakwak3125/items/79e0097767be5b2ea798
public class MainActivity extends AppCompatActivity {
@Bind(R.id.root)
LinearLayout root;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
@wakwak3125
wakwak3125 / ExampleUnitTest
Created January 14, 2016 17:17
LeakCanary + Robolectricでテストするときの注意 ref: http://qiita.com/wakwak3125/items/1cae809dbfa6e68b5890
@RunWith(RobolectricGradleTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 21, packageName = "com.wakwak.leakcanarytest")
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
@wakwak3125
wakwak3125 / file0.txt
Created February 12, 2016 16:09
Localeを指定して特定のstringを取得する方法 ref: http://qiita.com/wakwak3125/items/24f9c8388c75c1fabe0d
Resources resources = getResources();
Configuration configuration = resources.getConfiguration();
configuration.setLocale(Locale.ENGLISH); // ここで取得したいLocaleを指定します。
resources.updateConfiguration(configuration, null); // updateConfigurationを忘れずに…
// ここ以降で取得したstringはEngrishとなります。
// 取得したstringでなにかする。setText()とか…
configuration.setLocale(Locale.getDefault()); // 設定を元に戻すのを忘れないように。
@wakwak3125
wakwak3125 / 2016-11-10_m_android_fcr.md
Last active November 14, 2016 15:34
LocaleListのコードを読んでみました。 m_android_fcr 2016_11_10

LocaleList読むぞ

LocaleListのコンストラクタを見てみます。

  • LocaleList(Locale...)で同じLocaleいれるとIAEでおちる。
    • たとえばLocale.JAPANEとLocale.JAPANとか。
    • Locale.JAPANとLocale.JAPANESEなら落ちない。これで大丈夫なんかな…?
/**
@wakwak3125
wakwak3125 / changelog_generator.rb
Last active November 15, 2016 12:50
Script for generate change logs from app/build.gradle.
#!/usr/bin/env ruby
app_version = ''
file_names = []
changelog_contens_ja = []
changelog_contens_en = []
gradle_path = '../app/build.gradle'
# These files are base change log.
changelog_path_ja = '../change_log_ja.txt'
@wakwak3125
wakwak3125 / GifDecoder.java
Created May 25, 2017 11:26 — forked from devunwired/GifDecoder.java
An optimized implementation of GifDecoder for Android devices.
/**
* Copyright (c) 2013 Xcellent Creations, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
@wakwak3125
wakwak3125 / SwipeToDeleteCallback.java
Created March 6, 2018 09:15
SwipeToDeleteCallback.java
/**
* Created by Ryo on 2018/03/06.
*/
public abstract class SwipeToDeleteCallback extends ItemTouchHelper.SimpleCallback {
private ColorDrawable mBackgroundColorDrawable = new ColorDrawable();
private Drawable mSwipeBackIcon;
public SwipeToDeleteCallback(@NonNull Drawable swipeIcon, @ColorInt int swipeBackgroundColor) {
@wakwak3125
wakwak3125 / rolling_builds.md
Last active July 9, 2018 16:25
[Bitrise] Behavior of Rolling Builds

ROLLING BUILDS

  • BitriseのRolling Buildsの挙動をまとめる
  • また並列ビルドを行った際の挙動もちょっと触れる

About Rolling Builds

  • 同一ブランチに対するpushがあった場合に前回のビルドをキャンセルする機構

並列ビルド

  • Bitriseはこのステップで自身の公開APIを叩いて、新しいビルドをキックしている