Skip to content

Instantly share code, notes, and snippets.

Justin McNally j-mcnally

Block or report user

Report or block j-mcnally

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
j-mcnally /
Created Jul 16, 2015
Hugo + CaddyServer + Heroku

Running Hugo in Theory

  • Use heroku caddybuild pack with git pull

  • Tell Caddy to pull from github repo

  • Post pull command, run hugo on files from git repo

  • Add / Edit articles using github ace editor or git push

  • Caddy pulls repo files and rebuilds hugo site.


j-mcnally / user.ex
Created Jun 17, 2015
Demo Controller
View user.ex
defmodule Struct.Api.V1.UserController do
use Phoenix.Controller
alias Poison, as: JSON
import Ecto.Query, only: [from: 2]
plug Struct.AuthenticationPlug
plug :action
def update(conn, _params) do
user = conn.assigns[:current_user]
if user do
j-mcnally / auth.ex
Created Jun 17, 2015
Authentication Plug
View auth.ex
defmodule Struct.AuthenticationPlug do
alias Plug.Conn
alias Phoenix.Status
alias Phoenix.Controller.Errors
alias Poison, as: JSON
import Phoenix.Controller.Connection
import Plug.Conn
import Ecto.Query, only: [from: 2]
def init(opts), do: opts
# Originally from
# Usage:
# A call to http://localhost:80000/ will cache the file
# at on disc and not redownload it again.
# To clear the cache simply do a `rm *.cached`. To stop the server simply
# send SIGINT (Ctrl-C). It does not handle any headers or post data.
import BaseHTTPServer
import hashlib
View gist:edc37a5524288430d7b7
remote: Installing collected packages: markupsafe, six, PyYAML, webassets, itsdangerous, Jinja2, Werkzeug, python-frontmatter, hamlish-jinja, Flask-Assets, frozen-flask, gunicorn, flask
remote: Running install for markupsafe
remote: building 'markupsafe._speedups' extension
remote: gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/app/.heroku/python/include/python2.7 -c markupsafe/_speedups.c -o build/temp.linux-x86_64-2.7/markupsafe/_speedups.o
remote: gcc -pthread -shared build/temp.linux-x86_64-2.7/markupsafe/_speedups.o -o build/lib.linux-x86_64-2.7/markupsafe/
remote: Running install for PyYAML
remote: checking if libyaml is compilable
remote: gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/app/.heroku/python/include/python2.7 -c build/temp.linux-x86_64-2.7/check_libyaml.c -o build/temp.l
j-mcnally / invite.rb
Last active Aug 29, 2015
Automate Slack invites, for slack chat / community websites. Used by
View invite.rb
module Slack
class Invite
def call(options)
email = options[:email]
throw "You must call this method with an email" unless email.present?
invite ="https://#{ENV['SLACK_SUBDOMAIN']}{}",
{"email" => email,
"token" => ENV['SLACK_API_TOKEN'],
"set_active" => "true",
"_attempts" => "1"
View test
from waitlisted import reservation
res = reservation.create({'email': ''})
print "Your position is " + res.position + " of " +
View gist:b5e60d1465d17e083fd1
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
View test.haml
= fa_icon "users", class: "fa-5x"
Affiliate System
Lorem impsum
View gist:a8c1d1b4145070a27266'', {"a": "b"})
.on('end', function(response) {
You can’t perform that action at this time.