Skip to content

Instantly share code, notes, and snippets.

@melborne
melborne / example.rb
Last active July 6, 2017 04:33
Ruby de Streem
require "./streem"
using CoreExt
STDIN | STDOUT
seq(100) | ->x{
if x % 15 == 0
'FizzBuzz'
elsif x % 3 == 0
'Fizz'
# flip plugin
# ====
#
# You can post flip text or vertical text.
#
# Usage
# ----
#
# :flip twitter # => "ɹəʇʇᴉʍʇ"
#
# -*- coding: utf-8 -*-
# manage plugins for earthquake.gem
#
# forked from:
# https://gist.github.com/milligramme/5253047
#
# usage
# :manage_plugins show installed plugin
# :manage_plugins on <plugin_name> enable plugin
# :manage_plugins off <plugin_name> disable plugin
@melborne
melborne / emoji.rb
Last active August 29, 2015 14:01 — forked from jugyo/emoji.rb
# coding: UTF-8
# emoji plugin(Emot gem version)
# ====
#
# You can post Emoji easily!
#
# Usage
# ----
#
@melborne
melborne / collections.ja.md
Last active August 29, 2015 14:01
Jekyll Collections日本語版
layout title prev_section next_section permalink
docs
コレクション
variables
datafiles
/docs/collections/
require "named_emoji"
class Symbol
def ~
to_s
.split
.map { |w| NamedEmoji.emojis[w.intern.downcase] || w }
.join(" ")
end
end
@melborne
melborne / proc_compressor.rb
Created April 26, 2014 10:35
Yet Another Proc Composer in Ruby
class ProcCompressor
def initialize(n)
@proc = proc.curry(n+1)
end
def <<(arg)
@proc = @proc[arg]
Proc===@proc ? self : @proc
end
@melborne
melborne / atom_creating_a_package.ja.md
Created March 22, 2014 09:16
Atom.io Document Translations
require "./onetime"
module CoreExt
refine String do
def ~
margin = scan(/^ +/).map(&:size).min
gsub(/^ {#{margin}}/, '')
end
end
end
# use benchmark_suite
# https://github.com/evanphx/benchmark_suite
# -*- encoding: utf-8 -*-
require 'benchmark/ips'
class Character < Struct.new(:name, :level, :point)
def to_s
"%s:\tlv:%d\tpt:%d" % values
end
end