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 Test do | |
defmacro __using__(opts) do | |
quote do | |
import unquote(__MODULE__), only: [map_test: 0] | |
end | |
end | |
#works as expected | |
defmacro map_test do | |
bar = [foo: "bar"] |
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 Messages.Time do | |
use Timex | |
@spec timestamp() :: Timex.DateTime.t | |
def timestamp, do: Timex.DateTime.now(:utc) | |
@type ts :: Timex.Convertable.t | none | |
@spec timestamp_iso8601(ts) :: binary | |
def timestamp_iso8601(ts \\ __MODULE__.timestamp) do | |
{:ok, iso8601} = Timex.format(ts, "{ISO:Extended}") |
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 Messages.Time do | |
use Timex | |
alias Timex.DateTime | |
@spec timestamp() :: DateTime.t | |
def timestamp, do: DateTime.now(:utc) | |
@spec timestamp_iso8601() :: String.t | |
@dialyzer {:nowarn_function, timestamp_iso8601: 0} | |
def timestamp_iso8601 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
# Move around the buffer in vim style | |
setw -g mode-keys vi | |
# Shortcuts | |
bind r source-file ~/.tmux.conf\; display "Reloaded!" #reload configuration | |
bind | split-window -h -c '#{pane_current_path}' #split window horizontally | |
bind - split-window -v -c '#{pane_current_path}' #split window vertically | |
bind h select-pane -L #vim style pane navigation | |
bind j select-pane -D #vim style pane navigation | |
bind k select-pane -U #vim style pane navigation |
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
@meta_info_version 1 | |
@meta_info_tag 0xcabd | |
@meta_info_device_number 0 | |
@compression_method 0 | |
def pack_info(sequence) do | |
<<@meta_info_tag::big-integer-unsigned-size(16), | |
@compression_method::big-integer-unsigned-size(8), | |
@meta_info_version::integer-unsigned-size(8), | |
@meta_info_device_number::big-integer-unsigned-size(32), | |
zclock_time::big-integer-unsigned-size(64), |
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
val routes = | |
(post & path("graphql")) { | |
optionalHeaderValueByName("ACCEPT_LANGUAGE") { accept_language => | |
entity(as[JsValue]) { requestJson => | |
val context = Context.from(accept_language) | |
println("ACCEPT_LANGUAGE: " + context.language) | |
graphQLEndpoint(requestJson, context) | |
} | |
} | |
} ~ |
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
object ProfileRef { | |
val inactiveDefinition = ObjectType( | |
"InactiveProfileRef", | |
"An inactive profile", | |
fields = fields[UserContext, JsObject]( | |
Field("id", IntType, None, resolve = ctx => (ctx.value \ "id").as[Int]) | |
) | |
) | |
val activeDefinition = ObjectType( |
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
fragment profileFragment on ProfileRef { | |
__typename | |
... on ActiveProfileRef { | |
id | |
firstName | |
lastName | |
} | |
... on InactiveProfileRef { |
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
object Address extends ApiDSL { | |
val t = ApiObjectType( | |
"Address", | |
"A standard container for representing an address", | |
interfaces(Addressable.t), | |
fields( | |
optionalApiField("city", StringType), | |
optionalApiField("province", StringType), | |
optionalApiField("street", StringType), | |
optionalApiField("zip", StringType), |
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
[error] sangria.parser.SyntaxError: Syntax error while parsing GraphQL query. Invalid input ""/test") {\n}", expected ValueConst, ArgumentConst, DirectiveConst or InputValueDefinition (line 7, column 32): | |
[error] input MyResolver @httpGet(url: "/test") { | |
[error] ^ (QueryParser.scala:433) |
OlderNewer