Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
/**
* Convert data in CSV (comma separated value) format to a javascript array.
*
* Values are separated by a comma, or by a custom one character delimeter.
* Rows are separated by a new-line character.
*
* Leading and trailing spaces and tabs are ignored.
* Values may optionally be enclosed by double quotes.
* Values containing a special character (comma's, double-quotes, or new-lines)
* must be enclosed by double-quotes.
$ cd /etc
$ ls
acpi gai.conf machine-id rpc
adduser.conf gconf magic rsyslog.conf
alternatives ghostscript magic.mime rsyslog.d
$ sudo su
# ls
acpi gai.conf machine-id rpc
adduser.conf gconf magic rsyslog.conf
alternatives ghostscript magic.mime rsyslog.d
@gotoken
gotoken / cop-inplace-accessor.rb
Created April 29, 2018 11:05
pretty looks Numo::NArray#inplace alternative
module InplaceAccessor
def self.append_features(klass)
klass.class_eval do
alias _getter []
alias _inplace inplace
alias _setter []=
def inplace
@inplace ||= _inplace
end
@gotoken
gotoken / stable-snapshot
Last active March 5, 2018 17:14
$(rbenv root)/plugins/ruby-build/share/ruby-build/stable-snapshot
install_package "openssl-1.1.0g" "https://www.openssl.org/source/openssl-1.1.0g.tar.gz" mac_openssl --if has_broken_mac_openssl
install_package stable-snapshot "ftp://ftp.ruby-lang.org/pub/ruby/stable-snapshot.tar.gz" ldflags_dirs standard verify_openssl

Rubyが25歳と聞いて!

25年ってすごいですよね。大変おめでたいことなので少し感慨に耽ってみたいと思います。

まず、ちょっと考えてみてほしいのですが、私が初めて helo world したときC言語先輩はまだ14才でした。私が17才のときです。初めてLISPを触ったのも同時期だったのですが、LISP先輩は私より11歳上なので当時 25 か 26 です。なるほど、いま高校生が Ruby と出逢うとちょうど私と LISP くらいの歳の差になるのですね。そうかそうか。いやそうなのか?

ある漫画で、大変長寿な主人公が「生き物はこんな速さで変わっていくんですね…怖いな」という台詞がありましたが Ruby に対してそんな気持ちになることもあります。たまに 1.8 系を触る機会があるのですが実にいろんなことが変わっていて、これも新機能だったかー!ってなるわけです。互換性を壊す変更を入れるのはだんだん難しくなりそうですから同じ速さで変わることはなさそうですが油断は出来ません。

ところで私による Ruby への貢献というものがあったとして、それは Ruby を面白がることだったのだろうと思ったりします。インパクトの大きいものは次の3つでしょう。

/**
* vis.js
* https://github.com/almende/vis
*
* A dynamic, browser-based visualization library.
*
* @version 4.17.0-SNAPSHOT
* @date 2016-11-23
*
* @license
body
{
font: 13px "Lucida Grande", Tahoma, Arial, Helvetica, sans-serif;
}
h1
{
font-size: 180%;
font-weight: bold;
var query = null;
function load() {
selectDataType();
loadCsvExample();
loadJsonExample();
loadJavascriptExample();
"x", "y", "value"
100000, 100000, 100050
100000, 100010.47, 100050
100000, 100020.93, 100050
100000, 100031.4, 100050
100000, 100041.87, 100050
100000, 100052.33, 100050
100000, 100062.8, 100050
100000, 100073.27, 100050
100000, 100083.73, 100050