Skip to content

Instantly share code, notes, and snippets.

View alanpeabody's full-sized avatar

Alan Peabody alanpeabody

View GitHub Profile
@alanpeabody
alanpeabody / output
Created September 3, 2016 14:36
mix dialyzer
Unknown functions:
'Elixir.JaSerializer.Formatter.Function':'__impl__'/1
'Elixir.JaSerializer.Formatter.Map':'__impl__'/1
'Elixir.JaSerializer.Formatter.PID':'__impl__'/1
'Elixir.JaSerializer.Formatter.Port':'__impl__'/1
'Elixir.JaSerializer.Formatter.Reference':'__impl__'/1
'Elixir.JaSerializer.Formatter.Tuple':'__impl__'/1
@alanpeabody
alanpeabody / A_README.md
Created July 17, 2016 15:33
Running a elixir dependency's migrations from parent app (in parent repo)

Goal

To pull in dependencies and have them run their migrations in the parent apps' repo.

Setup

MyChild - A mix application with ecto migrations, schemas, etc. MyParent - A phoenix application that wants to leverage the child application.

In this case MyParent has added MyChild as a mix dependency via github, eg:

Keybase proof

I hereby claim:

  • I am alanpeabody on github.
  • I am alanpeabody (https://keybase.io/alanpeabody) on keybase.
  • I have a public key ASBfa3-DEWUJUKe4a5LeMKEeNJ3dyBwn93SXcewQPoDMpQo

To claim this, I am signing this object:

@alanpeabody
alanpeabody / local_storage.ex
Last active July 16, 2017 15:30
JS's LocalStorage in Elixir - A super simple intro to GenServer for js devs
defmodule LocalStorage do
use GenServer
# API
def start_link do
GenServer.start_link(__MODULE__, %{}, name: __MODULE__)
end
def set_item(key, val) do

(Breakfast) Tacos

This is really a two meal recipe, with my favorite the second meal - breakfast!

You can prepare the meat either on the gril or in a crock pot. If you prepare on the grill buy better steak.

Ingredients

  • Sweet Onion - Diced fine
  • Steak.
@alanpeabody
alanpeabody / a_discussion.md
Last active August 29, 2015 14:26
JaSerializer Serialization Milestones

JaSerializer Roadmap

The initial release of JaSerializer successfully accomplishes it's mission; it serializes data to jsonapi.org format.

Roadmap:

  • Solidify/determine future of the DSL.
  • Better Ecto integration.
  • A Phoenix view integration.
@alanpeabody
alanpeabody / my_app.ex
Last active March 24, 2024 13:28
Websockets in Elixir with Cowboy and Plug
defmodule MyApp do
use Application
def start(_type, _args) do
import Supervisor.Spec, warn: false
children = [
Plug.Adapters.Cowboy.child_spec(:http, MyApp.Router, [], [
dispatch: dispatch
])
@alanpeabody
alanpeabody / dev_code_reload_plug.ex
Created June 30, 2015 14:42
dev_code_reload_plug.ex
# Reload/recompile code before each request in development only using Plug & Mix.
# Assumes MyApp.Router is a plug that handles actual routing.
def MyApp.Main do
use Plug.Builder
plug :reload
plug :dispatch
def reload(conn, _opts) do
if Mix.env == :dev, do: Mix.Tasks.Compile.Elixir.run(["--ignore-module-conflict"])
@alanpeabody
alanpeabody / 0_README.md
Last active August 29, 2015 14:23
Relax DSL RFC

Relax DSL expansion.

Serialization has been moved to the JaSerializer library with the intent of improving the routing/resource DSL to provide more out of the box functionality.

Goals

  • Super easy to create simple jsonapi.org compliant RESTful APIs.
  • Standard Ecto models need little to no "wiring" to get working.
  • Improved DSL for working with non Ecto models (eg: Mnesia, ETS, Riak, etc)
  • Complete ability to override anything as needed.
@alanpeabody
alanpeabody / ja_serializer.ex
Created June 14, 2015 19:20
JSON API serializers - w/o routing
defmodule JaSerializer do
end