OpenSSLエラー Certificate Verify Failed[RVMエラー][Rails][Mac限定] Jun 21st, 2013 Tweet
OpenSSLエラー Certificate Verify Failed[RVMエラー][Rails][Mac限定] Jun 21st, 2013 Tweet
I tried to establish connection to my aws s3 account like this in my irb console - AWS::S3::Base.establish_connection!(:access_key_id => 'my access key', :secret_access_key => 'my secret key', :server => "s3-ap-southeast-1.amazonaws.com") And it works well and prompt this - => #<AWS::S3::Connection:0x8cd86d0 @options={:server=>"s3-ap-southeast-1.amazonaws.com", :port=>80, :access_key_id=>"my acces
I'm in the process of maintaining a Ruby on Rails app and am looking for an easy way to find the hostname or IP address of the box I'm on (since it's a VM and new instances may have different hostnames or IP addresses). Is there a quick and easy way to do this in Ruby on Rails? Edit: The answer below is correct but the clarification Craig provided is useful (see also provided link in answer): The
Complete Ruby geocoding solution. easy to use • supports Ruby 2.x and JRuby • compatible with ActiveRecord, Mongoid, MongoMapper • result caching • proxy support • multi-lingual • Nominatim, Google, Bing, Yandex, MaxMind, and more • works with Rails, Sinatra, any Rack framework • command line interface
Blocks, Procs and lambdas (referred to as closures in Computer Science) are one of the most powerful aspects of Ruby, and also one of the most misunderstood. This is probably because Ruby handles closures in a rather unique way. Making things more complicated is that Ruby has four different ways of using closures, each of which is a tad bit different, and sometimes nonsensical. There are quite a f
今日はRubyの話です。 main.rb #!ruby require 'hoge' こうすると、hoge.rbの中身が全部読み込まれて、main.rbの中で使えるようになります。 main.rb #!ruby autoload(:Hoge, 'hoge') このままでは、main.rbのなかでhoge.rbは読み込まれてはいません。 main.rb #!ruby autoload(:Hoge, 'hoge') p Hoge p Hogeを実行した時点で、hoge.rbが読み込まれます。 つまり、参照されたタイミングで読み込みを行うように「予約」しておくのがautoload()なんですね。 それにたいして、require()は、require()が実行されたタイミングで読み込みが行われます。 全部読み込んで使いたい場合は、require() 使うものと使わないものが混在している場合は、au
RSense という Ruby のプログラムを書いているときに、レシーバの型に応じた補完候補を表示してくれるソフトがあります。Emacs とか Vim と組み合わせて使うと便利らしいです。Java で IDE 使って開発すると補完候補がわさわさ出てきて殆ど鼻くそほじってるだけでプログラミングできるという話を聞いたので、Ruby でも鼻くそほじりながらプログラミングしたいなと思ってこいつを導入してみることにしました。春頃やったときはなかなかうまく Vim から使うことが出来なくて諦めてたんだけど 、つい最近できるようになったのでやり方をメモっておきます。 Mac でのお話です 前提条件ですが、Mac で使ってます。環境は Homebrew で構築してます。また RSense を使うには Java Runtime Environment が必要です。あなたと Java RSense のインスト
東京Ruby会議10に行ってきた。Rubyのイベントや勉強会は初めて参加した。 初日の午後は「Rubyistのためのデザイン講座」にずっと参加していたので、Rubyっぽい話は午前中だけ聞いた。 2日目は眠くて起きれなくて、基調講演は聞かずに11時頃行った。雪で14時終了になってしまったけど。 聞いたセッションはこんな感じ。 タイトル スピーカー Rubyと過ごした半年間 井原正博さん [twitter:@ihara2525] やさしいRails勉強会@東京のつづけ方 [twitter:@takkanm] 趣味とRubyと私 生井智司 [twitter:@ainame] プログラミング未経験なんて怖くない! 田垣亜季さん [twitter:@akiinyo] 周囲の助けを得ながら楽しく開発するためのアレコレ 蓮尾高志さん [twitter:@thso83] RailsエンジニアのためのTwi
Ruby for the Objective-C Runtime Project maintained by The MacRuby Team Hosted on GitHub Pages — Theme by mattgraham What Is MacRuby? MacRuby is an implementation of Ruby 1.9 directly on top of Mac OS X core technologies such as the Objective-C runtime and garbage collector, the LLVM compiler infrastructure and the Foundation and ICU frameworks. It is the goal of MacRuby to enable the creation of
Metaprogramming is pretty neat. While there is an awfully fun mad-scientist feeling I get when my code creates and redefines methods and entire classes at runtime, metaprogramming is not for every programmer or every project. But when it is able to make your life easier, I'm very thankful it can be wrangled Ruby. Now, conventional Ruby's flexibility and really-everything-can-change-at-runtime ment
現象 RVMで構築した環境でHerokuを起動させようとしたのだが、以下のようなエラーが発生。 $ heroku create redmine_hands_on /home/hoge/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- readline (LoadError) どうやらreadlineライブラリがRVM環境のパスに存在しないことが原因ぽい。 以前opensslライブラリでも同様の現象が発生したが、その時は以下のようにRVMの環境の構築し直しという面倒くさい対応を行った。 $ rvm remove 1.8.7 $ rvm install 1.8.7 --with-op
スクレイピングのチュートリアルを書いてみた。 参考:http://nokogiri.rubyforge.org/nokogiri/Nokogiri.html まだまだたくさんのクラスやメソッドがあるが(読んでない)、HTMLのスクレイピングに限定すれば多分これくらいで十分。 2014-02-16追記 なんかたくさんブックマークされていることに気づいたので、サンプルコードのRuby1.9/2対応のアップデート。 Mechanize周りも修正。WWW::Mechanize → Mechanize 等 (0) 前提知識 Ruby、HTML、DOM、CSSセレクタまたはXPath (1) クラス構造の理解 Nokogiri::HTML::Document < Nokogiri::XML::Document < Nokogiri::XML::Node < Object Nokogiri::XML::
Rails入門です。 require 'active_support'でactive_supportを読み込んだRubyでは、真偽判定に以下のメソッドが使えます。 nil? Rubyの標準メソッド。nilの場合のみtrueを返し、それ以外はfalseを返す。nilとfalseを判別したい場合などに、==演算子を使わずに書ける。 empty? String や Array に実装されているメソッド。空の文字列や空の配列の場合にtrueを返す。nilに対して呼び出すとNoMethodErrorが発生する。 blank? nil? or empty? のようなメソッド。nilまたは空のオブジェクトを判定できる。 present? !blank? を実行するメソッド。unless hoge.blank? とするくらいなら、if hoge.present? としたほうがelsifも書けるしすっきり。
nilや例外に関する備忘録。 下記の記載はrails consoleで確認。 ActiveRecord 関連 「例外が発生する」パターンと「IDが見つからなければnilを返す」パターンを使い分ける必要がある。 find User.find(1) # => #<User id: 1, name: "sinsoku"> User.find(999) # 存在しないid # 例外 ActiveRecord::RecordNotFound: Couldn't find User with ID=999 find_by_id User.find_by_id(1) # => #<User id: 1, name: "sinsoku"> User.find(999) # 存在しないid # => nil where User.where(:id => 1).first # => #<User id: 1
“I always get so frustrated trying to dig through a project new or old, and trying to trace the flow of execution and how things fit together...” You can't afford complicated code. Writing small and easily testable methods can certainly clean things up, but as your application grows your classes start to know too much. Large classes means a large cognitive overhead for understanding how things wor
ちょっと前に RubyMotion を触ってみてこれは面白いなと思いブログにでも書こうかと思った矢先にドラゴンクエスト10が発売してしまい、あれよあれよといううちに一ヶ月経ってしまいました。 それはさておき「るびも」こと RubyMotion ─ いや、るびもと呼んでいるのは自分だけですけど。Ruby で iOS のネイティブアプリが書けるというツールチェイン。コンパイラ、テストスイート、プロジェクト作成用スクリプトその他を含みます。主に CUI はターミナルでのコンパイルを想定していて、Xcode で開発するのに比べるとだいぶ *nix してるわーという気分になれる代物です。iOS アプリなのに Ruby! iOS アプリなのに CUI! ・・・ これだけでワクテカな方も多いかなと思います。 以下そんなるびもちゃんRubyMotion 様をざっと紹介していきたいと思います。なお、あらかじ
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く