- Add module documentation to redpull and generate the html files
- Add function documentation to redpull and generate the updated html files
@doc """
| def magic(nbr) do | |
| a = ~x(a1b2c3d4) | |
| b = ~x(d4c3b2a1) | |
| c = ~x(a1b23c4d) | |
| d = ~x(4d3cb2a1) | |
| case nbr do | |
| ^a -> %Pcap.Global.MagicNumber{ magic_number: nbr, swap_fields: false, nanoseconds: false } | |
| ^b -> %Pcap.Global.MagicNumber{ magic_number: nbr, swap_fields: true, nanoseconds: false } | |
| ^c -> %Pcap.Global.MagicNumber{ magic_number: nbr, swap_fields: false, nanoseconds: true } | |
| ^d -> %Pcap.Global.MagicNumber{ magic_number: nbr, swap_fields: true, nanoseconds: true } |
| # this is using sweet_xml | |
| xml_string = File.read!("some_file.xml") | |
| try do | |
| Logger.info(self()) # it does not work without this ... wat? | |
| {:ok, xml} = Parser.parse(xml_string) | |
| process_xml(conn, xml_string, xml) | |
| rescue | |
| e -> | |
| Logger.info("ignoring unparseable XML file: #{inspect xml_string}") | |
| render(conn, "empty.json") |
| defmodule WhatHappensIn_1_3 do | |
| def some_func() do | |
| receive do | |
| {from, message} -> | |
| send from, "hello #{inspect message}" | |
| some_func() | |
| _ -> | |
| IO.puts "quittin' time" | |
| end |
| # 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 |
| characters = [ | |
| %{name: "Han", type: :human, rebel: true, weight: 185}, | |
| %{name: "Jabba", type: :hutt, rebel: false, weight: 2200}, | |
| %{name: "Chewie", type: :wookie, rebel: true, weight: 350}, | |
| %{name: "r2d2", type: :droid, rebel: true, weight: 250}, | |
| %{name: "Luke", type: :human, rebel: true, weight: 140}, | |
| %{name: "Boba Fett", type: :human, rebel: false, weight: 175}, | |
| ] | |
| # Note that there is more than one correct answer for all of these! |
| # Use this code and data to answer the questions. | |
| defmodule Millenium.Falcon do | |
| def rebel?(c = %{rebel: true}) do | |
| c.type != :droid | |
| end | |
| def rebel?(_), do: false | |
| def fill_ship(characters) do |
| def ex2(characters, type), do: ex2h(characters, type, []) | |
| def ex2h([head = %{type: type} | tail], type, result) do | |
| ex2h(tail, type, [head | result]) | |
| end | |
| def ex2h([head | tail], type, result), do: ex2h(tail, type, result) | |
| def ex2h([], _type, result), do: Enum.reverse(result) |
| defmodule JavaClassVersion do | |
| def read_class_file(file) do | |
| file | |
| |> File.read!() | |
| |> java_major_minor() | |
| |> java_version() | |
| |> IO.inspect() | |
| end |