更新: | 2024-05-20 |
---|---|
作者: | @voluntas |
バージョン: | 2024.1 |
URL: | https://voluntas.github.io/ |
更新: | 2022-03-18 |
---|---|
作者: | @voluntas |
バージョン: | 2022.1 |
URL: | http://voluntas.github.io/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class Nyan(name:String, age:Int) | |
val nyans:List[Nyan] = List(Nyan("ねこがた", 2), Nyan("うーねこ", 4)) | |
val has_wneko: PartialFunction[List[Nyan], Unit] = { | |
case Nil => println("うーねこのっといんざりすとなうよー") | |
case Nyan("うーねこ", _) :: _ => println("うーねこいんざりすとなうよー") | |
case _ :: rest => has_wneko(rest) | |
} |
サイズがあまりに大きくなってしまったので、gist ではなくて github 上で管理するようにしました。
https://github.com/Shinpeim/process-book
URL 変わっちゃうの申し訳ないんだけど、一覧性が高くなるのと pull req が受け取れるメリットのほうを取ります。せっかく読みにきてくれたのにひと手間かかっちゃってすみません。
Ruby の HTTP クライアントライブラリ Faraday が便利そう
API ラッパの開発には [RestClient gem][rest_client_gem] だとか
OAuth の必要なものは [Net/HTTP][net_http] + [OAuth gem][oauth_gem] を使ってた
[Twitter gem][twitter_gem] や [Instagram gem][instagram_gem] など API ライブラリのソースを読んでみると
[Faraday gem][faraday_gem] というものがよく使われてた
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
class Integer | |
def to_fizzbuzz | |
[[:fizz][self % 3], [:buzz][self % 5]] * '' | |
end | |
end | |
class String | |
def present? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var unekointhehousenow = function(input) { | |
var copy = function(source, buffer, pointer) { | |
for (var i = 0, l = source.length; i < l; ++i) { | |
buffer[pointer + i] = source[i]; | |
} | |
}; | |
var tokens = input.match(/うーねこいんざおうちなうよー|うーねこ|いんざ|おうち|なうよー/g) || []; | |
var buffer = [0]; | |
var pointer = 0; |