$ brew install groonga
Ruby から groonga を使うために rroonga というライブラリを使う:
# Usage | |
# ----- | |
# | |
# spec_helper.rb | |
# | |
# RSpec.configure do |config| | |
# ... | |
# config.include CapybaraHelper, :type => :request | |
# ... | |
# end |
require 'rspec' | |
# This smells | |
[[ 1, 2, 3], | |
[ 4, 8, 12], | |
[-2, 3, 1], | |
[ 0, 0, 0]].each do |a, b, c| | |
describe "#{a} + #{b}" do | |
subject { a + b } | |
it { should == c } |
AppName::Application.routes.draw do | |
devise_for :admin_users | |
mount RailsAdmin::Engine => "/admin", :as => 'rails_admin' | |
end |
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
# Inspired by https://github.com/cho45/net-irc/blob/master/examples/gig.rb | |
require 'open-uri' | |
require 'time' | |
require 'rubygems' | |
require 'nokogiri' | |
module GitHub |
require 'rack-server-pages' | |
require 'tilt' | |
run Rack::ServerPages.new { |config| | |
config.before do | |
layout('public/_layout.html') | |
end | |
} |
Numeric#nonzero? -> self | nil | |
File::Stat#size? -> Integer | nil | |
Float#infinite? -> 1 | -1 | nil | |
File::Stat#world_readable? -> Fixnum | nil | |
File::Stat#world_writable? -> Fixnum | nil | |
Encoding.compatible?(obj1, obj2) -> Encoding | nil | |
File.world_readable?(path) -> Integer | nil | |
File.world_writable?(path) -> bool # リファレンスで見出しは bool となっているけど説明では Integer | nil | |
FileTest.#world_readable?(path) -> Integer | nil | |
FileTest.#world_writable?(path) -> bool # リファレンスで見出しは bool となっているけど説明では Integer | nil |
# | |
# Cookbook Name:: mysql | |
# Definition:: mysql_package | |
# | |
# Copyright 2013, YOUR_COMPANY_NAME | |
# | |
# All rights reserved - Do Not Redistribute | |
define :mysql_package do |
# encoding: utf-8 | |
require 'rqrcode' | |
require 'rqrcode_png' | |
str = '日本語てすと' | |
# QRコードで日本語を扱う場合はShift_JISが一般的 | |
# 加えてライブラリの問題なのかASCII-8BITで渡さないとうまくいかない | |
qr_str = str.encode('CP932') |