This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# github_api.rb | |
require 'rubygems' | |
require 'uri' | |
require 'net/http' | |
require 'yaml' | |
Net::HTTP.version_1_2 | |
class GitHubApi | |
def repository(user_name, repos_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# github_api_test.rb | |
require 'rubygems' | |
require 'test/unit' | |
require 'fakeweb' | |
require File.join(File.dirname(__FILE__), 'github_api.rb') | |
class Test::Unit::TestCase | |
end | |
class GitHubApiTest < Test::Unit::TestCase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# ======================================================= | |
# 外部連携するRails開発において外部サーバのモックアプリとRailsアプリを同時起動するスクリプト | |
# | |
# ex.) | |
# RAILS_ROOT/lib/external_server/server.rb | |
# | |
# $ ruby script/external_server | |
# => Rails'command run 'script/server' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'optparse' | |
require "rubygems" | |
require "activerecord" | |
host = 'localhost' | |
password = '' | |
username = db = nil | |
help = '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SchemaEngine | |
module SchemaDumper #:nodoc: | |
def self.included(mod) | |
mod.module_eval do | |
alias_method_chain :table, :schema_engine | |
end | |
end | |
private | |
def table_with_schema_engine(table, stream) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# 検索用クラス | |
# ActiveFormプラグインに似ている | |
# | |
# これまでのActiveSearchをモジュール化し、ActiveFormを拡張するようにしました | |
# selectable_attrがインクルードされています | |
# ------------------------------------------------------ | |
# 使い方 | |
# SearchFormクラスを継承 | |
# Ext::ActiveSearch::Baseモジュールをインクルード |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%# app/views/exception_notifier/_environment.rhtml %> | |
<% max = @request.env.keys.max { |a,b| a.length <=> b.length } -%> | |
<% @request.env.keys.select{|key| key =~ /^[A-Z|_]+$/ }.sort.each do |key| -%> | |
* <%= "%-*s: %s" % [max.length, key, filter_sensitive_post_data_from_env(key, @request.env[key].to_s.strip)] %> | |
<% end -%> | |
* Process: <%= $$ %> | |
* Server : <%= `hostname -s`.chomp %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class String #:nodoc: | |
def blank? | |
self !~ /\S/ || self =~ /\A( |\s)+\Z/ | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ApplicationHelper | |
# | |
# JavaScriptコードを<head>タグに挿入する | |
# | |
def content_for_javascript_tag(content_or_options_with_block = nil, html_options = {}, &block) | |
content_for :javascript do | |
javascript_tag(content_or_options_with_block, html_options, &block) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($){ | |
// force focus() using timer because focus() is not working in IE | |
// jQuery('#focus-element').focusForce(); | |
$.extend($.fn, { | |
focusForce: function() { | |
var self = this; | |
setTimeout( function() { $(self).focus(); }, 100); | |
} | |
}); | |
})(jQuery); |
OlderNewer