Skip to content

Instantly share code, notes, and snippets.

@hiroki-uchida
hiroki-uchida / README.md
Last active December 4, 2023 01:18
mermaid.js Git-flow
lib_deps =
	bblanchon/ArduinoJson@^6.21.2
	256dpi/MQTT@^2.5.1

mqtt_handler.h

@hiroki-uchida
hiroki-uchida / README.md
Last active June 22, 2023 03:47
GoogleSpreadSheetをRubyで操作するメモ

基本

require 'google_drive'

# Googleドライブセッションを開始
session = GoogleDrive::Session.from_service_account_key("/app/credentials.json")

# スプレッドシートを開く(スプレッドシートのURLを指定)
spreadsheet = session.spreadsheet_by_url("https://docs.google.com/spreadsheets/d/")
@hiroki-uchida
hiroki-uchida / README.md
Last active January 11, 2023 23:50
UbuntuでLUA4-U3-AGTを使う

BUFFALO LUA4-U3-AGT

指すだけで使えた ドライバーのインストール不要

OS

$ cat /etc/issue
Ubuntu 22.04.1 LTS \n \l
@hiroki-uchida
hiroki-uchida / README.md
Last active December 19, 2022 05:04
Jestでprocess.envに依存したテストを書く

Jestでprocess.envに依存したテストを書く

Jestprocess.env に依存したテストを書くには、次のような方法があります。

  1. テストを実行する前に、 process.env プロパティを手動で設定する
  2. setupTestFrameworkScriptFile を使用して、 Jest が自動的に環境変数を設定するようにする
  3. setupFiles オプションを使用して、 Jest で環境変数を設定する
  4. setupFilesAfterEnv オプションを使用して、 Jestで環境変数を設定する

上記のいずれかの方法を使用することで、Jestprocess.env に依存したテストを書くことができます。

@hiroki-uchida
hiroki-uchida / document.md.erb
Created November 5, 2017 13:46
autodoc with curl
<% # coding: UTF-8
# Generate curl options
curl_options = []
# request
curl_options << "-X #{method} https://#{request.host}#{request.path}"
# headers
table = request_header_from_fixed_keys
@hiroki-uchida
hiroki-uchida / wercker.yml
Created October 25, 2017 14:47
Wercker で Ruby + Node.js + Yarn な環境を作る
# ---
# File: wercker.yml
# ---
box: ruby:2.4.2
build:
steps:
- install-packages:
packages: nodejs npm
@hiroki-uchida
hiroki-uchida / Gemfile
Last active October 25, 2017 13:57
middlemanでhtmlを圧縮した状態でbuildする方法
# ---
# File: Gemfile
# ---
# この行を追加
gem 'middleman-minify-html'
@hiroki-uchida
hiroki-uchida / example_spec.rb
Last active December 7, 2023 07:26
RSpec で Rake Task のテストをクリーンに書く
# File: spec/tasks/send_invoices_spec.rb
require "rails_helper"
describe "rake billing:send_invoices", type: :task do
it "Rails environment を読み込んでいること" do
expect(task.prerequisites).to include "environment"
end
@hiroki-uchida
hiroki-uchida / default.rb
Created October 23, 2017 00:37
itamae cookbook ssh examples.
# ./cookbooks/ssh/default.rb
template '/etc/ssh/sshd_config'
service 'sshd' do
action %i[reload enable]
end