Skip to content

Instantly share code, notes, and snippets.

@melborne
melborne / example.rb
Last active Jul 6, 2017
Ruby de Streem
View example.rb
require "./streem"
using CoreExt
STDIN | STDOUT
seq(100) | ->x{
if x % 15 == 0
'FizzBuzz'
elsif x % 3 == 0
'Fizz'
View flip.rb
# flip plugin
# ====
#
# You can post flip text or vertical text.
#
# Usage
# ----
#
# :flip twitter # => "ɹəʇʇᴉʍʇ"
#
View manage_plugins.rb
# -*- 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
View emoji.rb
# coding: UTF-8
# emoji plugin(Emot gem version)
# ====
#
# You can post Emoji easily!
#
# Usage
# ----
#
@melborne
melborne / collections.ja.md
Last active Aug 29, 2015
Jekyll Collections日本語版
View collections.ja.md
layout title prev_section next_section permalink
docs
コレクション
variables
datafiles
/docs/collections/
View symbol_tilde.rb
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 Apr 26, 2014
Yet Another Proc Composer in Ruby
View proc_compressor.rb
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 Mar 22, 2014
Atom.io Document Translations
View atom_creating_a_package.ja.md
View mission_impossible.rb
require "./onetime"
module CoreExt
refine String do
def ~
margin = scan(/^ +/).map(&:size).min
gsub(/^ {#{margin}}/, '')
end
end
end
View switch_test.rb
# 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
You can’t perform that action at this time.