Skip to content

Instantly share code, notes, and snippets.

View hisaichi5518's full-sized avatar
🍑
吉高由里子

hisaichi5518 hisaichi5518

🍑
吉高由里子
View GitHub Profile

タイトル

Observable.just("hisaichi5518@gmail.com").flatMap(new Function<String, ObservableSource<String>>() {
@Override
public ObservableSource<String> apply(String s) throws Exception {
// return Observable.concat(validateEmail(s), validateNonNull(s));
return Observable.zip(validateEmail(s), validateNonNull(s), new BiFunction<String, String, String>() {
@Override
public String apply(String s, String s2) throws Exception {
Review review = Yummy.create(Review.class);
review.getComment(); //=> "lkjashldkjaspdiqwekjnd091824lknf09234kjhsf"
review.getId(); //=> 2
class String
def uzulla?
self == "うずら"
end
def udzura?
self == "うづら"
end
end
def hoge?
true
end
p hoge?.! #=> false
p !hoge? #=> false
@hisaichi5518
hisaichi5518 / test.rb
Created December 22, 2014 09:11
簡単にレエイルズのfilterの確認がしたい
require "text-table"
module AbstractController
module Callbacks
def process_action(*args)
run_callbacks(:process_action) do
super
end
table = Text::Table.new
$("#new_form").formValidator.parameters({
"user_email" : [["NotNull", "Email"]], # NotNull, Emailが並列で実行される
"user_email" : [["NotNull", "Email"], "Remote"], # NotNull, Emailが並列で実行されたあとにRemoteが実行される
"user_password": ["NotNull", "Password"]
})
$.extend($.formValidator.errorMessages, {
"user_email" : "メールアドレスデフォルト",
"user_email.notnull" : "必須項目です",
"user_email.email" : "メールアドレスが不正です",
function peco-src() {
local selected_dir=$(ghq list --full-path | peco --query "$LBUFFER")
if [ -n "$selected_dir" ]; then
cd ${selected_dir}
fi
}
zle -N peco-src
bindkey '^S' peco-src
@hisaichi5518
hisaichi5518 / benchmark.pl
Created June 3, 2014 08:36
data validator role benchmark
use 5.10.1;
use strict;
use warnings;
use Benchmark qw(:all);
package Applyed {
use Mouse;
extends "Data::Validator";
with "Data::Validator::Role::Croak";
};
@hisaichi5518
hisaichi5518 / benchmark.pl
Created June 3, 2014 08:28
perl load benchmark
use strict;
use warnings;
use Benchmark qw(:all);
use Plack::Util ();
use Mouse::Util ();
use Class::Load ();
use Module::Load ();
sub load {
my($class, $prefix) = @_;