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
<?php | |
/** | |
* Simple excel writer class with no external dependencies, drop it in and have fun | |
* @author Matt Nowack | |
* @link https://gist.github.com/ihumanable/929039/edit | |
* @license Unlicensed | |
* @version 1.0 | |
*/ | |
class Excel { |
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
1 2831 | |
1 1949 | |
1 1871 | |
1 1550 | |
1 1530 | |
1 1451 | |
1 1424 | |
1 1420 | |
1 1409 | |
1 1363 |
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
Superseded by https://github.com/ihumanable/patch |
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 Twilio.Helper do | |
defmodule PhoneNumber do | |
alias Twilio.Helper.{CallerInfo, CarrierInfo} | |
defstruct [:carrier_type, | |
:carrier_name, | |
:country_code, | |
:national_format, | |
:caller_name, | |
:caller_type, |
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 Discord do | |
def send_message(%Message{} = message) do | |
with :ok <- validate_message(message), | |
:ok <- save_message(message) do | |
broadcast_message(message) | |
end | |
end | |
defp validate_message(message) do | |
with :ok <- validate_author_is_member(message), |
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 Discord.Test do | |
use ExUnit.Case | |
describe "send_message/1" do | |
test "errors on invalid messages" do | |
# TODO | |
end | |
test "errors when message can't be durably stored" do | |
# TODO |
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
test "errors on invalid messages" do | |
make_validate_message_return({:error, :bad}) | |
assert {:error, :bad} == Discord.send_message(%Message{}) | |
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 Discord.Test do | |
use ExUnit.Case | |
import Mock | |
describe "send_message/1" do | |
test "errors on invalid messages" do | |
with_mock Discord, [validate_message: fn _ -> {:error, :bad} end] do | |
assert {:error, :bad} == Discord.send_message(%Message{}) | |
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
~/src/discord > mix test | |
1) test send_message/1 errors on invalid messages (Discord.Test) | |
test/discord_test.exs:7 | |
** (ErlangError) Erlang error: {:undefined_function, {Discord, :validate_message, 1}} | |
code: with_mock Discord, [validate_message: fn(_message) -> {:error, :bad} end] do | |
3 tests, 1 failure |
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
~/src/discord > mix test | |
1) test send_message/1 errors on invalid messages (Discord.Test) | |
test/discord_test.exs:7 | |
** (UndefinedFunctionError) function Discord.send_message/1 is undefined | |
(module Discord is not available) | |
code: assert {:error, :bad} == Discord.send_message(%Message{}) | |
3 tests, 1 failure |
OlderNewer