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
[ | |
locals_without_parens: [handle_message: 2, handle_message: 3], | |
import_deps: [:ecto, :phoenix, :cqrs_tools], | |
inputs: ["*.{ex,exs}", "priv/*/seeds.exs", "{config,lib,test}/**/*.{ex,exs}"], | |
subdirectories: ["priv/*/migrations"] | |
] |
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
case class GraphQlRequest(query: String, operation: Option[String], variables: Json) | |
def parseRequest: Directive1[GraphQlRequest] = { | |
import cats.data.Xor | |
import io.circe.ParsingFailure | |
import io.circe.parser.{parse ⇒ parseJson} | |
entity(as[Json]).map { json ⇒ | |
val cursor = json.hcursor | |
val variables = { |
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
defprotocol Ord do | |
@doc """ | |
iex> Ord.compare("a", "b") | |
:EQ | |
iex> Ord.compare("a", "b", type: :alphabetical) | |
:LT | |
""" | |
def compare(a, b, opts \\ []) | |
def lt(a, b) | |
def lte(a, b) |
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
var express = require('express'); | |
var session = require('express-session'); | |
var RedisStore = require('connect-redis')(session); | |
var Strategy = require('./passport-openidconnect/index').Strategy; | |
module.exports.configure = function configure(app, passport) { | |
var identityServer = 'https://users.xxx.com/identity'; | |
var auth = { |
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
package com.company.macros | |
import scala.reflect.macros.blackbox | |
class ADTMacros(val c: blackbox.Context) { | |
import c.universe._ | |
def dynamoFormat[T: c.WeakTypeTag]: Tree = { | |
generate[T] { (tpe, symbols) => |
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
Operating System: macOS | |
CPU Information: Intel(R) Core(TM) i7-6920HQ CPU @ 2.90GHz | |
Number of Available Cores: 8 | |
Available memory: 16 GB | |
Elixir 1.8.1 | |
Erlang 21.2 | |
Benchmark suite executing with the following configuration: | |
warmup: 2 s | |
time: 5 s |
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 Dates do | |
@valid_dates [ | |
Date.utc_today() |> Date.to_iso8601(), | |
NaiveDateTime.utc_now() |> NaiveDateTime.to_iso8601(), | |
DateTime.utc_now() |> DateTime.to_iso8601() | |
] | |
|> Enum.map(&to_string/1) | |
|> Enum.join(" or ") | |
@invalid_date_message "Invalid date. Expected formated date. ie #{@valid_dates}" |
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
import React from 'react'; | |
import Pdf from './Pdf'; | |
import PdfRenderer from './PdfRenderer'; | |
export default () => ( | |
<PdfRenderer | |
fileName="settlements.pdf" | |
buttonClasses="btn btn-secondary view-pdf" | |
extra={1} |
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 Retryable do | |
require Logger | |
@enforce_keys [:mfa] | |
defstruct mfa: nil, | |
retries: 1, | |
should_retry: nil, | |
before_execution: nil |
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 KnightsDialer do | |
@nieghbors_map %{ | |
1 => [6, 8], | |
2 => [7, 9], | |
3 => [4, 8], | |
4 => [3, 9, 0], | |
5 => [], | |
6 => [1, 7, 0], | |
7 => [2, 6], | |
8 => [1, 3], |