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 MyApp.IntegrationCase do | |
use ExUnit.CaseTemplate | |
using do | |
quote do | |
use Hound.Helpers | |
import Ecto | |
import Ecto.Changeset | |
import Ecto.Query |
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 Functions do | |
# switch using `def` or `defp` in compile time | |
defmacro defpt(func, body \\ nil) do | |
case test_env? do | |
true -> quote do: def(unquote(func), unquote(body)) | |
false -> quote do: defp(unquote(func), unquote(body)) | |
end | |
end | |
defp test_env? 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 Znd do | |
@z "ズン" | |
@d "ドコ" | |
@k "キ・ヨ・シ" | |
def kiyoshi, do: [] |> kiy | |
defp kiy(zd) when zd == [@z, @z, @z, @z, @d], do: [zd|[@k]] |> Enum.join | |
defp kiy(zd) when length(zd) > 5, do: tl(zd) |> kiy | |
defp kiy(zd), do: [zd|[Enum.random([@z, @d])]] |> List.flatten |> kiy |
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 Znd do | |
@z "ズン" | |
@d "ドコ" | |
@k "キ・ヨ・シ" | |
def kiyoshi, do: [] |> kiy | |
defp kiy(zd) when zd == [@d, @z, @z, @z, @z], do: [@k|zd] |> Enum.reverse |> Enum.join | |
defp kiy(zd) when length(zd) > 5 do | |
{h, t} = zd |> Enum.split(5) |
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
/* | |
* @param authToken [String] HipChat token you are created. | |
* @param roomId [String] Room id you would like to send notification. | |
* @param message [String] Message string | |
*/ | |
function hipchat(authToken, roomId, message) { | |
var url = 'https://api.hipchat.com/v2/room/' + roomId + '/notification?auth_token=' + authToken; | |
var payload = |