This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting | |
PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH" | |
source "/Users/nickgartmann/.rvm/scripts/rvm" | |
source "/Users/nickgartmann/.rvm/contrib/ps1_functions" | |
YELLOW="\[\033[3;33m\]" | |
PURPLE="\[\033[3;35m\]" | |
NO_COLOR="\[\033[0m\]" | |
RED="\[\033[3;31m\]" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < Sequel::Model | |
def facebook_access_token=(value) | |
return if value.nil? | |
facebook_user = User.get_facebook_user(value) | |
self.email = facebook_user["email"] if self.email.nil? && !facebook_user["email"].blank? | |
self.facebook_id = facebook_user["id"] | |
end | |
def self.get_facebook_user(access_token) | |
facebook_user_request = RestClient.get "https://graph.facebook.com/me", {:params=> {:access_token => access_token } } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:var thing=function(){var e=parseInt(document.getElementById("ID-overviewCounterValue").innerText);[].slice.call(document.querySelectorAll("link[type='image/x-icon']")).forEach(function(e){e.parentNode.removeChild(e)});var t=document.createElement("canvas");t.width=16;t.height=16;var n=t.getContext("2d");var r=function(){n.font="bold 10px sans-serif";n.fillText(e,e>9?2:4,12);var r=document.createElement("link");r.type="image/x-icon";r.rel="shortcut icon";r.href=t.toDataURL("image/x-icon");document.getElementsByTagName("head")[0].appendChild(r)};r()};setInterval(thing,1e3) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if test -z $1 || test -z $2 | |
then | |
printf "Usage: clone-database heroku-app-name database-name\n" | |
exit | |
fi | |
echo "Capturing backup" | |
heroku pgbackups:capture -e -a $1 | |
echo "Pulling dump" | |
curl -o /tmp/$1-latest.dump `heroku pgbackups:url -a $1` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'rest-client', '~> 1.6.7' | |
gem 'nokogiri' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var socket = new Phoenix.Socket("/ws"); | |
socket.join("ship", "topic", {}, function(channel) { | |
channel.on("connect", function(message) { | |
console.log("joined") | |
}) | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Pew.Ship do | |
use Phoenix.Channel | |
:timer.apply_interval(1000, __MODULE__, :gc, []) | |
def gc() do | |
IO.puts "stuff" | |
end | |
def join(socket, "join", msg) do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# Get the ip from boot2docker | |
boot2docker_ip=$(sudo -u $SUDO_USER boot2docker ip 2>&1 | awk '{ print $NF }' | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n//g') | |
hosts=`cat /etc/hosts | sed "s/^.*localdocker.*$//g"` | |
echo "$hosts" > /etc/hosts | |
echo "$boot2docker_ip localdocker" >> /etc/hosts | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17:06:25.586 [error] #PID<0.258.0> running Spacegame.Endpoint terminated | |
Server: localhost:4000 (http) | |
Request: GET /ws | |
** (exit) an exception was raised: | |
** (ErlangError) erlang error: [reason: %Protocol.UndefinedError{description: nil, protocol: String.Chars, value: %{"thin" => "one"}}, mfa: {Phoenix.Endpoint.CowboyHandler, :websocket_handle, 3}, stacktrace: [{String.Chars, :impl_for!, 1, [file: 'lib/string/chars.ex', line: 3]}, {String.Chars, :to_string, 1, [file: 'lib/string/chars.ex', line: 17]}, {Logger, :truncate, 2, [file: 'lib/logger.ex', line: 492]}, {Logger, :log, 3, [file: 'lib/logger.ex', line: 404]}, {Spacegame.GameChannel, :event, 3, [file: 'web/channels/game.ex', line: 44]}, {Phoenix.Channel.Transport, :dispatch, 4, [file: 'lib/phoenix/channel/transport.ex', line: 102]}, {Phoenix.Channel.Transport, :dispatch, 4, [file: 'lib/phoenix/channel/transport.ex', line: 67]}, {Phoenix.Transports.WebSocket, :ws_handle, 2, [file: 'lib/phoenix/transports/websocket.ex', line: 45]}], msg: {:text, "{\"cha |
OlderNewer