This file contains hidden or 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 LatLng | |
| attr_reader :lat, :lng, :srid | |
| WGS84 = 4326 | |
| SRID = WGS84 | |
| def initialize(lat, lng, srid = WGS84) | |
| @lat = lat.to_f | |
| @lng = lng.to_f | |
| @srid = srid.to_i |
This file contains hidden or 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
| require 'rubygems' | |
| require 'rjb' | |
| JARS = Dir.glob('./javalib/**/*.jar').join(':') | |
| Rjb::load(JARS) | |
| class CellConverter | |
| DateUtil = Rjb::import 'org.apache.poi.ss.usermodel.DateUtil' |
This file contains hidden or 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
| blue_hosts = [ | |
| 'hoge.jp', 'grey.jp', 'hoge.com' | |
| ] | |
| def blue?(line) | |
| blue_hosts.each do |blue_host| | |
| return true if line.index(blue_host) | |
| end | |
| false | |
| end |
This file contains hidden or 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 Processor | |
| BLUE_HOSTS = [ | |
| 'hoge.jp', 'grey.jp', 'hoge.com' | |
| ] | |
| def process(lines) | |
| lines.each do |line| | |
| if blue? line | |
| blue_lines << line | |
| else | |
| red_lines << line |
This file contains hidden or 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
| #!/bin/bash | |
| if [ "$@" ] | |
| then | |
| ARGS=$@ | |
| else | |
| ARGS=. | |
| fi | |
| ps uxww | grep -v grep | grep Emacs >/dev/null |
This file contains hidden or 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
| unless Object.respond_to? :class_config | |
| def Object.class_config | |
| ccs = @@____class_config_saver____ ||= ( | |
| target = "#{RAILS_ROOT}/config/class_config.yml" | |
| if File.exist? target | |
| YAML.load_file(target) | |
| else | |
| {} | |
| end | |
| ) |
This file contains hidden or 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
| require 'tempfile' | |
| require 'nkf' | |
| require 'iconv' | |
| class UTF8File | |
| def self.convert(filename, &block) | |
| encoding = guess_encoding(filename) | |
| raise "Couldn't detect encoding" unless encoding | |
| fp = make_instance(filename, encoding) | |
| if block_given? |
This file contains hidden or 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
| require 'rubygems' | |
| require 'nokogiri' | |
| module XMLEqualityChecker | |
| def equal_as_xml(left, right) | |
| left_x = Nokogiri::XML(left.to_s) | |
| right_x = Nokogiri::XML(right.to_s) | |
| compare_element(left_x.root, right_x.root) | |
| end | |
| def compare_element(left_elm, right_elm) |
This file contains hidden or 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
| _set_env_git_current_branch() { | |
| GIT_CURRENT_BRANCH=$( git branch &> /dev/null | grep '^\*' | cut -b 3- ) | |
| } | |
| _set_env_rails_version() { | |
| RAILS_VERSION=$( rails -v &> /dev/null | cut -b 7- ) | |
| } | |
| _update_rprompt () { | |
| if [ "`git ls-files 2>/dev/null`" ]; then | |
| RPROMPT="[$RAILS_VERSION:%2.:$GIT_CURRENT_BRANCH]" |
This file contains hidden or 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
| _update_rprompt () { | |
| if [ "`git ls-files 2>/dev/null`" ]; then | |
| RPROMPT="[$(rvm-prompt v g):%2.:$GIT_CURRENT_BRANCH]" | |
| else | |
| # RPROMPT="[%~]" | |
| RPROMPT="[$(rvm-prompt v g):%2.]" | |
| fi | |
| } |
OlderNewer