This file contains hidden or 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 Bmgr.Transaction.SearchQuery do | |
import Ecto.Query | |
alias Bmgr.{Transaction} | |
@filters [:account, :status] | |
def build(filter_params) do | |
do_filter(Transaction, @filters, filter_params) | |
end |
This file contains hidden or 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 LookupExample do | |
def lookup(ip) do | |
ip | |
|> Geolix.lookup | |
|> parse_lookup | |
end | |
def parse_lookup(%{city: %{name: city_name}, country: %{iso_code: iso_code}, postal: %{code: postal_code}}) do | |
{city_name, iso_code, postal_code} |
This file contains hidden or 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 Breadpacket do | |
use GenServer | |
def start_link(%{packet_state: state, packet_name: name}) do | |
GenServer.start_link(__MODULE__, state, name: name) | |
end | |
def init(state) do | |
{:ok, state} |
This file contains hidden or 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 Matcher do | |
defmacro match_any?(pattern, collection) do | |
quote do | |
Enum.any?(unquote(collection), fn item -> | |
case item do | |
unquote(pattern) -> true | |
_ -> false | |
end | |
end) | |
end |
This file contains hidden or 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 MyTokenRefresher do | |
use GenServer | |
def start_link(_) do | |
GenServer.start_link(__MODULE__, nil, name: __MODULE__) | |
end | |
def init(_) do | |
async_fetch_token() | |
{:ok, %{token: nil}} |
This file contains hidden or 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
iex(11)> :timer.tc(fn -> Outcomes.run end) | |
Dealer showing 0 partitions = 417334 | |
Dealer showing 1 partitions = 560954 | |
Dealer showing 2 partitions = 658854 | |
Dealer showing 3 partitions = 679464 | |
Dealer showing 4 partitions = 680299 | |
Dealer showing 5 partitions = 680305 | |
Dealer showing 6 partitions = 680305 | |
Dealer showing 7 partitions = 680305 | |
Dealer showing 8 partitions = 680305 |
This file contains hidden or 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
now = DateTime.utc_now() | |
entries = | |
boxes | |
|> Enum.map(fn | |
%_{} = box -> | |
Map.from_struct(box) | |
%{} = attrs -> | |
attrs | |
end) | |
|> Enum.reduce([], fn attrs, acc -> |
This file contains hidden or 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
/data/bin $ cat /data/var/db/pkgin/pkg_install-err.log | |
---Oct 03 15:50:22: installing perl-5.24.1... | |
---Oct 03 15:50:22: installing libpaper-1.1.24... | |
---Oct 03 15:50:23: installing ghostscript-fonts-8.11nb3... | |
---Oct 03 15:50:23: installing expat-2.2.0... | |
---Oct 03 15:50:23: installing ghostscript-gpl-9.06nb8... | |
/bin/chown: changing ownership of '/data/etc/fontconfig': Operation not permitted | |
/bin/chgrp: changing group of '/data/etc/fontconfig': Operation not permitted | |
---Oct 03 15:50:24: installing libxcb-1.12nb1... | |
pkg_add: package `libxcb-1.12nb1' was already installed as dependency, now marked as installed manually |
This file contains hidden or 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
root@turfbytes-dgraph-01:~# dgraph --bindall | |
Dgraph version : v0.8.0 | |
Commit SHA-1 : 7c419b3f | |
Commit timestamp : 2017-07-21 14:13:34 +1000 | |
Branch : HEAD | |
2017/07/23 11:21:53 read p/000003.sst: invalid argument | |
github.com/dgraph-io/badger/y.Wrap |
This file contains hidden or 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
export interface FormFieldParams { | |
form: any | |
field: string | |
} | |
const applySetterAndGetter = <T extends Function>(component: T, params: FormFieldParams): T => { | |
let options = { | |
get: () => { | |
return params.form.payload()[params.field] |