Skip to content

Instantly share code, notes, and snippets.

@mpen
mpen / rspec_template.rb
Created April 2, 2009 07:29
Rails Application Templates for rspec-rails 1.2.0
# Application Templates for rspec-rails
# Ruby on Rails : 2.3.2
# rspec-rails : 1.2.0
# http://wiki.github.com/dchelimsky/rspec/configgem-for-rails
# use sudo
use_sudo = false
# Remove the old rspec.rake file
run "rm lib/tasks/rspec.rake"
@mpen
mpen / userChrome.css
Created April 18, 2009 03:28
Firefox メニューバー/コンテキストメニューからいらない項目を削除
@charset "utf-8";
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
/*
chrome://browser/content/browser.xul
メニューバー
#main-menubar
@mpen
mpen / gist:170768
Created August 20, 2009 02:03
Rails test for SSL Requirement plugin
@request.env['HTTPS'] = "on"
@mpen
mpen / gist:170778
Created August 20, 2009 02:23
Rails test for Restful Authentication
describe ... do
include AuthenticatedTestHelper
fixtures :users
before(:each) do
login_as :user_name
end
...
end
@mpen
mpen / gist:185219
Created September 11, 2009 10:37
Apache2.2 で複数バーチャルホスト / Ubuntu9.04 + Apache2.2.11 + Rails + Passenger2.2.5
# Apache2.2 で複数バーチャルホスト
# Ubuntu9.04 + Apache2.2.11 + Rails + Passenger2.2.5
# /etc/hosts
127.0.0.1 localhost
127.0.1.1 localhost.localdomain ubuntu-desktop
127.0.0.1 mydomain
# httpd.conf
PassengerPoolIdleTime 0
@mpen
mpen / gist:185225
Created September 11, 2009 10:54
Rails rspecでRSS/XMLのテストをするときに警告が出ないようにする
# html-scannerにフォーマットがXMLであることを知らせる
# rspecで警告 ignoring attempt to close ... が出ないようにする
describe "/articles.rss" do
before(:each) do
render 'articles/index.rss.builder'
response.content_type = 'application/rss+xml; charset=utf-8'
end
end
@mpen
mpen / gist:185227
Created September 11, 2009 11:01
Rails specで警告 toplevel constant ... referenced by ... が出てテストが失敗するときに
# rspecで警告 toplevel constant ... referenced by ... が出てテストが失敗するときに
# ArticlesControllerとAdmin::ArticlesControllerがあると発生することがある
describe 'Admin::ArticlesController' do
controller_name 'Admin::Articles'
end
@mpen
mpen / gist:210500
Created October 14, 2009 23:42
Rails yield / content_for
<html>
<head>
<%= yield :head %>
</head>
<body>
<%= yield %>
<%= yield :javascript %>
</body>
</html>
@mpen
mpen / ScalaSwing1.scala
Created October 23, 2009 09:16
ScalaでSwing
// ScalaでSwing
import scala.swing._
import scala.swing.event.{ WindowClosing, ButtonClicked }
import java.awt.Color
import java.io.File
import java.util.Date
import java.text.SimpleDateFormat
object ScalaSwing1 extends SimpleGUIApplication {
@mpen
mpen / ScalaSwingMenu.scala
Created October 24, 2009 10:03
ScalaでSwing メニュー
// ScalaでSwing メニュー
import scala.swing._
import scala.swing.event.WindowClosing
import java.awt.event.{ KeyEvent, InputEvent }
import javax.swing.{ KeyStroke, ImageIcon }
object ScalaSwingMenu extends SimpleGUIApplication {
def top = new MainFrame {
title = "ScalaでSwing メニュー"