1) test Aggregate and publish internal temperature base on same minute on receipt (BackendOneTest)
test/backend_one_test.exs:86
No message matching {:test_consumer, %{"type" => "stats", "seller_id" => 42, "payload" => %{"receipt" => %{"date" => receipt_dt, "id" => 666}, "internal_avg_temperature" => 23.0, "external_avg_temperature" => 13.0, "people" => 1}}} after 5000ms.
Process mailbox:
{:test_consumer, %{"payload" => %{"external_avg_temperature" => 13.0, "internal_avg_temperature" => 23.0, "people" => 1, "receipt" => %{"date" => "2016-01-01T15:42:18Z", "id" => 666, "sellerId" => 42}}, "type" => "stats"}}
stacktrace:
test/backend_one_test.exs:111: (test)
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
#include <cppa/cppa.hpp> | |
#include <cppa/optional.hpp> | |
using namespace std; | |
using namespace cppa; | |
using namespace cppa::io; | |
optional<uint16_t> as_u16(const std::string& str) | |
{ | |
return static_cast<uint16_t>(stoul(str)); |
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
#include <iostream> | |
using namespace std; | |
template<class Random> | |
class MyObject | |
{ | |
Random _rand; | |
int _sum; | |
public: |
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
#include "StdAfx.h" | |
#include "GPadAssert.h" | |
template<typename MyRand> | |
class MyRandomObject | |
{ | |
int _sum; | |
MyRand rand; | |
public: | |
MyRandomObject() |
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
require 'net/http' | |
require 'net/https' | |
require 'uri' | |
require 'base64' | |
class HeyWeb | |
BASE_URL = "https://secure.apisms.it/http/" | |
ID_API = 5 | |
REPORT_TYPE = 'P' |
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 QSv1 do | |
def sort([]), do: [] | |
def sort([pivot | rest]) do | |
{smaller, bigger} = Enum.partition(rest, &(&1 < pivot)) | |
sort(smaller) ++ [pivot] ++ sort(bigger) | |
end | |
end | |
defmodule QSv2 do | |
def sort([]), do: [] |
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 Fibonacci do | |
def fib(0), do: 0 | |
def fib(1), do: 1 | |
def fib(n), do: fib(n-1) + fib(n-2) | |
end | |
defmodule Fibonacci.Parallel do | |
def fib(n, processes) do | |
(1..processes) |> Enum.map(fn id -> | |
srv = self() |
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
#--- | |
# Excerpted from "Programming Elixir", | |
# published by The Pragmatic Bookshelf. | |
# Copyrights apply to this code. It may not be used to create training material, | |
# courses, books, articles, and the like. Contact us if you are in doubt. | |
# We make no guarantees that this code is fit for any purpose. | |
# Visit http://www.pragmaticprogrammer.com/titles/elixir for more book information. | |
#--- | |
defmodule FibSolver do |
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 NoSlides.Service do | |
def ping(v\\1) do | |
idx = :riak_core_util.chash_key({"noslides", "ping#{v}"}) | |
pref_list = :riak_core_apl.get_primary_apl(idx, 1, NoSlides.Service) | |
[{index_node, _type}] = pref_list | |
:riak_core_vnode_master.sync_command(index_node, {:ping, v}, NoSlides.VNode_master) | |
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
defmodule GPad do | |
def get_base() do | |
try do | |
get_base(System.get_env("MIX_ENV")) |> Path.join("lib") | |
catch | |
e -> IO.puts("Error: #{inspect(e)}") | |
end | |
end | |
def get_base(nil) do |
OlderNewer