Skip to content

Instantly share code, notes, and snippets.

View ckazu's full-sized avatar

CHINDA, Kazuyuki ckazu

  • Aiming-inc.
  • Tokyo, Japan
View GitHub Profile
# 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'
require 'typo_fixer'
class Object
include TypoFixer
end
p [1, 2, 3].shaflfe.joni #=> "213"
require 'typo_fixer'
class Object
include TypoFixer
end
p "some string".revarse #=> "gnirts emos"
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)
@ckazu
ckazu / roman_numerals.rb
Created April 26, 2012 04:20
RomanNumerals
module RomanNumerals
extend self
CARDINALS =
{ 1 => %w|I V X|,
10 => %w|X L C|,
100 => %w|C D M|,
1000 => 'M'
}
@ckazu
ckazu / freshman.rb
Last active December 15, 2015 03:19
マジとヤバイを強いと本格的ににする irc bot. cite: http://blog.livedoor.jp/kinisoku/archives/3724378.html
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
@ckazu
ckazu / zuttomo.js
Last active December 22, 2015 00:18
寄せ書き.js
// 位置合わせは適当
var card = $("<div id='card' />");
var comments = $('#comments .comment-content .comment-body > p');
card
.appendTo('body')
.css({
width: 700,
height: 700,
@ckazu
ckazu / gist:7467286
Created November 14, 2013 14:03
button
nav
ul
li
a#counter
span.ring
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
@ckazu
ckazu / file0.txt
Created March 4, 2014 08:59
HRForecast のデータを Highcharts で手軽に描画する ref: http://qiita.com/ckazu/items/734226078721c5d0e20e
!!! 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