Skip to content

Instantly share code, notes, and snippets.

View stevendaniels's full-sized avatar
👋

Steven Daniels stevendaniels

👋
View GitHub Profile
@stevendaniels
stevendaniels / roo_error.irb
Last active December 11, 2017 19:40 — forked from reshleman/irb
Roo Bug Report
irb(main):001:0> require "roo"
=> true
irb(main):002:0> require "roo/version"
=> true
irb(main):003:0> Roo::VERSION
=> "2.0.0"
irb(main):004:0> sheet = Roo::Spreadsheet.open("/Users/reshleman/Desktop/roo_error.xlsx", extension: "xlsx")
=> {[1, 1]=>#<Roo::Excelx::Cell:0x007fe6b297fef0 @type=:string, @formula=nil, @excelx_type=:string, @excelx_value="0", @style=0, @value="name", @coordinate=#<Roo::Excelx::Cell::Coordinate:0x007fe6b297ff40 @row=1, @column=1>>, [2, 1]=>#<Roo::Excelx::Cell:0x007fe6b297f798 @type=:string, @formula=nil, @excelx_type=:string, @excelx_value="1", @style=0, @value="Robert Eshleman", @coordinate=#<Roo::Excelx::Cell::Coordinate:0x007fe6b297f7e8 @row=2, @column=1>>}
irb(main):005:0> sheet.parse(name: "name")
=> [{:name=>"name"}, {:name=>"Robert Eshleman"}]
@stevendaniels
stevendaniels / creating-pinyin-flashcards.rb
Last active March 25, 2022 12:27
Creating pinyin flashcards
# Used to create tables for importing into quizlet.
# gem install zhongwen_tools
require 'zhongwen_tools'
require 'zhongwen_tools/core_ext/string'
def random_tone; (1..4).to_a.sample; end
def tsv_list(pyn); [pyn, pyn].join("\t"); end
def pinyin_list
pyn = ZhongwenTools::Romanization::ROMANIZATIONS_TABLE.map { |k| k[:pyn]}