Skip to content

Instantly share code, notes, and snippets.

View tk0miya's full-sized avatar

Takeshi KOMIYA tk0miya

View GitHub Profile
# frozen_string_literal: true
# ActiveYaml の association を Ransack で検索可能にする
module ActiveHash
module Ransackable
def ransackable_attributes(_auth_object = nil)
data.first.keys
end
def ransortable_attributes(auth_object = nil)
@tk0miya
tk0miya / tbls.yml
Last active May 11, 2022 18:34
Rails: DB スキーマの変更がマージされたら自動的に tbls を実行して main ブランチに push する
on:
push:
branches: [main]
paths:
- db/schema.rb
- .tbls.yml
permissions:
contents: write
@tk0miya
tk0miya / gist:8a376ae67d3bca7d10f4c80ca5cd86f8
Created August 9, 2020 10:01
broken help is shown if the signature of lambda has return_annotation
$ python
Python 3.8.2 (default, Mar 2 2020, 00:44:41)
[Clang 11.0.0 (clang-1100.0.33.17)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> foo = lambda x = 1: 1
>>> help(foo)
Help on function <lambda> in module __main__:
<lambda> lambda x=1
>>> import inspect
{% extends "!layout.html" %}
{% block content %}
<div class="notice" style="width: 100%; height: 24px; background-color: #ffe761; padding: 8px 20px 8px 20px;">
このページは新しめのやつなので気をつけておくれやす。 っ[ぶぶづけ]
</div>
{{ super() }}
{% endblock %}
From 551ad9efa5cc60a50e6f280e9aecdd12220693f1 Mon Sep 17 00:00:00 2001
From: Takeshi KOMIYA <i.tkomiya@gmail.com>
Date: Mon, 16 Mar 2020 00:38:21 +0900
Subject: [PATCH] doc: Fix messages in extensions are not translated
So far, custom extensions for python-doc have accessed internal data
structure of sphinx.locale module directly. But, it does not work at
present because the structure has changed since Sphinx-1.8 release.
This uses public translation APIs of Sphinx instead to get translated
messages.
latex_elements = {
'extrapackages': r'\usepackage{titlesec}',
'preamble': '\n'.join([
# 字下げ (なんでデフォルトで動かないんだろ?)
r'\setlength{\parindent}{1zw}',
# 段落調整、箇条書きの行間調整
r'\setlength{\parskip}{0ex}',
# 見出しの装飾
# ref: https://qiita.com/krtx/items/deeec0843caf37b66054
r'\definecolor{teal}{RGB}{0,128,128}',
@tk0miya
tk0miya / README
Last active September 1, 2020 06:21
preface and appendix for Sphinx
"""
autodoc: show default value of arguments as is
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:license: Same as Sphinx
"""
import ast
import inspect
from typing import Any, Dict
`````
CommonMark では fenced code block の終了は、開始マーカーと同じかそれ以上の backtick を必要とします。
```
ですので、まだここはコードブロックの中です。
``````````
そして、ここはコードブロックの外です。
また、fenced code block は backtick か tilde をマーカーに利用できると定義されているので
~~~
ここはコードブロックですし