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 Example.Utils.Multi do | |
@doc """ | |
Intertwine multi calls with callbacks to a function to report progress information. | |
""" | |
def add_progress_calls(multi, fun) do | |
operations = multi.operations |> Enum.with_index() | |
size = Enum.count(operations) | |
new_operations = | |
Enum.reduce(operations, [], fn({op, index}, all) -> |
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
Booting Linux on physical CPU 0x0 | |
Linux version 3.16.7-ckt21-9-ev3dev-ev3 (travis@testing-gce-4a64bf49-6596-4092-8f3f-bbd884cce8e4) (gcc version 4.9.3 (crosstool-NG v0.7.1) ) #1 PREEMPT Wed Sep 21 17:01:00 UTC 2016 | |
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=0005317f | |
CPU: VIVT data cache, VIVT instruction cache | |
Machine: LEGO MINDSTORMS EV3 Programmable Brick | |
Memory policy: Data cache writeback | |
DaVinci da850/omap-l138/am18x variant 0x1 | |
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256 | |
Kernel command line: mem=64M console=ttyS1,115200n8 root=/dev/mmcblk0p2 rw rootwait ip=dhcp lpj=747520 | |
PID hash table entries: 256 (order: -2, 1024 bytes) |
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 TTest do | |
use ExUnit.Case | |
defmodule Macro do | |
defmacro @({name, _, args}) do | |
IO.puts("defining #{name} #{inspect args}") | |
end | |
end | |
defmodule Foo do |
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 DecoratorTest do | |
defmacro decorate() do | |
Module.put_attribute(__CALLER__.module, :decorated, :true) | |
end | |
defmacro def(fn_call_ast, fn_opts_ast \\ nil) do | |
mod = __CALLER__.module |
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
[Service] | |
ExecStart= | |
ExecStart=/usr/bin/docker daemon -H fd:// --storage-driver=overlay |
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 Util do | |
def clean_struct(input = %{__struct__: _}) do | |
input | |
|> Map.delete(:__struct__) | |
|> clean_struct | |
end | |
def clean_struct(input = %{}) do | |
input | |
|> Enum.map(fn({k, v}) -> {k, &clean_struct/1} end) | |
|> Enum.into(%{}) |
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
#include <unistd.h> | |
#include <stdio.h> | |
#include <glib.h> | |
#include <string.h> | |
#define nullptr NULL | |
GMainLoop* loop; | |
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
defimpl Poison.Encoder, for: Timex.DateTime do | |
use Timex | |
def encode(d, _options) do | |
fmt = DateFormat.format!(d, "{ISO}") | |
"\"#{fmt}\"" | |
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 GenServer.Interface do | |
defmacro defcall(function, arity) do | |
args = for n <- :lists.seq(1,arity), do: {"arg" <> Integer.to_string(n) |> String.to_atom, [], Elixir} | |
quote do | |
def unquote(function)(server, unquote_splicing(args)) do | |
GenServer.call(server, {unquote(function), unquote_splicing(args)}) | |
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
defimpl Poison.Encoder, for: Timex.DateTime do | |
use Timex | |
def encode(d, _options) do | |
fmt = DateFormat.format!(d, "{ISO}") | |
"\"#{fmt}\"" | |
end | |
end |