Skip to content

Instantly share code, notes, and snippets.

View ryym's full-sized avatar
♨️
Now loading...

Ryutaro Yamada ryym

♨️
Now loading...
  • Tokyo / Japan
View GitHub Profile
@ryym
ryym / custom-us.json
Last active March 18, 2022 08:13
karabiner complex_modifications
{
"title": "Custom US",
"description": "Improve US / Use JIS as US",
"rules": [
{
"description": "[US] Fn keys for eisuu/kana",
"manipulators": [
{
"from": {
"key_code": "f20",
@ryym
ryym / README.md
Created June 23, 2020 00:09
rails-server-generated-js-mixed

Rails の remote: true な form (など?) で JS を返すパターン案2。案1 よりもシンプル。

考えた事:

  • form の送信前後で JS を走らせたい場合、送信前の処理は assets 内の JS で、送信後の処理は views 内の JS で書くといった分断が起きうる。 関連するコードは近くに置きたい。
  • webpack の transpile 対象にしたい。
  • HTML の動的作成は JS ではなく Rails のパーシャルを使うように統一するのが良さそう。
@ryym
ryym / README.md
Created June 22, 2020 23:52
rails-server-generated-js-webpacker

Rails の remote: true な form (など?) で JS を返すパターン案1。 views 内に JS を置くだけだと以下のような問題があるので、

  • 他の JS とコードの共有がしづらい。
  • webpack による transpile が使えない。
  • ERB などの埋め込みの使い方によっては Prettier などが使えない。

webpack 管理の JS を返してみる。方法は単純に webpack の JS を読む script タグを追加するだけ。値の受け渡しにもその script を使う。

  • good: webpack 内でコードを管理できる。
  • bad: 必要な script を得るのにサーバまで2往復必要。
@ryym
ryym / vixen
Created November 17, 2018 04:30
{
"keymaps": {
"0": { "type": "scroll.home" },
":": { "type": "command.show" },
"o": { "type": "command.show.open", "alter": false },
"O": { "type": "command.show.open", "alter": true },
"tt": { "type": "command.show.tabopen", "alter": false },
"T": { "type": "command.show.tabopen", "alter": true },
"w": { "type": "command.show.winopen", "alter": false },
"W": { "type": "command.show.winopen", "alter": true },
@ryym
ryym / cloudSettings
Last active June 22, 2022 06:24
Visual Studio Code Settings Sync Gist
{"lastUpload":"2019-12-23T12:17:52.993Z","extensionVersion":"v3.4.3"}
@ryym
ryym / addr-trait.rs
Created August 22, 2018 11:54
rust-actix-web
// - Actor にメッセージを投げたい。
// - Addr を差し替えられるようにしたい。
// - Recepient を使っても良いかも。
use super::hub::Hub;
use super::msg;
use super::prelude::*;
use super::tmpl;
use actix::prelude::*;
use actix_web::{
# require 'tempfile'
require 'mini_magick'
require 'google/cloud/storage'
require 'marcel'
storage = Google::Cloud::Storage.new(
project_id: 'hello-gcp2',
credentials: 'gcp-cred.json',
)
@ryym
ryym / karabiner-improve-quotes.json
Created February 13, 2018 23:14
@ -> ', ` -> ", " -> @, ' -> ` (JIS keyboard)
{
"title": "Swap @,` and ',\"",
"rules": [
{
"description": "@ to single quote",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "open_bracket",
rails new \
--skip-action-mailer \
--skip-action-cable \
--skip-sprockets \
--skip-javascript \
--skip-turbolinks \
your_app_name
ext {
defaultEncoding = 'UTF-8'
}
apply {
plugin 'java'
}
repositories {
mavenLocal()