Skip to content

Instantly share code, notes, and snippets.

View client.js
var socket = new Phoenix.Socket(PewMiddle.config.socketPath);
PewMiddle.requestGame = function(username, callback) {
socket.join(, "lobby", {username: username}, function(channel) {
var player = null;
channel.on("player:created", function(message) {
player = message;
channel.on("game:created", function(game) {
callback(, player);
chrismccord / gist:1507045
Created December 21, 2011 18:13 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts
View gist:1507045

Sublime Text 2 – Useful Shortcuts (Mac OS X)


⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
chrismccord / phoenix showdown rackspace onmetal
Created November 17, 2015 14:58 — forked from omnibs/phoenix showdown rackspace onmetal
Phoenix Showdown Comparative Benchmarks @ Rackspace
View phoenix showdown rackspace onmetal

Comparative Benchmark Numbers @ Rackspace

I've taken the benchmarks from Matthew Rothenberg's phoenix-showdown, updated Phoenix to 0.13.1 and ran the tests on the most powerful machines available at Rackspace.


Framework Throughput (req/s) Latency (ms) Consistency (σ ms)
View gist:5301821
# remove any bad refs
git remote prune origin
# pipe into bash and auto-delete any branches that have been merged into master!
git log master --pretty=format:'%d' | grep '^ (origin' | tr -d ' ()' | sed 's/origin\//git push origin :/'
chrismccord /
Created October 6, 2015 11:14 — forked from eoinkelly/
Upgrade Postgres to 9.4 using Homebrew on Mac OSX
# 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
chrismccord / 1.js
Created April 7, 2016 02:50 — forked from net/1.js
Adding Bootstrap to Phoenix using NPM
View 1.js
// 1. Add Bootstrap as a dependency in package.json
"dependencies": {
"bootstrap": "~3.3.6"
chrismccord /
Created July 27, 2016 23:51 — forked from chaos-ad/
Installing erlang in ubuntu
# installing erlang on ubuntu's
sudo apt-get install build-essential libncurses5-dev openssl libssl-dev
sudo mkdir -p /opt/erlang/
curl -O && chmod a+x kerl
sudo mv kerl /opt/erlang/
chrismccord / drain_stop.ex
Created May 27, 2016 15:26 — forked from aaronjensen/drain_stop.ex
Phoenix Drain Stop
View drain_stop.ex
defmodule DrainStop do
@moduledoc """
DrainStop Attempts to gracefully shutdown an endpoint when a normal shutdown
occurs. It first shuts down the acceptor, ensuring that no new requests can be
made. It then waits for all pending requests to complete. If the timeout
expires before this happens, it stops waiting, allowing the supervision tree
to continue its shutdown order.
DrainStop should be installed in your supervision tree *after* the
EndPoint it is going to drain stop.
chrismccord /
Created November 3, 2015 21:29 — forked from pnc/
Using Erlang observer/appmon remotely

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