Skip to content

Instantly share code, notes, and snippets.

@chrismccord
chrismccord / upgrade.md
Last active September 5, 2025 05:27
Phoenix 1.2.x to 1.3.0 Upgrade Instructions

If you want a run-down of the 1.3 changes and the design decisions behidn those changes, check out the LonestarElixir Phoenix 1.3 keynote: https://www.youtube.com/watch?v=tMO28ar0lW8

To use the new phx.new project generator, you can install the archive with the following command:

$ mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez

Bump your phoenix dep

Phoenix v1.3.0 is a backwards compatible release with v1.2.x. To upgrade your existing 1.2.x project, simply bump your phoenix dependency in mix.exs:

#Phoenix 1.1.x to 1.2.0 Upgrade Instructions

Project Generator

To generate new projects as 1.2.0, install the new mix archive:

mix archive.install https://github.com/phoenixframework/archives/raw/master/phoenix_new.ez

Deps

# In case anyone is wondering how to easily use the :crypto hash or hmac API's from elixir-land, here you go.
File.stream!(filename, [:read, {:read_ahead, 65535}], 65535)
|> Enum.reduce(:crypto.hash_init(:sha), &:crypto.hash_update(&2, &1))
|> :crypto.hash_final
|> Base.encode16
# Line 3 opens up a stream, and we're reading in 64KB chunks from the FS which is roughly pretty efficient
# In line 4, we initialize our hash (which returns a context) and put that as the default value in the reducer
# The hash_update in the reducer returns the modified context. Remember arg1 is the item, and arg2 is the accumulator
@col
col / setup_elixir_app_on_travis_ci.md
Last active July 4, 2020 17:46
Configure Elixir app on Travis CI

Configure Elixir app on Travis CI

Setup Build

  1. Create .travis.yml file in the base dir
  2. Enter the following content:
language: elixir
elixir:
 - 1.2
@devekko
devekko / xenial-tweaks.sh
Created January 2, 2016 07:56
xenial-tweaks.sh
sudo apt-get install -yq byobu git wget curl
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
sudo apt-get update
sudo apt-get install -yq google-chrome-stable
sudo apt-key adv --keyserver pgp.mit.edu --recv-keys 5044912E
sudo sh -c 'echo "deb http://linux.dropbox.com/ubuntu/ wily main" >> /etc/apt/sources.list.d/dropbox.list'
sudo apt-get update
sudo apt-get install -yq dropbox
sudo apt-get install -yq software-properties-common
@caalberts
caalberts / custom-connection-auth0.md
Last active September 18, 2018 01:09
Create custom OAuth2 connection to third party identity providers using Auth0

Custom OAuth2 Connection with Auth0

Understanding Auth0 authentication

Before we start with creating a custom OAuth2 connection in Auth0, it's worth to spend some time understanding the OAuth2 authentication process in Auth0. An OAuth2 authentication process starts with the application requesting Auth0 for authentication and ends with either the browser or the application server having an access token to represent the user. The access token can then be used to call the third party API on behalf of the user.

Pop-up mode Auth0 popup mode

Redirect mode

internal let DEFAULT_MIME_TYPE = "application/octet-stream"
internal let mimeTypes = [
"html": "text/html",
"htm": "text/html",
"shtml": "text/html",
"css": "text/css",
"xml": "text/xml",
"gif": "image/gif",
"jpeg": "image/jpeg",
@xtuc
xtuc / script.php
Created October 13, 2015 12:32
How to use OVH API to enable network burst on SBG1 servers?
<?php
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;
// Informations about your application
$applicationKey = "your_app_key";
$applicationSecret = "your_app_secret";
$consumer_key = "your_consumer_key";
// Information about API and rights asked
@hironobu-s
hironobu-s / gist:514303b5627c70925a51
Created July 8, 2015 11:28
Using TempURL with PUT method
# swift post testcontainer
# swift list
testcontainer
# swift post -m "Temp-Url-Key:testkey"
# swift stat
Account: nc_*********************************
Containers: 1
Objects: 0
Bytes: 0
Containers in policy "policy-0": 1

Angular2 + JSPM cheat sheet

First time setup

  • install jspm beta: npm install -g jspm@beta
  • set up your project: jspm init
  • install dependencies: jspm install angular2 reflect-metadata zone.js es6-shim

This will create a jspm_packages folder, and a config.js file.

Open the config.js file - this file manages options for the System.js loader - tweak it as appropriate