Skip to content

Instantly share code, notes, and snippets.

View rainbow23's full-sized avatar
🏠
Working from home

rainbow23 rainbow23

🏠
Working from home
View GitHub Profile
@rainbow23
rainbow23 / gist:134d629adb64a9ef304e52a7644e5ef4
Last active September 5, 2025 06:48
bashrc 入力中の文字列をvimに表示する方法
# 現在の行を Vim で編集し、結果をプロンプトに戻す(自動実行しない)
__edit_line_in_vim() {
local tmp
tmp=$(mktemp /tmp/cmd.XXXXXX)
printf '%s\n' "$READLINE_LINE" > "$tmp"
"${VISUAL:-${EDITOR:-vi}}" "$tmp" < /dev/tty > /dev/tty 2>&1
READLINE_LINE="$(cat "$tmp")"
READLINE_POINT=${#READLINE_LINE}
rm -f "$tmp"
}
import android.content.Context;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.drawable.AdaptiveIconDrawable;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.util.TypedValue;
import androidx.core.content.ContextCompat;
static final String CHANNEL_ID = "orders";
static final String GROUP_KEY = "group_orders";
void postGroupedNotifications(Context ctx) {
NotificationManager nm = ctx.getSystemService(NotificationManager.class);
if (Build.VERSION.SDK_INT >= 26) {
NotificationChannel ch = new NotificationChannel(
CHANNEL_ID, "Orders", NotificationManager.IMPORTANCE_DEFAULT);
nm.createNotificationChannel(ch);
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
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">
<!-- 画面中央の垂直ガイドライン(比率は必要に応じて調整) -->
<androidx.constraintlayout.widget.Guideline
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">
<!-- 1つ目:CheckBox -->
<CheckBox
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/keypad_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">
<!-- 1 -->
@rainbow23
rainbow23 / gist:29213f22cac5b71efad63d93dc7a5976
Last active June 16, 2019 18:55
ページング実装 課題
まだ調査していない
・リリース手順書 確認
* 調査済
・Fuel phpページングでボタンデザインを有効表示できるか?
pagination.phpでデフォルトしか読み込めないようなのでcontrollerで指定したら出来た
https://github.com/rainbow23/fuelphp/blob/1.8/master/fuel/app/classes/controller/welcome.php#L49-L83
資料sample
@rainbow23
rainbow23 / サンプル
Created June 16, 2019 15:34
ループで0-4になる対応の改善案
<?php
$sample = array(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
$begin = 0;
$end = 5;
/*
* 0
* 1
* 2
* 3
* 4
@rainbow23
rainbow23 / b.rb
Last active October 17, 2022 07:55 — forked from junegunn/b.rb
b - browse Chrome bookmarks with fzf
#!/usr/bin/env bash
# vim: set filetype=ruby:
# b - browse Chrome bookmarks with fzf
[ $(uname) = Darwin ] || exit 1
which fzf > /dev/null 2>&1 || brew reinstall --HEAD fzf || exit 1
/usr/bin/ruby -x "$0" |
fzf --ansi --multi --no-hscroll --tiebreak=begin |
awk 'BEGIN { FS = "\t" } { print $2 }' |
<?php
ignore_user_abort(true);
function syscall ($cmd, $cwd) {
$descriptorspec = array(
1 => array('pipe', 'w'), // stdout is a pipe that the child will write to
2 => array('pipe', 'w') // stderr
);
$resource = proc_open($cmd, $descriptorspec, $pipes, $cwd);
if (is_resource($resource)) {