- Where are the meetups?
- What is the closest meetup to {City}?
- When is the next meetup in {City}?
- What are the upcoming conferences?
- What training is available?
defmodule Benum do | |
defimpl Enumerable, for: BitString do | |
def count(collection) when is_binary(collection) do | |
{:ok, Enum.reduce(collection, 0, fn v, acc -> acc + 1 end)} | |
end | |
def count(collection) do | |
{:error, __MODULE__} | |
end | |
def member?(collection, value) when is_binary(collection) do | |
{:ok, Enum.any?(collection, fn v -> value == v end)} |
defmodule Permutations do | |
@moduledoc """ | |
An answer to the problem from: http://www.theguardian.com/science/alexs-adventures-in-numberland/2015/may/20/can-you-do-the-maths-puzzle-for-vietnamese-eight-year-olds-that-has-stumped-parents-and-teachers | |
iex> Permutations.main parallel: false | |
iex> Permutations.main parallel: true | |
""" |
# Create a variable has_seen_star_wars and set it to true. | |
has_seen_star_wars = true | |
# Write code that prints "Ready for class" if you have seen at least one Star Wars movie (has_seen_star_wars). | |
if has_seen_star_wars do | |
IO.puts "Ready for class" | |
end | |
# Flip has_seen_star_wars to false. | |
has_seen_star_wars = false |
defmodule Foo do | |
def something() do | |
IO.puts "Foo in here" | |
end | |
end | |
Foo.something() | |
~/C/C/I/i/i/slacker (master ⚡=) > mix compile | |
Could not start Hex. Try fetching a new version with "mix local.hex" or uninstalling it with "mix archive.uninstall hex.ez" | |
** (MatchError) no match of right hand side value: {:error, {:ssl, {'no such file or directory', 'ssl.app'}}} | |
(hex) lib/hex.ex:5: Hex.start/0 | |
(mix) lib/mix/hex.ex:53: Mix.Hex.start/0 | |
(mix) lib/mix/dep/loader.ex:144: Mix.Dep.Loader.with_scm_and_app/4 | |
(mix) lib/mix/dep/loader.ex:99: Mix.Dep.Loader.to_dep/3 | |
(elixir) lib/enum.ex:1184: Enum."-map/2-lists^map/1-0-"/2 | |
(mix) lib/mix/dep/loader.ex:299: Mix.Dep.Loader.mix_children/1 | |
(mix) lib/mix/dep/loader.ex:18: Mix.Dep.Loader.children/0 |
defmodule Cats do | |
@base_dir "cats" | |
def run() do | |
process_type = :link # :monitor | |
pid = start(process_type) |> IO.inspect | |
IO.puts "time to send Thomas #{inspect pid}" | |
send pid, {self, "Michigan", "Thomas"} | |
pid = receive do |
defmodule Cats do | |
@base_dir "cats" | |
def run() do | |
pid = start() | |
send pid, {self, "Virginia", "Felix"} | |
receive do | |
resp -> IO.puts "Virginia/Felix: #{inspect resp}" | |
after 5000 -> |
defmodule Macros do | |
defmacro or_default(expr, default) do | |
quote do | |
try do | |
unquote(expr) | |
rescue | |
e -> | |
unquote(default) | |
end | |
end |
defmodule JavaClassVersion do | |
def read_class_file(file) do | |
file | |
|> File.read!() | |
|> java_major_minor() | |
|> java_version() | |
|> IO.inspect() | |
end |