Skip to content

Instantly share code, notes, and snippets.

@sue445
sue445 / Game_Temp.rb
Created May 9, 2013 15:37
RPGデバッガーXPでrubyのソースコードをシンタックスハイライトしてるやつ
#==============================================================================
# ■ Game_Temp
#------------------------------------------------------------------------------
#  セーブデータに含まれない、一時的なデータを扱うクラスです。このクラスのイン
# スタンスは $game_temp で参照されます。
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
@sue445
sue445 / HiraganaComparator.java
Created May 15, 2013 06:22
jubeat++での日本語ソート実装
package net.sue445.jubeatplusplus.comparator;
import java.io.Serializable;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
/**
* ひらがなをソートするためのコンパレータ
* @author sue445
@sue445
sue445 / syntax_highlighting_sample.rb
Created May 25, 2013 13:32
syntax highlighting sample
sql = <<SQL
SELECT * FROM employees
SQL
sql = <<EOS
SELECT * FROM employees
EOS
html = <<HTML
<div>
@sue445
sue445 / precure1.sql
Last active December 18, 2015 03:48
SQLのフォーマット論争
-- カンマ前置き派
SELECT name
, title
FROM precures p
WHERE p.color = 'yellow'
AND p.title = 'smile_precure'
ORDER BY name
-- カンマ後ろ置き派
SELECT name,
@sue445
sue445 / clean_rails_project.rb
Created June 20, 2013 05:38
Railsプロジェクトの不要ファイルを削除する
# -*- encoding: utf-8 -*-
=begin
railsプロジェクトの不要ファイルを削除する
usage:
/path/to/workspace/
├── app1
└── app2
@sue445
sue445 / shuffle.rb
Last active December 18, 2015 21:09
Ruby 1.9と2.0で同じ結果を返す Array#shuffle と同等のメソッド http://sue445.hatenablog.com/entry/2013/06/23/222144
class Array
# ruby 1.9系と2.0系で Array#shuffle の結果が異なるため独自実装
# ref.
# * https://github.com/ruby/ruby/blob/e3efce6df1aa691e17c59f442b35b4fd129d3a13/array.c#L4012
# * https://github.com/ruby/ruby/blob/ruby_2_0_0/NEWS#L35-L36
# * https://github.com/ruby/ruby/commit/e3efce6df1aa691e17c59f442b35b4fd129d3a13
def my_shuffle(random)
i = self.length
dst_array = self.clone
@sue445
sue445 / build_for_jenkins.sh
Created August 24, 2013 05:57
Jenkins Script for Rails Engine
#!/bin/bash
readonly JENKINS_RAILS_ENV="test"
export LANG=ja_JP.UTF-8
# Jenkins build script
run()
{
command=$1
@sue445
sue445 / each_cons.rb
Created September 13, 2013 01:26
each_cons試してみた
1.9.3p194 :001 > (1..10).each_cons(3){|a, b, c| puts "#{a}, #{b}, #{c}" }
1, 2, 3
2, 3, 4
3, 4, 5
4, 5, 6
5, 6, 7
6, 7, 8
7, 8, 9
8, 9, 10
=> nil
@sue445
sue445 / HeartCatchPrecure.groovy
Last active December 28, 2015 13:49
Heart Catch Precure!
def heart(){
println "Heart"
throw new Exception()
}
def precure(){
println "Precure!"
}
try{
@sue445
sue445 / sample_spec.js
Last active December 28, 2015 16:39
jasmineのdescibeの中がテストケースごとに初期化されるか調べてみた
describe("num", function(){
var num = 0;
it("should == 1 (1st)", function(){
num++;
expect(num).toEqual(1);
});
it("should == 1 (2nd)", function(){
// 毎回初期化されてるならこのテストも通るはず