Skip to content

Instantly share code, notes, and snippets.

@dgoldie
dgoldie / Upgrade_phoenix4.md
Created August 6, 2014 22:27
Upgrade to Phoenix 4

README - upgrade to phoenix 4.

This conversion was actually done with phoenix master, the week before phoenix 4 released.

Using:

  • Erlang 17.0
  • Elixir 0.15.0
  • Phoenix master, "55577a267a1635af3d19fb5c37381077bd25e484"

Steps:

upstream app {
server 127.0.0.1:4000 fail_timeout=5s;
}
server {
listen 80 default_server;
server_name _;
root '/var/app/current/priv/static';
@chrismccord
chrismccord / gist:e774e6ab5220e6505a03
Last active August 29, 2015 14:10
Upgrading your Phoenix 0.5.x application to 0.6.0

Upgrading Phoenix 0.5.x to 0.6.0

If you're still on 0.4.x, follow [this 0.4x to 0.5.0 upgrade guide] (http://learnelixir.com/blog/2014/10/29/migrating-applications-from-phoenix-0-dot-4-1-to-phoenix-0-dot-5-0/), then head back over here.

Phoenix 0.6.0 brings some nice enhancements and a few backwards incompatible changes. The following steps should get your 0.5.x apps up and running on the latest and greatest.

Router

The Router no longer defines the default :browser and :api pipelines for you, but they remain the idiomatic defaults. You can copy the standard pipelines into your router:

(defun tester (&rest cl-keys)
(cl--parsing-keywords ((:function nil) (:match nil)) nil
(if (and buffer-file-name (string-match cl-match buffer-file-name))
(setq tester--test-run-function cl-function)
(setq tester--test-run-function nil))))
(defun tester--store-setup ()
(setq tester--last-test-file buffer-file-name)
(setq tester--last-test-function tester--test-run-function))
# config/initializers/delayed_job_mongoid.rb
module Delayed
module Backend
module ActiveRecord
class Job < ::ActiveRecord::Base
def self.before_fork
::ActiveRecord::Base.clear_all_connections!
::Mongoid.master.connection.close
end
@cromwellryan
cromwellryan / Guardfile
Last active December 19, 2015 08:19
Guardfile for elixirc
guard 'shell', :elixirc_bin => "/usr/local/elixirc" do
watch(/(.+\.ex$)/) { |m| `elixirc #{m[0]}` }
end
guard 'shell', :elixir_bin => "/usr/local/elixir" do
watch(/(.+\.exs$)/) { |m| `elixir #{m[0]}` }
end
@eoinkelly
eoinkelly / postgres-upgrade-recipe.sh
Last active November 9, 2017 16:59
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
@rednaxelafx
rednaxelafx / prettyprint.js
Created January 20, 2011 03:03
Pretty print JavaScript objects (does not conform to JSON, because we don't want escape sequences in string literals)
function isPlainObject(o) {
return o && toString.call(o) === '[object Object]' && 'isPrototypeOf' in o;
}
function isArray(o) {
return toString.call(o) == '[object Array]';
}
function objectToString(val) {
var INDENT = '&nbsp;&nbsp;';
@myobie
myobie / mountain-lion-brew-setup.markdown
Created February 18, 2012 20:14
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from the App Store.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

@jfreeze
jfreeze / tailwindsetup.txt
Last active July 15, 2022 17:54
TailwindCSS Setup
mix phx.new app_name
cd app_name
cd assets
npm install tailwindcss @tailwindcss/ui postcss-import postcss-loader --save-dev
npx tailwindcss init
npx tailwind init tailwindcss-full.js --full
# Change the app dir to your app dir!