Skip to content

Instantly share code, notes, and snippets.

View rosylilly's full-sized avatar
🕊️
Happy Hacking

Sho Kusano rosylilly

🕊️
Happy Hacking
View GitHub Profile

crystal-jp/issues's guideline

Issuer の皆さんへ

どんな時に作るのか

こんなことでお困りの時は、お気軽に issue を作っていただければ、何かお力になれるかもしれません。

  • Crystal 本体や Crystal 関連のライブラリに問題を見つけたけど、本家のリポジトリに報告すべきか悩むとき。(bugs ラベルを付ける)
  • Crystal 本体や Crystal 関連のライブラリに要求したい機能があるけど、本家のリポジトリで話し合う前に意見を求めたいとき。(features ラベルを付ける)
puts "Hello, World"
STDOUT.puts "Hello, World"
class Point
property :x, :y
def initialize(@x, @y)
end
end
@rosylilly
rosylilly / dci.go
Last active August 29, 2015 14:00
これ DCI なんでは?
package main
import (
"fmt"
)
type User struct {
Name string
}
@rosylilly
rosylilly / refinements.rb
Created January 5, 2014 07:33
refinements w/ block
class A
def say
puts "A"
end
end
module B
def self.role(klass, &block)
ref = refine(klass) { }
ref.module_eval(&block)
@rosylilly
rosylilly / 00-actor.rb
Last active March 3, 2017 07:03
分かった気になる DCI 、ロミオとジュリエット編 Romeo & Juliette with DCI
# 役者クラス
#
# say: 役者は声を発する事ができる。
class Actor
def say(words)
puts words
end
end
@rosylilly
rosylilly / gist:8013662
Last active December 31, 2015 16:29
ask.fm への解答
require 'unextend'
class Person
attr_accessor :husbund, :wife
def help(other)
...
end
def tell_love(other)
@rosylilly
rosylilly / article.rb
Created February 12, 2013 07:26
Answer for http://twitter.com/VoQn/status/301223276636692480 あえてまわりくどい書き方をしています。
# 記事クラス
class Article < AR::Base
belongs_to :user
end
@rosylilly
rosylilly / gist:4701807
Created February 3, 2013 13:35
これで治らないかな
FactoryGirl.define do
factory :user do
tasks do |user|
[
FactoryGirl.create(:task, user: user)
]
end
end
end
@rosylilly
rosylilly / jquery-tapp.js
Created September 13, 2012 06:28
jQuery-tapp
jQuery.fn.extend({
/**
* $('li').tapp() で console.debug に this を出力します。
*
* func を与えることで、func(this) を実行した結果を console.debug に出力します。
*
* @this {jQuery}
* @param {function(jQuery)=} func
* @return {jQuery}
*/
@rosylilly
rosylilly / new_type.rb
Created August 27, 2012 03:10
Newtype on Ruby
class Class
def new_type(&block)
new_class = self.dup
new_class.class_eval(&block) if block_given?
new_class
end
end
CArray = Array.new_type do
def example