Skip to content

Instantly share code, notes, and snippets.

View jpsamaroo's full-sized avatar

Julian Samaroo jpsamaroo

View GitHub Profile
@pfitzseb
pfitzseb / TraceCalls.jl
Created December 17, 2018 15:10
TraceCalls.jl with Cassette
module TraceCalls
using Cassette
mutable struct Trace
level::Int
cutoff::Int
end
Cassette.@context TraceCtx
using PlotlyJS
# SVG Path construction
addmove!(io, x, y) = write(io, "M $x $y")
addlineto!(io, x, y) = write(io, " L $x $y")
addclose!(io) = write(io, " Z")
"""
Makes a set of connected lines that go through the points defined by xs and ys
by adding the appropriate SVG commands to the given IO.
@JeffreySarnoff
JeffreySarnoff / dispatchingNamedTuples.jl
Created February 1, 2018 01:52
dispatching with NamedTuples
julia> nt_proto_a_names = (:first, :last)
(:first, :last)
julia> nt_proto_b_names = (:larger, :smaller)
(:larger, :smaller)
julia> nt_proto_a = NamedTuple{nt_proto_a_names}
NamedTuple{(:first, :last),T} where T<:Tuple
julia> nt_proto_b = NamedTuple{nt_proto_b_names}