This file contains 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 | |
Web Components in Action MEAP v6 | |
https://livebook.manning.com/#!/book/web-components-in-action/chapter-7/v-6/comment-487676 | |
original: https://github.com/bengfarrell/webcomponentsinaction/blob/master/chapter7/7.5-slotsandtemplates/unnamedslots.html | |
#1: | |
prevent undefined custom element FOUC (flash of unstyled content) |
This file contains 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 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 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 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 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 |
This file contains 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 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: src/ServerEvents.js | |
Previous: | |
- part 3: https://gist.github.com/peerreynders/d59d37dd47016a932ee9c786e3817560 | |
- part 2: https://gist.github.com/peerreynders/a0965c47cce31fb6a6677b90f0ca71cc | |
- part 1: https://gist.github.com/peerreynders/474145762df0708fe78bf39b548fab00 | |
see also: https://gist.github.com/peerreynders/412911579e4a0c485f67a122634cffe2 |