Skip to content

Instantly share code, notes, and snippets.

namespace "binary" do
desc "detect unknown binary chars from source codes"
task "check" do
c2a0 = /\xc2\xa0/no
files = Dir.glob("{app,config,lib}/**/*.{rb,html,erb.haml}")
files.each do |file|
buf = File.read(file){}
if c2a0 === buf
puts "[C2A0] detected in [%s]" % file
File.readlines(file).each_with_index do |line, i|
Xinha.prototype._shortCuts = function (ev)
{
var key = this.getKey(ev).toLowerCase();
var cmd = null;
var value = null;
switch (key)
{
// simple key commands follow
case 'b': cmd = "bold"; break;
シナリオ: 営業がページを見る
前提 未来の確定案件1が存在し
もし "入稿情報1"を開く
ならば "商品詳細1"へのリンクがある
かつ "クリエイティブ"が非表示
かつ "入稿情報"が非表示
フィーチャ: spymaster の自動レベル上げ
シナリオ: 指定タスクを実行
前提 タスクページへ移動
実行 体力が"45"以上なら"steal_embassy_documents"タスクを連続実行
module ApplicationHelper
def partial(file, opts = {})
opts[:partial] = file
controller.__send__ :render_to_string, opts
end
end
%table{:width=>"100%", :cellspacing=>"1", :cellpadding=>"0", :border=>"1"}
%tbody
%tr{:bgcolor=>"#eeeeee"}
%th{:colspan=> 1 + dss.size}掲載期間
- if dss.blank?
%tr
%td{:align=>"center", :style=>"background-color:white;"}
.nothing{:style=>"padding:20px;color:tomato;"} なし
- else
- dss.select{|ds| ds.is_a?(DeliverySchedule)}.each_with_index do |ds, i|
@maiha
maiha / new.rb
Created June 26, 2009 13:52 — forked from genki/new.rb
class Foo
foo : puts "foo"
bar :
puts "bar"
puts "hello"
baz : "BAZ"
Foo.new.foo
class Foo
dsl_accessor
foo { puts "foo" }
bar {
puts "bar"
puts "hello"
}
baz { "BAZ" }
end
% jruby -J-Xmx2048m =merb -i
irb(main):001:0> buf = File.read('/tmp/1GB.txt'); buf.size
Error: Your application used more memory than the safety cap of 2048m.
Specify -J-Xmx####m to increase it (#### = cap size in MB).
Specify -w for full OutOfMemoryError stack trace
% jruby -J-Xmx4096m =merb -i
Invalid maximum heap size: -Xmx4096m
The specified size exceeds the maximum representable size.
Could not create the Java virtual machine.
require 'rubygems'
######################################################################
### ActiveRecord (PostgreSQL)
require 'active_record'
ActiveRecord::Base.establish_connection(:adapter=>"postgresql", :database=>"jpop", :user=>"maiha")
module PG
class Song < ActiveRecord::Base
# Indexes: "index_songs_singer" btree (singer)