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
// file: components/biz-card/biz-card.mjs | |
import { patchContentMap } from '../../helpers/templateLoader.mjs' | |
/* | |
#1: | |
See patchContentMap call below which creates | |
static get _contentMap | |
static set _templateUri | |
#2: |
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
<html> | |
<head> | |
<!-- | |
file: index.html | |
https://livebook.manning.com/#!/book/web-components-in-action/chapter-5/v-6/comment-487548 | |
https://github.com/bengfarrell/webcomponentsinaction | |
--> | |
<title>Web Harp</title> | |
<link href="./main.css" type="text/css" rel="stylesheet"> | |
<link href="./csshake.min.css" type="text/css" rel="stylesheet"> |
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
<html lang="en"> | |
<!-- file: index.html --> | |
<head> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Chapter 2: Your First Web Component</title> | |
<style> | |
my-custom-tag { | |
background-color: blue; | |
padding: 20px; | |
display: inline-block; |
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
# file: code_lock.ex | |
# Translated from: http://erlang.org/doc/design_principles/statem.html#example-revisited | |
# callback mode: :handle_event_function | |
# | |
defmodule CodeLock do | |
@behaviour :gen_statem | |
@name :code_lock_2 | |
def start_link(code), | |
do: :gen_statem.start_link({:local, @name}, __MODULE__, 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
# file: code_lock.ex | |
# Translated from: http://erlang.org/doc/design_principles/statem.html#example-revisited | |
# callback mode: :state_functions | |
# | |
defmodule CodeLockCommon do | |
# Admittedly gratuitous use of a macro | |
# | |
def handle_event(:cast, {:down, button}, data) do | |
{:keep_state, Map.put(data, :button, button)} | |
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 FromPipe do | |
# | |
# NOTE: this use of ports is based on UNDOCUMENTED functionality | |
# of the open_port/2 function - i.e. could stop working | |
# in any future release | |
# http://erlang.org/doc/man/erlang.html#open_port-2 | |
# | |
# See also: | |
# Erlang and Named Pipes | |
# https://gist.github.com/jaredmorrow/1c342c6e9156eddd20b2 |
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 FromPipe do | |
# | |
# Use a helper script "from_pipe_release" to | |
# release/request each line read from the | |
# named pipe - effectively implementing a | |
# crude backpressure mechanism | |
# | |
@pipe_name "/tmp/testpipe" | |
@from_pipe_release "./from_pipe_release" | |
@from_pipe_clean "./from_pipe_clean" |
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 FromPipe do | |
# | |
# Use a helper script "from_pipe_forward" to communicate | |
# contents from the named pipe to the port | |
# | |
@pipe_name "/tmp/testpipe" | |
@from_pipe_forward "./from_pipe_forward" | |
@from_pipe_clean "./from_pipe_clean" | |
# * terminate potential zombie OS process |