Skip to content

Instantly share code, notes, and snippets.

@koseki
koseki / default.rhtml
Created November 13, 2009 13:40
SmallCage menu activate sample 2
<html>
<head>
<style type="text/css">
.selected { font-weight: bold; color: red; background-color: yellow; }
</style>
</head>
<body>
<%= menu %>
<%= body %>
@koseki
koseki / blue_cloth_helper.rb
Created November 24, 2009 03:55
SmallCage markdown sample.
module SmallCage
module BlueClothHelper
require "bluecloth"
def render_markdown(str)
BlueCloth.new(str).to_html
end
end
end
<%= body %>
module SmallCage
module ErbHelper
# Evaluate ERB source.
def _erb(source)
@renderer.render_string(source, @obj)
end
end
end
#! /usr/bin/env ruby
# -----------------------------------------------
# $ gem --version
# 1.3.5
# $ mkdir gemtest
# $ cd gemtest
# $ gem install -i . bluecloth
# $ gem_path_test.rb . bluecloth
# ERROR
@koseki
koseki / tablescript.html
Created March 30, 2010 06:38
IE6/7 can't get offsetWidth when the script is inside the table tag.
<html>
<head><title>IE6 Table Script Test</title></head>
<body>
<!-- IE6/7 can't get offsetWidth when script is inside table tag. -->
<table><tr><td>
<span id="target">abc</span>
<script type="text/javascript">
alert("target:" + document.getElementById("target").offsetWidth);
</script>
#! /usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'yaml'
begin
require 'rubygems'
require 'ya2yaml'
rescue Exception => e
end
@koseki
koseki / Capfile
Created April 22, 2010 06:45
Capistrano without Rails
# この行を追加。デフォルトだと-fでCapfileを指定したときにエラーになる。
Dir.chdir(File.dirname(__FILE__))
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy' # remove this line to skip loading any of the default tasks
@koseki
koseki / Capfile
Created April 23, 2010 13:50
Capistrano Minimal
Dir.chdir(File.dirname(__FILE__))
# load 'deploy' if respond_to?(:namespace) # cap2 differentiator
# Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy' # remove this line to skip loading any of the default tasks
#! /bin/sh
apt-get -y update
apt-get -y install less
apt-get -y install emacs22
apt-get -y install subversion
apt-get -y install apache2
apt-get -y install ruby-dev
apt-get -y install rubygems
apt-get -y install irb