This file contains hidden or 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 | |
require 'spork' | |
Spork.prefork do | |
# Loading more in this block will cause your tests to run faster. However, | |
# if you change any configuration or code from libraries loaded here, you'll | |
# need to restart spork for it take effect. | |
# This file is copied to spec/ when you run 'rails generate rspec:install' | |
ENV["RAILS_ENV"] ||= 'test' |
This file contains hidden or 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
require 'typo_fixer' | |
class Object | |
include TypoFixer | |
end | |
p [1, 2, 3].shaflfe.joni #=> "213" |
This file contains hidden or 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
require 'typo_fixer' | |
class Object | |
include TypoFixer | |
end | |
p "some string".revarse #=> "gnirts emos" |
This file contains hidden or 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
module TypoFixer | |
def self.included(base) | |
base.class_eval do | |
alias_method :method_missing_without_fix_typo, :method_missing | |
alias_method :method_missing, :method_missing_with_fix_typo | |
end | |
end | |
def method_missing_with_fix_typo(name, *args) | |
if name && method = find_method(name) |
This file contains hidden or 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
module RomanNumerals | |
extend self | |
CARDINALS = | |
{ 1 => %w|I V X|, | |
10 => %w|X L C|, | |
100 => %w|C D M|, | |
1000 => 'M' | |
} |
This file contains hidden or 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
require 'cinch' | |
Process.daemon | |
bot = Cinch::Bot.new do | |
configure do |c| | |
c.server = 'irc.example.com' | |
c.password = 'password' | |
c.port = '1234' | |
c.ssl.use = true |
This file contains hidden or 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 card = $("<div id='card' />"); | |
var comments = $('#comments .comment-content .comment-body > p'); | |
card | |
.appendTo('body') | |
.css({ | |
width: 700, | |
height: 700, |
This file contains hidden or 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
nav | |
ul | |
li | |
a#counter | |
span.ring |
This file contains hidden or 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
p '----- shallow' | |
data = [1,2,3,4,5,6] | |
p "raw_data: #{data}" | |
p '- processing' | |
new_data = | |
data.each_with_object([]) do |d, ret| | |
ret << d * 2 | |
end |
This file contains hidden or 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
!!! 5 | |
%html{lang: 'ja'} | |
%head | |
%meta{charset: 'utf-8'} | |
%script{src: '//code.jquery.com/jquery-1.11.0.min.js'} | |
%script{src: '//code.highcharts.com/highcharts.js'} | |
%script{src: '//code.highcharts.com/modules/data.js'} # CSV などを読み込んで良い感じにしてくれるモジュール | |
%body | |
#graph |
OlderNewer