Skip to content

Instantly share code, notes, and snippets.

@chrismccord
chrismccord / observer.md
Created Nov 3, 2015 — forked from pnc/observer.md
Using Erlang observer/appmon remotely
View observer.md

Using OTP's observer (appmon replacement) remotely

$ ssh remote-host "epmd -names"
epmd: up and running on port 4369 with data:
name some_node at port 58769

Note the running on port for epmd itself and the port of the node you're interested in debugging. Reconnect to the remote host with these ports forwarded:

$ ssh -L 4369:localhost:4369 -L 58769:localhost:58769 remote-host
@chrismccord
chrismccord / postgres-upgrade-recipe.sh
Created Oct 6, 2015 — forked from eoinkelly/postgres-upgrade-recipe.sh
Upgrade Postgres to 9.4 using Homebrew on Mac OSX
View postgres-upgrade-recipe.sh
#!/bin/bash
# This script can be used in "run & hope" mode or you can use it as a recipe to
# do things manually - you probably want the latter if you really care about
# the data in your databases.
# Happy hacking
# /Eoin/
# Tell bash to stop if something goes wrong
set -e
View document_channel.ex
broadcast! socket, "insert_img", %{
url: url,
start: params["start"],
end: params["end"]
}
View catch_all_action.ex
defmodule MyApp.Web do
def controller do
quote do
use Phoenix.Controller
use MyApp.CatchAllController
...
end
end
end
@chrismccord
chrismccord / gist:ee5ae90b949a9768b871
Last active Aug 29, 2015
Phoenix 0.16.x to 0.17.0 upgrade instructions
View gist:ee5ae90b949a9768b871

Deps

Bump your :phoenix and :phoenix_live_reload deps in mix.exs:

def deps do
  [...
   {:phoenix, "~> 0.17"},
   {:phoenix_live_reload, "~> 1.0"},
  ...]
@chrismccord
chrismccord / upgrade.md
Last active Aug 29, 2015
Phoenix 0.15.x to 0.16.0 upgrade instructions
View upgrade.md

Phoenix dep

Update your phoenix dep:

def deps do
 [...,
  {:phoenix, "~> 0.16"},
  ...]
end
@chrismccord
chrismccord / phoenix-0.15-upgrade.md
Last active Aug 29, 2015
Phoenix upgrade instructions 0.14.x to 0.15.0
View phoenix-0.15-upgrade.md

Sockets and Channels

A new socket behaviour has been introduced to handle socket authentication in a single place, wire up default channel assigns, and disconnect a user's multiplex connection as needed.

First things first, create a UserSocket module in web/channels/user_socket.ex and move all your channel routes from web/route.ex to the user socket: (replace MyApp with your application module)

0.14.x - web/router.ex:

defmodule MyApp.Router do
   ...
@chrismccord
chrismccord / gist:57805158f463d3369103
Last active Feb 12, 2016
Phoenix Upgrade Instructions 0.13.x 0.14.0
View gist:57805158f463d3369103

First, bump your phoenix in mix.exs:

def deps do
  [{:phoenix, "~> 0.14"}, ...
end

phoenix_html

Update your phoenix_html version to 1.1.0 in mix.exs:

View gist:b662bd26f68fa10b6651
defmodule MyApp.Password do
@moduledoc """
Handles password authentication, encryption, and decryption
"""
@doc """
Encrypte the password String
"""
def encrypt(raw_password) do
View gist:316400191d50278c3fed
set-option -g default-command "reattach-to-user-namespace -l zsh"
# Use vim keybindings in copy mode
setw -g mode-keys vi
# Setup 'v' to begin selection as in Vim
bind-key -t vi-copy v begin-selection
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"