Skip to content

Instantly share code, notes, and snippets.

@mitsugu
mitsugu / getkind.go
Created July 11, 2024 12:59
Nostr リレーサーバーから指定された kind のデータを取得するサンプル。
package main
import (
"context"
"fmt"
"log"
"time"
"github.com/nbd-wtf/go-nostr"
)

Go言語におけるレシーバーとは、特定の型に関連付けられた関数を定義するためのメカニズムです。レシーバーを使うことで、その型に対してメソッドを追加できます。これにより、関数がその型の変数と一緒に呼び出され、直感的かつ整理された方法でデータと機能を結びつけることができます。

レシーバーの概要

  1. レシーバーの種類:

    • 値レシーバー: 型の値を受け取ります。関数はその値のコピーを操作します。
    • ポインタレシーバー: 型のポインタを受け取ります。関数はその元の値を直接操作します。
  2. 使い方:

  • レシーバーを使って定義された関数を「メソッド」と呼びます。
function evaluateXPath(prefix, aNode, aExpr) {
//
// prefix : namespace
// aNode : DOM node
// aExpr : XPath text
//
// return value : DOM element or DOM node
//
// See URL for xpath expressions
// https://developer.mozilla.org/ja/docs/Web/XPath/Introduction_to_using_XPath_in_JavaScript#implementing_a_user_defined_namespace_resolver
@mitsugu
mitsugu / カメラやレンズのカビを防ぐ.md
Created June 8, 2024 02:40
カメラやレンズのカビを防ぐ

今日の講座のまとめ - カメラやレンズのカビを防ぐ

  • カメラを使う前に清掃してホコリ、皮脂等を取り除いておきましょう
  • カメラを使った後に片付ける前に清掃してホコリ、皮脂等を取り除きましょう
  • 清掃の手順
    1. ブロアでホコリを吹き飛ばす
    2. ホコリが残っていれば刷毛で優しくホコリを払う
    3. シリコンクロスで優しく皮脂などの汚れを落とす
    4. 落ちない場合は無理をせずに修理に出す
    5. 密閉した容器に乾燥剤と一緒にしまう

精神障害者交通機関割引

 会社ごとに内容が異なったり、旅客鉄道株式会社運賃減額第1種、第2種で取り扱いが異なるので注意。

交通機関 - 鉄道

@mitsugu
mitsugu / LoadTextMainMenuBar.java
Last active February 17, 2024 05:51
抜粋。
public LoadTextMainMenuBar() {
try {
// これではどうも resource ディレクトリの子供のディレクトリにはアクセスできないっぽい。
// jar ファイルの外のディレクトリにはアクセスできる。
File dicDir = Paths.get("src/main/resource/l18n").toFile();
URLClassLoader urlLoader = new URLClassLoader(new URL[]{dicDir.toURI().toURL()});
ResourceBundle rb;
rb = ResourceBundle.getBundle("RBMenu",Locale.getDefault(), urlLoader);
hmResult = new HashMap<String, String>();
@mitsugu
mitsugu / LICENSE
Last active November 28, 2023 02:44
Code to retrieve the bottom row data of the final sheet of a Libreoffice Calc document specified by URL and column number.
MIT License
Copyright (c) 2023 mitsugu oyama
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@mitsugu
mitsugu / Macro1.js
Created November 24, 2023 11:09
Hello World!! written JavaScript for Libreoffice Macro
importClass(Packages.com.sun.star.uno.UnoRuntime);
importClass(Packages.javax.swing.JOptionPane);
importClass(Packages.com.sun.star.sheet.XSpreadsheetDocument);
importClass(Packages.com.sun.star.frame.XModel);
importClass(Packages.com.sun.star.container.XIndexAccess);
importClass(Packages.com.sun.star.table.XCellRange);
importClass(Packages.com.sun.star.table.XCell);
// get Document Object
var doc = UnoRuntime.queryInterface(
あかし :hyogo_akashi: 地名
あしや :hyogo_ashiya: 地名
あしや :hyogo_ashiya: 地名
あだちく :tokyo_adachi: 地名
あまがさき :hyogo_amagasaki: 地名
いばらき :osaka_ibaraki: 地名
ゔぃむ :vim: 固有名詞
うぶんつ :ubuntu: 固有名詞
おうむ :parrot: 名詞
おおさか :osaka_osaka: 地名
{
"cream_puff": "https://i.imgur.com/hdCfrlU.png",
"dgm": "https://i.imgur.com/2Dzyb9n.png",
"hiroshima_hiroshima": "https://i.imgur.com/2MCRPDe.png",
"hiroshima_omichi": "https://i.imgur.com/rAvmDlb.png",
"hiroshima_pref": "https://i.imgur.com/4JmCjnU.png",
"hyogo_akashi":"https://i.imgur.com/2rm8tji.png",
"hyogo_amagasaki":"https://i.imgur.com/CW020rk.png",
"hyogo_ashiya":"https://i.imgur.com/19YlEqk.png",
"hyogo_himeji":"https://i.imgur.com/dg0a3M8.png",