2016-01-01から1年間の記事一覧
サンプルページ 3がつく数字でアホになるやつ tl;dr npm install -gはだるいので、npm scripts経由でwebpack呼ぶのがよさそう webpackが扱うべきファイルによってloaderがひつよう(babel-loaderとか) loaderを書く順番でひっかかって非常にだるかった impo…
っていうエラーが出る protocol String.Chars not implemented for %{"avatar_url" => "https://avatars.githubusercontent.com/u/12345?v=3"} 文字列補完(string interpolation)に、String.Charsを持っていないデータ(MapとかStruct)を渡していることに…
こういうことを学んだので↓ otiai10.hatenablog.com これを、Ecto.Migrationでやりたい defmodule MyApp.Repo.Migrations.CreateUserToken do use Ecto.Migration def change do create table(:posts) do add :user_id, references(:users, on_delete: :dele…
同居できるんかなと(ほんとはMariaDB) mysql> CREATE TABLE users ( id SERIAL, name VARCHAR(255) ); Query OK, 0 rows affected (0.01 sec) mysql> CREATE TABLE posts ( user_id BIGINT(20) UNSIGNED DEFAULT NULL, # ← あえてつける message VARCHAR(2…
stackoverflow.com Ecto.Repo.__info__(:functions) [__adapter__: 0, __pool__: 0, __query_cache__: 0, __repo__: 0, all: 1, all: 2, config: 0, delete: 1, delete: 2, delete!: 1, delete!: 2, delete_all: 1, delete_all: 2, get: 2, get: 3, get!: 2,…
Ecto.Migration – Ecto v2.0.0-beta.0 execute使お... defmodule MyApp.Repo.Migrations.CreateProviderTable do use Ecto.Migration def change do create table(:providers) do add :name, :string timestamps end create unique_index(:providers, [:name…
Elixir (iex) iex(1)> (fn msg -> IO.puts msg end).("hello!") hello! :ok Go func(msg string) { fmt.Println(msg) }("hello!")
% heroku run --app my-app env env実行したらええやん的な
前回まで 【Elixir】バージョン管理しつつErlangとElixirをMacにインストールする - DRYな備忘録 【Elixir】the result of the expression is ignored - DRYな備忘録 【Elixir】use of operator === has no effect と言われる - DRYな備忘録 Elixirでゼロ埋…
iex(6)> String.rjust("hoge", 8, ?0) "0000hoge" zero paddingしたい対象がintegerなら、適宜、第1Integer.to_striingなど使う。 123 |> Integer.to_string |> String.rjust(8, ?0) 参考 In Elixir, how do you format numbers with string interpolation -…
問題 Elixirのコンパイラに掲題のように叱られる。 原因 「===使ってもええんやで」という意味。 解決 1..max |> Enum.each fn(n) -> - case {rem(n, 3) == 0, rem(n, 5) == 0} do + case {rem(n, 3) === 0, rem(n, 5) === 0} do {true, true} -> 雑感 たと…
問題 ElixirでFizzBuzz書いてて、掲題のように怒られる main.exs:4: warning: the result of the expression is ignored (suppress the warning by assigning the expression to the _ variable) the result of the expression is ignored (suppress the war…
問題 だいたいどんなDBのイメージ使ってても、同じdocker-composeでサーバアプリケーションも一緒に動かそうとすると、いかのように叱られることがよくある。 Unknown MySQL server host 'localhost' べつにMySQLに限らない。MongoDBでもRedisでも、ありがち…
just want "Hello, World"? brew install elixirで、ErlangもElixirも入ります。 参考 qiita.com Prerequisite JDK installed on your mac brew install wget Good Bye Elixir, installed via brew brewで入れたelixirは消す % brew uninstall elixir % brew…
問題 CREATE TABLE文を実行すると、(書いてて思ったけど、UUID v4、255byteもなくていいな) CREATE TABLE "users" ( "id" varchar(255) DEFAULT uuid_generate_v4(), "name" text, PRIMARY KEY ("id") ) 以下のようにしかられる ERROR: function uuid_gene…
追記(2016/12/22) 任意のパッケージがインストールされた環境をHerokuにつくりたい、という目的でDockerを選択したけれど、Dockerfileに書かれているinstallコマンドは有効に動かない、みたいな情報を得ました。で、どうやらさいきんはbuildpackをうまいこ…
いろいろやったけど結局これでした launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist ログ % pg_ctl stop pg_ctl: no database directory specified and environment variable PGDATA unset oh... % pg_ctl stop -D /usr/local/var/…
ゴール MacOSXで、docker-machineでvirtualbox VMをつくって、そこをdockerホストとして、docker-composeを使って複数種類のコンテナをオーケストレーションしている じゃあ、もともとdockerが使える環境にしているLinuxで、docker-composeを使って複数種類…
問題 docker-machine envすると、 There was an error validating certificates for host ~ と叱られる Error checking TLS connection: Error checking and/or regenerating the certs: There was an error validating certificates for host "192.168.99.1…
問題 docker-compose.yml mongodb: container_name: mongodb image: mongo:3.2.0 ports: - "27017:27017" myapp: container_name: myapp build: . dockerfile: Dockerfile links: - mongodb # まずはもちろんこれが必要 main.rb(抜粋) require 'mongo_mapp…
問題 Mac上でdocker-machineでVMを立て、そこに向けてdocker-composeを華麗に決める % docker-compose build # 略 Step 5 : RUN bundle install ---> Running in e8c4e026277a # 略 Fetching source index from https://rubygems.org/ Could not fetch specs…
つくった github.com 今んとこGETだけ