task = Task.async(fn -> do_some_work() end)
res = do_some_other_work()
res + Task.await(task)
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
iex(bark@argo)3> command "mirror me", &(String.reverse(&1)) | |
** (exit) exited in: :gen_server.call({:global, Commands}, {:update, #Function<0.20429546/1 in Commands.add/1>}, 5000) | |
** (EXIT) an exception was raised: | |
** (BadFunctionError) expected a function, got: #Function<0.20429546/1 in Commands.add/1> | |
(elixir) lib/agent/server.ex:20: Agent.Server.handle_call/3 | |
(stdlib) gen_server.erl:580: :gen_server.handle_msg/5 | |
(stdlib) proc_lib.erl:239: :proc_lib.init_p_do_apply/3 | |
(stdlib) gen_server.erl:190: :gen_server.call/3 |
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
iex(4)> foo = "test" | |
"test" | |
iex(5)> invoker = Regex.compile("insert var here #(foo)") | |
** (ArgumentError) Got FunctionClauseError with message "no function clause matching in Inspect.Regex.__impl__/1" while inspecting %{__struct__: Regex, opts: "", | |
re_pattern: {:re_pattern, 1, 0, 0, | |
<<69, 82, 67, 80, 119, 0, 0, 0, 0, 0, 0, 0, 81, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 105, 0, 111, 0, 0, 0, 1, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...>>}, | |
source: "insert var here #(foo)"} | |
** (IEx.Error) error when printing EXIT message: :function_clause | |
=ERROR REPORT==== 1-Jun-2014::11:24:04 === |
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
> l = require('lodash'); | |
> cloneFoo = l.clone(foo) | |
{ one: 1, two: 2 } | |
> delete cloneFoo['one'] | |
true | |
> cloneFoo | |
{ two: 2 } | |
> foo | |
{ one: 1, two: 2 } | |
> var changer = function(d) { |
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
iex(5)> Code.require_file('spoonbot.exs') | |
** (FunctionClauseError) no function clause matching in Code.require_file/2 | |
(elixir) lib/code.ex:287: Code.require_file('spoonbot.exs', nil) | |
iex(5)> Code.require_file('spoonbot.exs', '.') | |
** (FunctionClauseError) no function clause matching in Code.require_file/2 | |
(elixir) lib/code.ex:287: Code.require_file('spoonbot.exs', '.') | |
iex(5)> System.cmd('ls . | grep spoonbot.exs') | |
'spoonbot.exs\n' | |
iex(6)> |
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
iex(8)> defmodule T2 do | |
...(8)> defstruct name: fn -> IO.puts 'hello' end | |
...(8)> end | |
** (CompileError) iex: invalid quoted expression: #Function<0.93347699 in file:iex> | |
(elixir) src/elixir_exp.erl:414: :elixir_exp.expand_arg/2 | |
(stdlib) lists.erl:1352: :lists.mapfoldl/3 | |
(stdlib) lists.erl:1353: :lists.mapfoldl/3 | |
(elixir) src/elixir_exp.erl:420: :elixir_exp.expand_args/2 | |
(elixir) src/elixir_exp.erl:357: :elixir_exp.expand/2 | |
(elixir) src/elixir_exp.erl:414: :elixir_exp.expand_arg/2 |
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 deps do | |
[ { :cowboy, github: "extend/cowboy" }, | |
{ :plug, "~> 0.4.3", github: "elixir-lang/plug" } ] | |
end | |
♪ spoonbot git:(master) ✗ mix deps.get | |
* Getting plug (git://github.com/elixir-lang/plug.git) | |
Cloning into '/Users/nicholasf/code/nicholasf/spoonbot/deps/plug'... | |
remote: Reusing existing pack: 1303, done. | |
remote: Counting objects: 10, done. |
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
{ id: '/Users/nicholasf/code/news/tcog/lib/opsgenie.js', | |
exports: [Function], | |
parent: | |
{ id: 'repl', | |
exports: | |
{ writer: [Object], | |
_builtinLibs: [Object], | |
REPLServer: [Object], | |
start: [Function], | |
repl: [Object] }, |
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
It was a clear day, before the rain would come, and it was though a lake, from a pale morning, had been inverted upon the sky. | |
One, two, three, four. I must sleep. There is a road, and on it the people, hundreds of them, walking through the afternoon and the evening until it is night. One, two, three … | |
Beneath this, down a hill, ran a road of houses. It was an ochre mid-afternoon, in April, and a man without purpose wandered down it, staring at what was before him but only seeing a field of wheat in the summer, beyond which were further hills of wheat, and the sun above them, suspended in the crystal silence of trapped memory or light. | |
The sky fell into an ocean, which ran darkly into Port Philip, and spilled out to become the nighttime circle of the city’s map; from above it was cold and the lights of the houses were pinpricks in the darkness. | |
Huddled upon a pedestrian seat, by one of the bays, beneath a palm tree, was a figure, sexless, its arms wrapped about itself, shuddering. It thought nothing, but |
handler.finders.push('person', function(args){ //db specific logic to find person });
handler.finders.push('house', function(args){ //db specific logic to find house });
Person.find( { id: n, with: ['House'] }); //this would forward to the person finder above unless ...
handler.finders.push('person_with_house', function(args) {
console.log(args);
});