Skip to content

Instantly share code, notes, and snippets.

fkm fkmhrk

Block or report user

Report or block fkmhrk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@fkmhrk
fkmhrk / MediaProjectionModel.java
Created Mar 24, 2020
MediaProjectionModel To Java
View MediaProjectionModel.java
public class MediaProjectionModel extends Activity {
private MediaProjectionManager mediaProjectionManager = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState)
mediaProjectionManager = <MediaProjectionManager>getSystemService(Service.MEDIA_PROJECTION_SERVICE);
startActivityForResult(mediaProjectionManager.createScreenCaptureIntent(), REQUEST_CAPTURE)
}
View is_kagawa.js
// 本スクリプトのご利用は自己責任でお願いします。
// もし本スクリプトの利用により損害等が発生したとき、著者は責任をおいかねます。
const isKagawa = () => {
if (window.confirm('本サービスはゲーム要素を含んでいます。あなたは香川県民ですか?')) {
window.location.href = '< replace here >';
return;
}
};
@fkmhrk
fkmhrk / index.html
Last active Oct 21, 2019
20191024練習問題用
View index.html
<html>
<head>
<title>CSS Lesson</title>
<style>
body,header,main {
margin: 0;
padding: 0;
}
header {
@fkmhrk
fkmhrk / moke.txt
Created Jul 23, 2019
binary mokera
View moke.txt
00000000
00 00
00 0 0
0 0 0 00 0
0 00 00 0
0 00 0 0 0 0
0 0000 0000 00
0 00 000000 0
0 0 0 0
@fkmhrk
fkmhrk / tax_test.py
Created Jun 21, 2019
「現金化するときに課税」モデルはどうなのか?
View tax_test.py
LOOP = 50
# Type 1. 現行のように、売却益がでた時点で20%課税する方式
def calcNext(v):
# 1.1倍になったら、売却
nextVal = v * 1.1
# 売却益に対して20%を税金とする
tax = (nextVal - v) * 0.2
return nextVal - tax, tax
@fkmhrk
fkmhrk / Moke.java
Created Aug 25, 2017
blocked switch
View Moke.java
public class Moke {
private void doSomething() {
switch (id) {
case 1: {
...
} break;
case 2: {
...
} break;
@fkmhrk
fkmhrk / chain.java
Created Mar 2, 2017
Method chain vs sequential statements
View chain.java
// We often see sequential method call.
AlertDialog.Builder builer = new AlertDialog.Builder(this);
builer.setTitle("タイトル");
builer.setMessage("メッセージ");
builer.setPositiveButton(android.R.string.ok, this.listener);
// We can use method chain.
AlertDialog.Builder builer = new AlertDialog.Builder(this);
.setTitle("タイトル")
.setMessage("メッセージ")
@fkmhrk
fkmhrk / rx.java
Created Nov 30, 2016
RxJavaで非同期処理
View rx.java
// https://github.com/mokelab/android-HTTPClient-Rx-OkHTTP
HTTPClient client = new HTTPClientImpl(new OkHttpClient());
// client.send()はObservableを返す
client.send(Method.GET, "https://gae-echoserver.appspot.com/test", null, null)
.subscribeOn(Schedulers.computation()) // sendの中身はワーカースレッドで実行する
.observeOn(AndroidSchedulers.mainThread()) // Observerの中はAndroidのメインスレッドで実行する
.subscribe(new Observer<HTTPResponse>() {
@Override
public void onSubscribe(Disposable d) { }
View gist:18147a201de6aba0f230
03-07 21:34:50.984 27340 27340 E AndroidRuntime: java.lang.RuntimeException: Unable to resume activity {org.twentyeight.momo/org.twentyeight.momo.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.contains(java.lang.CharSequence)' on a null object reference
03-07 21:34:50.984 27340 27340 E AndroidRuntime: at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3103)
03-07 21:34:50.984 27340 27340 E AndroidRuntime: at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3134)
03-07 21:34:50.984 27340 27340 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2481)
0
@fkmhrk
fkmhrk / DemoDialogFragment.java
Created Jul 16, 2015
Activityと(Dialog)Fragmentの連携をどうやるか
View DemoDialogFragment.java
public class DemoDialogFragment extends DialogFragment {
public static DialogFragment newInstance(int requestCode) {
DialogFragment dialog = new DemoDialogFragment();
Bundle args = new Bundle();
args.putBoolean(ARGS_CALLER_ACTIVITY, true);
args.putInt(ARGS_REQUEST_CODE, requestCode);
dialog.setArguments(args);
return dialog;
}
You can’t perform that action at this time.