Skip to content

Instantly share code, notes, and snippets.

module FieldAlias
#列挙タイプのエイリアス定義
#ex define_alias_enum(:original, :alias, {0 => "NG", 1 => "OK", nil => "-", other: "不明"})
###from
#def receipt_status
# case receipt
# when 0
# "-"
# when 1
module ModelFormat
#fields = [
# ["column1", :method1],
# ["column2", :method2],
# ["column3", [:method3_1, :method3_2]],
#]
def define_csv(fields)
define_method :to_csv do
headers, columns = fields.transpose
@adeonhy
adeonhy / aaaaa
Created January 4, 2013 12:26
aaaaaaa
this file is test.
#!/bin/bash
BASE_URL='http://www.nichibi-chinese.com'
LIST_URL='http://www.nichibi-chinese.com/web-lesson'
LIST=$(curl ${LIST_URL} \
| egrep '<li class=\"page_item page-item-\d*\">' \
| gsed 's/.*<a href=\"\(.*\)\">\(.*\)<\/a><\/li>.*/\1,\2/' \
| gsed 's/\s\+/_/g' \
| grep -v '%' \
@adeonhy
adeonhy / kusa.js
Last active December 13, 2017 14:11
'use strict'
const svg = (width, height, opts, f) => {
return tag('svg', Object.assign(
{},
{width: `${width}px`, height: `${height}px`},
opts
), f)
}
@adeonhy
adeonhy / notify_mining.sh
Created January 3, 2018 17:23
ETHマイニング状況をslackに投げるやつ
ETH_POOL_URL=https://ethermine.org/miners/XXXXXXX
SLACK_CH=XXXXXXX
wget $ETH_POOL_URL -O - 2>/dev/null \
| w3m -dump -cols 2000 -T 'text/html' \
| grep -E 'Unpaid Balance.*ETH' \
| slack-cli -d $SLACK_CH
{
"description": "Shiftを単体で押したときに、(/)キーを送信する。(左Shiftは(、右Shiftは) )",
"manipulators": [
{
"from": {
"key_code": "left_shift",
"modifiers": {
"optional": [
"any"
]
@adeonhy
adeonhy / karabiner_mouse_button45.json
Created July 11, 2018 01:25
Karabiner-Elementsでマウスのボタン4/5にキー割り当て
{
"title": "マウスのButton4/5にキーを割り当てる",
"rules": [
{
"description": "Button5 -> Cmd-h, Button4 -> Cmd-l",
"manipulators": [
{
"type": "basic",
"from": {
"pointing_button": "button5"

Layer切り替え系

  • DF(layer) デフォルトレイヤーを変更。テンキーモード、GAMEモードなど
  • MO(layer) 押している間だけレイヤーを変更
  • LM(layer, mod) As MO(layer) but with mod active
  • LT(layer, kc)
  • TG(layer) Toggles the layer (enables it if no active, and vise versa)
  • TO(layer) Activates layer and deactivates all other layers
  • TT(layer) Momentarily activates layer if held, toggles it if tapped repeatedly
@adeonhy
adeonhy / trackball_gb.md
Last active September 20, 2018 13:31
トラックボールモジュールGBについて