Skip to content

Instantly share code, notes, and snippets.

@mattweldon
mattweldon / up-and-running-with-edeliver-on-do.md
Last active September 3, 2021 16:48
Getting Elixir / Phoenix running on Digital Ocean with edeliver

Build Server

  • Go to Digital Ocean
  • Create new droplet
  • London
  • Ubuntu
  • No apps
  • Add SSH keys
@mattweldon
mattweldon / environment.js
Created May 18, 2016 08:47
Ember ContentSecurityPolicy
contentSecurityPolicy: {
'default-src': "'none'",
'script-src': "'self'",
'connect-src': "'self'",
'style-src': "'self' 'unsafe-inline'",
'font-src': "'self' 'unsafe-inline'",
'img-src': "'self'"
},
// Goes between EmberENV and APP in /config/environment.js
@mattweldon
mattweldon / pubsub.ex
Created February 21, 2016 22:21
Simple PubSub implementation using Redix (Exredis)
defmodule PubSub do
def broadcast(channel, topic, payload) do
{:ok, client} = Exredis.start_link
payload = payload |> Map.put(:topic, topic)
client |> Exredis.Api.publish channel, Poison.encode!(payload)
end
def subscribe(channel, module) do
sup = spawn_link fn -> accept_messages(module) end
@mattweldon
mattweldon / post-route.js
Last active August 29, 2015 14:27
Ember Nested URLs Error
// ...
model: function(params) {
// ...
var versions = _this.store.findRecord('post-version', post.get('id'));
// http://localhost:4101/api/v1/posts/1/versions gets called correctly...
import DS from "ember-data";
export default DS.RESTAdapter.extend({
host: 'http://localhost:4101/api/v1',
buildURL: function(root, suffix, record) {
var url = this._super();
return url + '/posts/' + suffix + '/versions';
}
});