Tbpgr Blog

Employee Experience Engineer tbpgr(てぃーびー) のブログ

2014-03-01から1ヶ月間の記事一覧

TbpgrUtils | 追加要件 Numeric.to_digit_table 追加

概要 追加要件 Numeric.to_digit_table 追加 詳細 追加要件 Numeric.to_digit_tableを追加する 仕様 ・10/2/8/16進数を表形式の文字列で取得します ※より詳細についてはGitHubのREADMEおよびテストケース参照 GitHub https://github.com/tbpgr/tbpgr_utils R…

Ruby | Hash | keys

概要 Hash#keys 詳細 Hashから全keyの配列を取得する。 サンプルコード # encoding: utf-8 require 'tbpgr_utils' h = { hoge_key: :hoge_value, hige_key: :hige_value, hage_key: :hage_value, } bulk_puts_eval binding, <<-EOS h.keys EOS __END__ 下記…

TbpgrUtils | 追加要件 Numeric.to_oct_table 追加

概要 追加要件 Numeric.to_oct_table 追加 詳細 追加要件 Numeric.to_oct_tableを追加する 仕様 ・10進数と8進数を表形式の文字列で取得します ※より詳細についてはGitHubのREADMEおよびテストケース参照 GitHub https://github.com/tbpgr/tbpgr_utils Rubyg…

Ruby | Hash | key

概要 Hash.key 詳細 Hashから引数で指定したvalueと一致するキーを取得する。 該当するキーが複数存在する場合、どのキーを返すかは不定。 サンプル コード # encoding: utf-8 require 'tbpgr_utils' h = { hoge1: "hoge_value", hoge2: "hoge_value", hige1…

Ruby | Hash | has_value?

概要 Hash.has_value? 詳細 Hashのvalueが存在するか確認する。 aliasとして「value?」がある サンプル コード # encoding: utf-8 require 'tbpgr_utils' h = { hoge: "hoge", hige: "hige", hage: "hage", } bulk_puts_eval binding, <<-EOS h.has_value? '…

TbpgrUtils | 追加要件 Numeric.to_hex_table 追加

概要 追加要件 Numeric.to_hex_table 追加 詳細 追加要件 Numeric.to_hex_tableを追加する 仕様 ・10進数と16進数を表形式の文字列で取得します ※より詳細についてはGitHubのREADMEおよびテストケース参照 GitHub https://github.com/tbpgr/tbpgr_utils Ruby…

ActiveSupport | Date calculations

概要 Date calculations 詳細 Date calculations について Date calculations 日付の操作に関する各種メソッドを提供します。 サンプル # encoding: utf-8 require 'active_support/core_ext/date/calculations' require 'tbpgr_utils' date = Date.new(2014…

TbpgrUtils | 追加要件 Numeric.to_binary_table 追加

概要 追加要件 Numeric.to_binary_table 追加 詳細 追加要件 Numeric.to_binary_tableを追加する 仕様 ・10進数と2進数を表形式の文字列で取得します ※より詳細についてはGitHubのREADMEおよびテストケース参照 GitHub https://github.com/tbpgr/tbpgr_utils…

TbpgrUtils | 追加要件 Array#to_table 追加

概要 追加要件 Array#to_table 追加 詳細 追加要件 Array#to_tableを追加する 仕様 ・配列から表形式の文字列を取得します ※より詳細についてはGitHubのREADMEおよびテストケース参照 GitHub https://github.com/tbpgr/tbpgr_utils Rubygems http://rubygems…

MediaWiki | MathJax Extensionで数式を利用可能にする

概要 MathJax Extensionで数式を利用可能にする 詳細 Version MediaWiki 1.22 MathJax 0.7 インストール手順 ・下記URLからファイルをダウンロードして、/extensions/MathJax 配下に保存する http://people.cs.kuleuven.be/~dirk.nuyens/Extension_MathJax/M…

ActiveSupport | Range#range_overlaps?

概要 Range#range_overlaps? 詳細 Range#range_overlaps? について Range#range_overlaps? メソッドの範囲が重なっているかどうかを返却する サンプル # encoding: utf-8 require 'active_support/core_ext/range/overlaps' require 'tbpgr_utils' bulk_puts…

TbpgrUtils | 追加要件 String#ascii_unicode_table 追加

概要 追加要件 String#ascii_unicode_table 追加 詳細 追加要件 String#ascii_unicode_tableを追加する 仕様 ・指定文字列の文字コード表を取得する ※より詳細についてはGitHubのREADMEおよびテストケース参照 GitHub https://github.com/tbpgr/tbpgr_utils …

Sublime Text2 | RubyTest Pluginのリファクタリング ローカル変数の抽出を利用する

概要 RubyTest Pluginのリファクタリング ローカル変数の抽出を利用する 詳細 RubyTest Pluginのリファクタリング ローカル変数の抽出機能があります。 対象文字列を選択した状態で右クリックして、 RubyTest => Refactoring => Extract Local Variable を選…

ActiveSupport | Range#include?

概要 Range#include? 詳細 Range#include? について Range#include? 引数が範囲に含まれているか確認する サンプル # encoding: utf-8 require 'active_support/core_ext/range/include_range' require 'tbpgr_utils' bulk_puts_eval binding, <<-EOS (1..5)…

TbpgrUtils | 追加要件 String#is_meta_variable?, Symbol#is_meta_variable? 追加

概要 追加要件 String#is_meta_variable?, Symbol#is_meta_variable? 追加 詳細 追加要件 String#is_meta_variable?, Symbol#is_meta_variable?を追加する 仕様 ・メタ変数かどうか判定する処理を追加 ※より詳細についてはGitHubのREADMEおよびテストケース…

ActiveSupport | Range#to_s

概要 Range#to_s 詳細 Range#to_s について Range#to_s 範囲を文字列にする サンプル # encoding: utf-8 require 'active_support/core_ext/hash/keys' require 'tbpgr_utils' hash = { :key1 => :value1, :key2 => :value2, :key3 => :value3, "key4" => :v…

ActiveSupport | Hash#stringify_keys

概要 Hash#stringify_keys 詳細 Hash#stringify_keys について Hash#stringify_keys キーを文字列にする サンプル # encoding: utf-8 require 'active_support/core_ext/hash/stringify_keys' require 'tbpgr_utils' hash = { :key1 => :value1, :key2 => :v…

TbpgrUtils | 追加要件 String#ascii1_other2_size 追加

概要 追加要件 String#ascii1_other2_size 追加 詳細 追加要件 String#ascii1_other2_sizeを追加する 仕様 ・asciiコード範囲は1文字、その他は2文字として文字サイズを返却する ※より詳細についてはGitHubのREADMEおよびテストケース参照 GitHub https://gi…

TbpgrUtils | 追加要件 Numeric#is_ascii? 追加

概要 追加要件 Numeric#is_ascii? 追加 詳細 追加要件 Numeric#is_ascii?を追加する 仕様 ・asciiコードかどうか判定する ※より詳細についてはGitHubのREADMEおよびテストケース参照 GitHub https://github.com/tbpgr/tbpgr_utils Rubygems http://rubygems.…

TbpgrUtils | 追加要件 EvalHellper#attr_init_class_code 追加

概要 追加要件 EvalHellper#attr_init_class_code 追加 詳細 追加要件 EvalHellper#attr_init_class_codeを追加する 仕様 ・TbpgrUtilsのAttributesInitializableモジュールを利用したクラス+メンバの宣言コードを生成する ※より詳細についてはGitHubのREAD…

TbpgrUtils | 追加要件 Object#method_nameable? 追加

概要 追加要件 Object#method_nameable? 追加 詳細 追加要件 Object#method_nameable? を追加する 仕様 ・対象のクラスがメソッドの命名に利用できるか判定する(String, SymbolならOK) ※より詳細についてはGitHubのREADMEおよびテストケース参照 GitHub http…

ActiveSupport | Hash#to_xml

概要 Hash#to_xml 詳細 Hash#to_xml について Hash#to_xml Hashをxmlに変換する。 サンプル # encoding: utf-8 require 'active_support/core_ext/hash/conversions' require 'tbpgr_utils' I18n.enforce_available_locales = true hash = { :key1 => :value…

TbpgrUtils | 追加要件 Hash#table 追加

概要 追加要件 Hash#table 追加 詳細 追加要件 Hash#tableを追加する 仕様 ・Hashのkey,valueをパイプ区切りのテーブル形式文字列に変換する ※より詳細についてはGitHubのREADMEおよびテストケース参照 GitHub https://github.com/tbpgr/tbpgr_utils Rubygem…

ActiveSupport | Array#split

概要 Array#split 詳細 Array#split について Array#split 文字列のsplitの配列版 サンプル # encoding: utf-8 require 'active_support/core_ext/array/grouping' require 'tbpgr_utils' I18n.enforce_available_locales = true ary = [2, 1, 3, 1, 4] bulk…

TbpgrUtils | 追加要件 Kernel#evalb 追加

概要 追加要件 Kernel#evalb 追加 詳細 追加要件 Kernel#evalbを追加する 仕様 ・evalの実行をブロック形式で行う ※より詳細についてはGitHubのREADMEおよびテストケース参照 GitHub https://github.com/tbpgr/tbpgr_utils Rubygems http://rubygems.org/gem…

ActiveSupport | Array#in_groups

概要 Array#in_groups 詳細 Array#in_groups について Array#in_groups 引数で指定した要素数の配列に分割します。 サンプル # encoding: utf-8 require 'active_support/core_ext/array/grouping' require 'tbpgr_utils' I18n.enforce_available_locales = …

PHP

PHP

概要 スクリプト言語PHPについて 詳細 基礎 項目 内容 文字列の結合 http://d.hatena.ne.jp/tbpg/20140321/1395415542 ヒアドキュメント http://d.hatena.ne.jp/tbpg/20140402/1396445796 無名関数で外部変数を利用 http://d.hatena.ne.jp/tbpg/20140402/139…

PHP | print_r

PHP

概要 print_r 詳細 文字列を人が見やすい形式で標準出力する。 Rubyのppにあたる サンプル #!/usr/bin/env php "hoge_value", "hige" => "hige_value", ); print_r($data); 出力 Array ( [hoge] => hoge_value [hige] => hige_value )

PHP | in_array

PHP

概要 in_array 詳細 配列に値を含んでいるか確認する サンプル #!/usr/bin/env php

PHP | 文字列の結合

PHP

概要 文字列の結合 詳細 .(ドット)で結合する サンプル #!/usr/bin/env php "hogehige" 出力 hogehige