This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun MutableLiveData<Boolean>.bindTo(viewLifecycleOwner: LifecycleOwner, snackbar: Snackbar) { | |
observe(viewLifecycleOwner) { isVisible -> | |
if (isVisible && !snackbar.isShownOrQueued) { | |
snackbar.show() | |
} else if (!isVisible && snackbar.isShownOrQueued) { | |
snackbar.dismiss() | |
} | |
} | |
val callback = object : Snackbar.Callback() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data class User(val firstName: String, val lastName: String, val gender: Gender) | |
enum class Gender { | |
Male, Female, Other | |
} | |
class HogeActivity: Activity() { | |
lateinit var user: User | |
fun onCreate(savedInstanceState: Bundle) { | |
user = //なんかで作る |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.support.v4.widget.DrawerLayout | |
import android.support.v4.widget.DrawerLayout.SimpleDrawerListener | |
import android.view.View | |
fun DrawerLayout.closeDrawerAndRun(drawerView: View, block: DrawerLayout.(view: View?) -> Unit): Unit { | |
addDrawerListener(object : SimpleDrawerListener() { | |
override fun onDrawerClosed(drawerView: View?) { | |
this@closeDrawerAndRun.block(drawerView) | |
this@closeDrawerAndRun.removeDrawerListener(this) | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use 5.018_001; | |
use warnings; | |
use Web::Query; | |
my $q = Web::Query->new_from_file("data.html"); | |
my $table = []; | |
$q->find('table.csv2table-table tr')->each( | |
sub { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
機体名 | 項目名 | 箇所 | 変更前 | 変更後 | |
---|---|---|---|---|---|
ジム | 機体 | アーマー | 960 | 1230 | |
ジム | 100mmマシンガン訓練型 | 威力 | 350 | 400 | |
ジム | 100mmマシンガン | 威力 | 550 | 600 | |
ジム | 100mmマシンガン改良型H | 威力 | 450 | 550 | |
ジム | ビームサーベル軽量型 | 威力 | 2500 | 3000 | |
初期型ジム | 機体 | アーマー | 1040 | 1330 | |
初期型ジム | 100mmマシンガン | 威力 | 550 | 600 | |
初期型ジム | 100mmマシンガン改良型H | 威力 | 450 | 550 | |
初期型ジム | 100mmマシンガン改良型M | 威力 | 450 | 500 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript { | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:0.5.+' | |
} | |
} | |
apply plugin: 'android' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
GIT_VER=1.8.0 | |
mkdir -p /usr/local/src | |
cd /usr/local/src | |
curl -LO "http://git-core.googlecode.com/files/git-$GIT_VER.tar.gz" | |
tar zxvf git-$GIT_VER.tar.gz | |
cd git-$GIT_VER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use 5.014001; | |
use warnings; | |
package Xpost::Email { | |
use Data::Recursive::Encode; | |
use Email::Sender::Simple qw(sendmail); | |
use Email::Sender::Transport::SMTP::TLS; | |
use Email::Simple; | |
use Email::Simple::Creator; | |
use Encode; | |
use File::Spec; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use Data::Dumper; | |
# 入力ファイルはこんなかんじで | |
# ....... | |
# ...AA.. | |
# ..BB... | |
# ..BBC.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use SWF::Editor; | |
use SWF::Editor::Tag::DoAction::SetVariables; | |
my $editor = SWF::Editor->new(file => '/path/to/file.swf'); | |
my $tag = SWF::Editor::Tag::DoAction::SetVariables->new( | |
vars => { |
NewerOlder