Skip to content

Instantly share code, notes, and snippets.

View unak's full-sized avatar

usa unak

View GitHub Profile
@unak
unak / ruby-mswin64-202204.md
Last active November 11, 2023 06:45
RubyをVisual C++でビルドする 2022.04版(+2022.12・2023.06追記)

Visual C++をインストールする

というか、Visual Studioになるわけだが。 普通はCommunity Editionで問題ないと思うが、用途に応じてライセンスを選ぶこと。 インストールする際には、Windowsデスクトップ開発とかいうのを選ぶ。他はお好みで。 あー、確認してないけど、英語の言語パックは入れた方が多分いいです。入れないとだめかもしれない(thx hsbtさん)。

vcpkgをインストールする

GitHubにあるので、READMEの手順に従えばいい。 この過程でgitも入ることになる。

@unak
unak / show_dependency_tree_of_rails.rb
Created January 29, 2015 16:59
Show dependency tree of Rails
#!ruby
require "rubygems/dependency"
require "rubygems/spec_fetcher"
def fetch_spec(dep)
dep = Gem::Dependency.new(dep, :runtime) unless dep.is_a?(Gem::Dependency)
Gem::SpecFetcher.fetcher.spec_for_dependency(dep).first.map{|spec, src| spec}.last
end
$spec_cache = []
@unak
unak / history.txt
Last active November 29, 2021 01:40
The History of Ruby
* Only the releases of the stable versions are listed in principle. The releases of the unstable versions especially considered to be important are indicated as "not stable."
* The branches used as the source of each releases are specified, and the branching timing of them are also shown. BTW, before subversionizing of the repository, the term called "trunk" was not used, but this list uses it in order to avoid confusion.
* In order to show a historical backdrop, big conferences (RubyKaigi, RubyConf and Euruko) are also listed. About the venues of such conferences, general English notations are adopted, in my hope.
* ruby_1_8_7 branch was recut from v1_8_7 tag after the 1.8.7 release because of an accident.
* 1.2.1 release was canceled once, and the 2nd release called "repack" was performed. Although there were other examples similar to this, since the re-releases were performed during the same day, it does not write clearly in particular.
* Since 1.0 was released with the date in large quantities, the mi
@unak
unak / helix.md
Last active February 3, 2021 14:14
Helixで左右どっちのボードにUSBケーブルを繋いでも使えるようにする

Helixのファームウェアは左手側のボードにUSBケーブルを繋ぐことを前提に作られている。 が、右手側に繋ぎたいことだってあるじゃん? というわけで、どっちに繋いでも使えるようにしてみた。

まず、自分の使ってるファームウェアのディレクトリ内(例えばkeyboards/helix/rev2/keymaps/default)のkeymap.cの冒頭付近、

extern keymap_config_t keymap_config;

の直前くらいに、

class A
def initialize
p :A
end
end
class B < A
def initialize
p :B
end
@unak
unak / constraint.rb
Last active October 26, 2019 17:29
type constraint
class Module
class ConstraintError < TypeError; end
def where(meth, constraint)
m = Module.new do
define_method(meth) do |*args|
args.zip(constraint.keys.first) do |arg, t|
raise ConstraintError, "type #{t} is expected, but #{arg.inspect} is passed" unless arg.is_a?(t)
end
ret = super(*args)
@unak
unak / allruby.cmd
Last active December 15, 2017 09:06
allruby script for Windows
@echo off
C:\opt\ruby\bin\ruby.exe -x %~f0 %*
goto :EOF
#!ruby
require "yaml"
cache = File.join(File.dirname(__FILE__), "allruby.cache")
if File.exist?(cache)
rubies = YAML.load(File.read(cache))
else
MAZE = {
"0" => %w[1 6],
"1" => %w[0 7],
"2" => %w[3],
"3" => %w[2 4 9],
"4" => %w[3 5],
"5" => %w[4 B],
"6" => %w[0 C],
"7" => %w[1 8],
"8" => %w[7 9],
@unak
unak / pickup.rb
Created August 4, 2017 14:34
pickup configure arguments defined in ext/**/extconf.rb
require "ripper"
def show(meth, arg)
case meth
when "dir_config"
puts "--with-#{arg}-dir"
when "enable_config"
puts "--enable-#{arg}"
when "with_config"
puts "--with-#{arg}"
@unak
unak / memo.md
Last active April 22, 2017 09:35
Installation of local test mastodon

Installation of local test mastodon

手元の仮想マシンにテスト用のmastodonインスタンスを立ててみるための手順メモ。 なおこの手順でできるのはテスト用インスタンスなので外に出さないように。

Setup Ubuntu 16.04 on VMware