Some thoughts and ideas on best practices building Ember apps after 2 years building and maintaining 6+ apps. This is less about the obvious best practices, like use ember-cli, and more along the lines of when to use what technique. As with every best practice there are exceptions to every rule.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defp execute_in_direction(repo, :forward, level, {:create_if_not_exists, %Index{}=index}) do | |
if !repo.adapter.ddl_exists?(repo, index, @opts) do | |
repo.adapter.execute_ddl(repo, {:create, index}, @opts) | |
end | |
end | |
defp execute_in_direction(repo, :backward, level, {:drop_if_exists, %Index{}=index}) do | |
if !repo.adapter.ddl_exists?(repo, index, @opts) do | |
repo.adapter.execute_ddl(repo, {:create, index}, @opts) | |
end |
Database lib/DSL currently targeting PostgreSQL.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Post do | |
def create(%{title: t, body: b, author_id: a} = atts) when is_binary(t) and is_binary(b) and is_binary(a) do | |
{:ok, Dict.merge(atts, :id, 1234)} | |
end | |
def create(_atts) do | |
{:error, %{error: "Invalid attributes"}} | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"app/models/*.js": { | |
"command": "model", | |
"template": [ "export default DS.Model.extend({", "});" ] | |
}, | |
"app/router.js": { "command": "router"}, | |
"app/routes/*.js": { | |
"command": "route", | |
"template": [ "export default Ember.Route.extend({", "});" ], | |
"alternate": "app/controllers/%s.js" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Project@0.0.1 /project_path/ | |
├─┬ browserify@3.19.1 | |
│ ├── assert@1.1.0 | |
│ ├─┬ browser-pack@2.0.1 | |
│ │ ├─┬ combine-source-map@0.3.0 | |
│ │ │ ├── convert-source-map@0.3.3 | |
│ │ │ ├── inline-source-map@0.3.0 | |
│ │ │ └─┬ source-map@0.1.31 | |
│ │ │ └── amdefine@0.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def time | |
start = Time.now | |
yield | |
stop = Time.now | |
stop - start | |
end | |
# Usage: | |
time { method_to_test } |
The web has evolved; has your tech stack?
The evolution of the web has been fueled by hacks, workarounds, and abuses. This evolution has spawned many tools and techniques along the way. This talk will reflect on the web's history and what it means for the web's future. Armed with this knowledge we will examine the functional programming language Elixir and how its philosophy so perfectly fits the future of the web. The technical part of the talk will examine the architecture and code of an example JavaScript (Backbone?) application using websockets for real time communication and collaboration with an Elixir backend.
- Discuss history and future of web:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/mix/tasks/dynamo.ex b/lib/mix/tasks/dynamo.ex [22/1920] | |
index b5a268d..8f41e37 100644 | |
--- a/lib/mix/tasks/dynamo.ex | |
+++ b/lib/mix/tasks/dynamo.ex | |
@@ -40,9 +40,9 @@ defmodule Mix.Tasks.Dynamo do | |
[] -> | |
raise Mix.Error, message: "expected PATH to be given, please use `mix dynamo PATH`" | |
[path|_] -> | |
+ path = validate_path(path) | |
name = opts[:app] || Path.basename(Path.expand(path)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=INFO REPORT==== 16-Feb-2013::23:23:18 === | |
application: pascal | |
exited: {bad_return, | |
{{'Elixir-Pascal',start,[normal,[]]}, | |
{'EXIT', | |
{undef, | |
[{cowboy_router,compile, | |
[[{'_',[{<<"/">>,'Elixir-Pascal-Handler',[]}]}]], | |
[]}, | |
{'Elixir-Pascal',start,2, |