To be able to edit code and run cells, you need to run the notebook yourself. Where would you like to run the notebook?

This notebook takes about 20 seconds to run.

In the cloud (experimental)

Binder is a free, open source service that runs scientific notebooks in the cloud! It will take a while, usually 2-7 minutes to get a session.

On your computer

(Recommended if you want to store your changes.)

  1. Copy the notebook URL:
  2. Run Pluto

    (Also see: How to install Julia and Pluto)

  3. Paste URL in the Open box

Frontmatter

If you are publishing this notebook on the web, you can set the parameters below to provide HTML metadata. This is useful for search engines and social media.

Author 1

Tap on every value

👀 Reading hidden code
167 μs
👀 Reading hidden code
@bind x html"<input style='width: 500px' type=range max=10>"
211 ms
👀 Reading hidden code
let
x
@async tap()
end;
❔
/tmp/jl_f1zFu6/vibrate: 1: Syntax error: word unexpected (expecting ")")
6.1 ms

Tap three times

👀 Reading hidden code
167 μs
triple (generic function with 1 method)
👀 Reading hidden code
triple() = for i in 1:3
tap()
sleep(.05)
end
739 μs
Error message

failed process: Process(`/tmp/jl_f1zFu6/vibrate -t 0.02`, ProcessExited(2)) [2]

Stack trace

Here is what happened, the most recent locations are first:

  1. pipeline_error
  2. run(::Cmd; wait::Bool)
  3. run
  4. tap(duration::Float64)
    function tap(duration::Real=0.02)	run(`$(vibrate_path) -t $(string(duration))`)	nothingend
  5. Show more...
Don't panic!
triple()
👀 Reading hidden code
❔
/tmp/jl_f1zFu6/vibrate: 1: Syntax error: word unexpected (expecting ")")
---

Tab on snap

👀 Reading hidden code
165 μs
👀 Reading hidden code
9.9 ms
Error message

Another cell defining yint contains errors.

C'est la vie !
HTML("<input style='width: 500px' type=range max=10 step=.01 value=$(yint) disabled>")
👀 Reading hidden code
---
Error message

Another cell defining yint contains errors.

C'est la vie !
if last_yint[] != yint
@async tap()

last_yint[] = yint
end;
👀 Reading hidden code
---
last_yint = Ref(0)
👀 Reading hidden code
12.6 μs
Error message

MissingException: cannot convert a missing value to type Int64: use Union{Int64, Missing} instead

Stack trace

Here is what happened, the most recent locations are first:

  1. round(::Type{Int64}, ::Missing, ::RoundingMode{:Nearest})
  2. yint = round(Int, y)
this suckz 💣
yint = round(Int, y)
👀 Reading hidden code
---

Appendix

👀 Reading hidden code
165 μs
tap (generic function with 2 methods)
function tap(duration::Real=0.02)
run(`$(vibrate_path) -t $(string(duration))`)
nothing
end
👀 Reading hidden code
868 μs

Getting the binary

👀 Reading hidden code
183 μs
"/tmp/jl_f1zFu6"
dir = mktempdir()
👀 Reading hidden code
123 μs
"/tmp/jl_f1zFu6/bin.zip"
binary_zip_path = download("https://github.com/lapfelix/ForceTouchVibrationCLI/releases/download/1.0/ForceTouchVibrationCLI.zip", joinpath(dir, "bin.zip"))
👀 Reading hidden code
322 ms
Process(`unzip -o /tmp/jl_f1zFu6/bin.zip -d /tmp/jl_f1zFu6`, ProcessExited(0))
unzip_process = run(`unzip -o $(binary_zip_path) -d $(dir)`)
👀 Reading hidden code
❔
Archive:  /tmp/jl_f1zFu6/bin.zip
  inflating: /tmp/jl_f1zFu6/vibrate  
28.0 ms
"/tmp/jl_f1zFu6/vibrate"
vibrate_path = let
unzip_process
joinpath(dir, "vibrate")
end
👀 Reading hidden code
20.7 μs