Skip to content

Instantly share code, notes, and snippets.

@wsmoak
wsmoak / gist:79882c4e41d7ac4bfd19
Last active August 29, 2015 14:24
mix troubleshooting
Following http://www.phoenixframework.org/v0.14.0/docs/installation
I've run into this:
$ mix local.hex
** (Mix) Could not access url https://s3.amazonaws.com/s3.hex.pm/installs/list.csv, error: {:failed_connect, [{:to_address, {'s3.amazonaws.com', 443}}, {:inet, [:inet], :eperm}]}
$ curl https://s3.amazonaws.com/s3.hex.pm/installs/list.csv
0.0.1,0.13.0-dev
0.1.0,0.13.1-dev
0.1.1,0.13.1-dev
@wsmoak
wsmoak / gist:4d034431a9b4907ea8f1
Created July 2, 2015 13:11
phoenix heroku troubleshooting
$ git push heroku master
Counting objects: 57, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (51/51), done.
Writing objects: 100% (57/57), 48.86 KiB | 0 bytes/s, done.
Total 57 (delta 1), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Fetching custom git buildpack... done
In this bit of http://elixir-lang.org/getting-started/case-cond-and-if.html
Clauses also allow extra conditions to be specified via guards:
iex> case {1, 2, 3} do
...> {1, x, 3} when x > 0 ->
...> "Will match"
...> _ ->
...> "Won't match"
...> end
@wsmoak
wsmoak / gist:278be60cc09421d4b9b6
Last active August 29, 2015 14:24
Logger output from Elixir OAuth2 Fitbit.get_token
21:05:35.526 request_id=7OAOqWxZPN0KhWAW/0p7 [info] %OAuth2.AccessToken{access_token: nil, client: %OAuth2.Client{authorize_url: "https://www.fitbit.com/oauth2/authorize", client_id: "22ABCD", client_secret: "c08ac2a9XXXXXXXa55caffb21292", headers: [{"Content-Type", "application/x-www-form-urlencoded"}, {"Accept", "application/json"}], params: %{"client_id" => "229MBF", "client_secret" => "c08ac2aXXXXXXXXXa55caffb21292", "code" => "e590a00XXXXXXXXXX1bb1d43d2906b515408", "grant_type" => "authorization_code", "redirect_uri" => "http://lvh.me:4000/auth/callback"}, redirect_uri: "http://lvh.me:4000/auth/callback", site: "https://api.fitbit.com", strategy: Fitbit, token_method: :post, token_url: "https://api.fitbit.com/oauth2/token"}, expires_at: nil, other_params: %{"errors" => [%{"errorType" => "oauth", "fieldName" => "n/a", "message" => "No Authorization header provided in the request. Each call to Fitbit API should be OAuth signed"}], "success" => false}, refresh_token: nil, token_type: "Bearer"}
[info] Running MyApp_802337.Endpoint with Cowboy on http://localhost:4000
02 Aug 20:58:34 - info: compiled 3 files into 2 files, copied 3 in 8060ms
[info] GET /api/tasks/1.json
[debug] Processing by MyApp_802337.TaskController.show/2
Parameters: %{"format" => "json", "id" => "1.json"}
Pipelines: [:api]
[info] Sent 400 in 456ms
[error] #PID<0.294.0> running MyApp_802337.Endpoint terminated
Server: localhost:4000 (http)
Request: GET /api/tasks/1.json
@wsmoak
wsmoak / gist:5e7c09630443841fbf77
Last active August 29, 2015 14:27
mix phoenix.new hangs on deps.get
$ mix phoenix.new test_project
[...]
* creating test_project/web/static/assets/robots.txt
* creating test_project/web/static/assets/images/phoenix.png
* creating test_project/web/static/assets/favicon.ico
Fetch and install dependencies? [Yn] Y
* running npm install && node node_modules/brunch/bin/brunch build
* running mix deps.get
@wsmoak
wsmoak / gist:e113839f2113efc38d71
Created August 23, 2015 20:28
HTTPoison response
response = ChargifyV2.get!("/calls/" <> call_id)
errors = response.body[:call]["response"]["result"]["errors"]
IO.inspect errors
[%{"attribute" => "customer.first_name",
"message" => "First name: cannot be blank."},
%{"attribute" => "customer.last_name",
"message" => "Last name: cannot be blank."},
%{"attribute" => "customer.email",
"message" => "Email address: cannot be blank."},
@wsmoak
wsmoak / gist:f5fd090df809e87a13fb
Last active September 7, 2015 21:53
Example.Rmd showing executable Elixir code in Tufte Handout RMarkdown format
---
title: "Executable Elixir in Tufte Handout"
author: "Wendy Smoak"
date: "September 1, 2015"
output: rmarkdown::tufte_handout
---
```{r setup, echo=FALSE}
# Adapted from http://datadrivensecurity.info/blog/posts/2015/Jun/running-other-languages-in-r-markdown-files/
# Licensed CC-BY-SA http://creativecommons.org/licenses/by-sa/4.0/
@wsmoak
wsmoak / gist:299c81607dcd1306a048
Last active September 7, 2015 19:06
elixir test failure with different version number
PROBLEM: Changing the version number makes a bunch of tests fail
SOLUTION: Avoid adding a newline to the VERSION file. Edit with `vim -b VERSION`.
$ git remote -v
origin https://github.com/elixir-lang/elixir.git (fetch)
origin https://github.com/elixir-lang/elixir.git (push)
$ git log | head
commit 1660d7d5c910e479d2db8963c3b9766183a89b64
@wsmoak
wsmoak / gist:c967f757851076fe71e9
Created September 27, 2015 13:33
Building the Elixir docs
Building the documentation requires ExDoc to be installed and built in the same containing folder as Elixir.
# After cloning and compiling Elixir
git clone git://github.com/elixir-lang/ex_doc.git
cd ex_doc && ../elixir/bin/mix do deps.get, compile
cd ../elixir && make docs