[2014-05-17] Windows 7 で Ruby 2.1.2 がビルドできることを確認。
>ruby -v
ruby 2.1.2p95 (2014-05-08 revision 45877) [i386-mingw32]
RubyIntaller のリポジトリを取得
require 'fiddle/import' | |
module M | |
extend Fiddle::Importer | |
dlload "/usr/lib/libstdc++.dylib" | |
extern "int strcmp(char*, char*)" | |
extern "int strlen(char*)" | |
end | |
str0 = "abc" |
require 'fiddle/import' | |
module M | |
extend Fiddle::Importer | |
dlload "/usr/lib/libstdc++.dylib" | |
extern "int strcmp(char*, char*)" | |
extern "int strlen(char*)" | |
end | |
=begin |
# -*- coding: utf-8 -*- | |
require 'fiddle' | |
# Array -> Fiddle::Pointer conversion | |
class PackedData | |
attr_reader :data, :pointer | |
def initialize( src ) | |
@source = src # Array or String built from packed Array | |
@data = nil # String |
require 'fiddle' | |
=begin | |
# https://www.opengl.org/sdk/docs/man4/html/glDebugMessageCallback.xhtml | |
typedef void (APIENTRY *DEBUGPROC)(GLenum source, | |
GLenum type, | |
GLuint id, | |
GLenum severity, | |
GLsizei length, | |
const GLchar *message, |
<!-- | |
Countdown timer using Countdown.js (http://countdownjs.org). | |
- Put https://bitbucket.org/mckamey/countdown.js/raw/tip/countdown.js here. | |
- Open this file in your browser. | |
--> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Countdown Timer</title> | |
</head> |
template <typename POD> | |
struct PODContainer | |
{ | |
POD* buf; | |
size_t cap, cnt; | |
typedef POD* iterator; | |
PODContainer(size_t capacity) : cnt(0), cap(capacity) { buf = (POD*)malloc(cap * sizeof(POD)); } | |
~PODContainer() { free(buf); } |
Installing nokogiri gem for OS X 10.10 / Homebrew [2014-11-24]
I found some strings like
@@HOMEBREW_CELLAR@@/xz/5.0.7/lib
in libxml2's configuration log and Makefile. So I have to set these path strings explicitly via LZMA_* environment variables.
$ which ruby
/Users/foo/.rvm/rubies/ruby-2.1.5/bin/ruby
class Node | |
attr_accessor :id, :edges | |
def initialize(node_id) | |
@id = node_id | |
@edges = [] | |
end | |
def edge(other_node) | |
@edges.each do |edge| | |
return edge if edge.has_node?(other_node) |
# Ref.: | |
# http://www.redblobgames.com/grids/hexagons/ | |
# http://www.redblobgames.com/grids/hexagons/implementation.html | |
class Hex | |
attr_accessor :q, :r, :s | |
def initialize(q, r, s = -q - r) | |
@q = q |