Skip to content

Instantly share code, notes, and snippets.

Avatar

Alan Peabody alanpeabody

  • Burlington, Vermont
View GitHub Profile
View output
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 Jul 17, 2016
Running a elixir dependency's migrations from parent app (in parent repo)
View A_README.md

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:

View keybase.md

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 Jul 16, 2017
JS's LocalStorage in Elixir - A super simple intro to GenServer for js devs
View local_storage.ex
defmodule LocalStorage do
use GenServer
# API
def start_link do
GenServer.start_link(__MODULE__, %{}, name: __MODULE__)
end
def set_item(key, val) do
View breakfast_tacos.md

(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 Aug 29, 2015
JaSerializer Serialization Milestones
View a_discussion.md

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 Oct 17, 2021
Websockets in Elixir with Cowboy and Plug
View my_app.ex
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
])
View 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 Aug 29, 2015
Relax DSL RFC
View 0_README.md

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 Jun 14, 2015
JSON API serializers - w/o routing
View ja_serializer.ex
defmodule JaSerializer do
end