hamayuzinの日記

エンジニアとかデータサイエンティストとかやってます。あの時 あれやってたな的な備忘録にできれば。

2017-01-01から1年間の記事一覧

【rspec/rails】railsのrspecでhelperをテストする

rspecを使った、helperのテスト方法 基本は他のテストと同じ 記述方法 app/helpers/test_helper.rb module TestHelper def test_method 'テストだよ' end end spec/helpers/test_helper.rb require 'rails_helper' RSpec.describe TestHelper do include Tes…

【heroku/ridgepole】herokuでridgepole/mysqlを動かす

herokuにrailsプロダクトをアップロードするにあたり、 ridgepoleでつまづいた エラー1:[ERROR] No such file or directory @ rb_sysopen - /app/config/database.yml ridgpoleを実行する際、下記コードを実行するのだが heroku run 'bundle exec ridgepole…

【heroku/ridgepole】herokuでridgepole/mysqlを動かす

herokuにrailsプロダクトをアップロードするにあたり、 ridgepoleでつまづいた エラー1:[ERROR] No such file or directory @ rb_sysopen - /app/config/database.yml ridgpoleを実行する際、下記コードを実行するのだが heroku run 'bundle exec ridgepole…

【まじ簡単】awsのg2インスタンスで、GPUを使ってkerasを動かす

Kerasでモデルの学習を行っていると、時間だけを浪費している瞬間がどうしてもでてくる。 そこで、AWSのg2インスタンスで、GPUを使って効率化を図った 今回は、GPUを使うための環境設定と、kerasのインストールを行う AWS g2.2xlergeの立ち上げ kerasのバッ…

【Rails/パンくず】Railsでパンくずリストを作る簡単な方法

Webサイト作っていると、パンくずリスト作りたくなる。 railsではいい感じにしてくれるgemがある。 github.com gemfileに上記gem追加して、bundle installする。 アーティスト>曲の場合 app/controllers/songs_controller.rb class SongsController < Appli…

【Rails/favicon】railsでロゴとfavicon作って設定する

デザインセンスが無い場合に、ロゴとfaviconをどう作成するのか。 そして、それをどう反映させるのか ロゴの作成 いい感じに素早く作るならここ http://emblemmatic.org/markmaker/#/ 入力してダウンロードするだけ faviconの作成 ここが、全てのタイプのfav…

【Rails/action_cable】action_cableをnginx+unicornで動かす

action cableを本番のnginx uninorn下で動かく設定のメモ 今回はAWSのEC2とLBを使う 前提 昔からあるLoad Balancer(現在はCLB)では動かないので 諦めて、Application Load Balancer(ALB)を使う また、AWS上でredisの設定もしておくこと nginx location /cabl…

ridgepole本番deploy時に invalid multibyte char (US-ASCII)

ridgepoleを使って、rails project deploy時に bundle stderr: fatal: Not a git repository (or any of the parent directories): .git fatal: Not a git repository (or any of the parent directories): .git fatal: Not a git repository (or any of the…

ridgepoleでtable追加していく

ridgepoleとは rails g migration して。。。とかめんどくさい場合にとても使える github.com 準備 Gemfileに下記追加 gem 'ridgepole' bundle (install) Schemafileをapp下に作成(ちゃんと先頭は大文字にすること) 音楽系のテーブルの場合下記な感じで記…

rails5で新規プロジェクト作成手順

railsでrails 5で新しくプロジェクトを作成する プロジェクトの準備 mkdir フォルダ名 cd フォルダ名 rbenv local 2.4.0 bundle init vim Gemfile gem 'rails', '~> 5.0', '>= 5.0.2' を追記 bundle install --path vendor/bundle bundle exec rails new . …

bootstrapテンプレートをrailsに組み込んで表示設定

bootstrapテンプレートを購入 デザインが苦手なので、既存のイケてるやつを組み込む。 下記でking uiを購入。 wrapbootstrap.com bootstrapテンプレートをrailsに jsフォルダのファイルを、app/javascripts下に scssフォルダのファイルを、scss/stylesheets…