Skip to content

Instantly share code, notes, and snippets.

Matt Weldon mattweldon

View GitHub Profile
@mattweldon
mattweldon / environment.js
Created May 18, 2016
Ember ContentSecurityPolicy
View environment.js
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 Feb 21, 2016
Simple PubSub implementation using Redix (Exredis)
View pubsub.ex
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 / up-and-running-with-edeliver-on-do.md
Last active Jun 23, 2018
Getting Elixir / Phoenix running on Digital Ocean with edeliver
View up-and-running-with-edeliver-on-do.md

Build Server

  • Go to Digital Ocean
  • Create new droplet
  • London
  • Ubuntu
  • No apps
  • Add SSH keys
@mattweldon
mattweldon / post-route.js
Last active Aug 29, 2015
Ember Nested URLs Error
View post-route.js
// ...
model: function(params) {
// ...
var versions = _this.store.findRecord('post-version', post.get('id'));
// http://localhost:4101/api/v1/posts/1/versions gets called correctly...
View adapters-post-version.js
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';
}
});
You can’t perform that action at this time.