Skip to content

Instantly share code, notes, and snippets.

@chrismccord
chrismccord / gist:1507045
Created December 21, 2011 18:13 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
# 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 :/'
var socket = new Phoenix.Socket(PewMiddle.config.socketPath);
PewMiddle.requestGame = function(username, callback) {
socket.join(PewMiddle.config.channel, "lobby", {username: username}, function(channel) {
var player = null;
channel.on("player:created", function(message) {
player = message;
});
channel.on("game:created", function(game) {
callback(game.id, player);
@chrismccord
chrismccord / postgres-upgrade-recipe.sh
Created October 6, 2015 11:14 — forked from eoinkelly/postgres-upgrade-recipe.sh
Upgrade Postgres to 9.4 using Homebrew on Mac OSX
#!/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
@chrismccord
chrismccord / observer.md
Created November 3, 2015 21:29 — forked from pnc/observer.md
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
@chrismccord
chrismccord / phoenix showdown rackspace onmetal io.md
Created November 17, 2015 14:58 — forked from omnibs/phoenix showdown rackspace onmetal io.md
Phoenix Showdown Comparative Benchmarks @ Rackspace

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.

Results

Framework Throughput (req/s) Latency (ms) Consistency (σ ms)
@chrismccord
chrismccord / 1.js
Created April 7, 2016 02:50 — forked from net/1.js
Adding Bootstrap to Phoenix using NPM
// 1. Add Bootstrap as a dependency in package.json
{
...
"dependencies": {
...
"bootstrap": "~3.3.6"
}
}
@chrismccord
chrismccord / drain_stop.ex
Created May 27, 2016 15:26 — forked from aaronjensen/drain_stop.ex
Phoenix Drain Stop
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
chrismccord / install.sh
Created July 27, 2016 23:51 — forked from chaos-ad/install.sh
Installing erlang in ubuntu
#!/bin/bash
# installing erlang on ubuntu's
VERSION="R15B01"
sudo apt-get install build-essential libncurses5-dev openssl libssl-dev
sudo mkdir -p /opt/erlang/
curl -O https://raw.github.com/spawngrid/kerl/master/kerl && chmod a+x kerl
sudo mv kerl /opt/erlang/
cat > Dockerfile <<'DOCKERFILE'
FROM yugabytedb/yugabyte:latest
ADD start.sh .
RUN chmod a+x start.sh
ENV RF=3
CMD ./start.sh
DOCKERFILE
cat > start.sh <<'START'