Skip to content

Instantly share code, notes, and snippets.

View joshday's full-sized avatar

Josh Day joshday

View GitHub Profile
@joshday
joshday / what.jl
Created October 19, 2023 13:24
Weird behavior with getproperty
julia> struct Wrapper
dict::Dict{Symbol, Any}
end
julia> Base.getproperty(w::Wrapper, k::Symbol) = get!(getfield(w, :dict), k, Wrapper(Dict{Symbol,Any}()))
julia> Base.setproperty!(w::Wrapper, k::Symbol, val) = setindex!(getfield(w, :dict), val, k)
julia> w = Wrapper(Dict())
Wrapper(Dict{Symbol, Any}())
@joshday
joshday / offline_pluto.jl
Last active June 21, 2021 02:04
Modify Pluto.jl to run offline on the first run
# Edit Pluto (in place!) to run in an air-gapped environment
# Editing a package after it's installed is bad. But hey, this works.
# Before running this script, you can instantiate a new depot to avoid
# contaminating your main depot. Something like:
#
# push!(empty!(DEPOT_PATH), "my/new/depot/path")
# using Pkg
# Pkg.activate("my/project/path")
# Pkg.instantiate()
@joshday
joshday / iris.csv
Last active February 24, 2020 21:13
sepal_length sepal_width petal_length petal_width variety
5.1 3.5 1.4 .2 Setosa
4.9 3 1.4 .2 Setosa
4.7 3.2 1.3 .2 Setosa
4.6 3.1 1.5 .2 Setosa
5 3.6 1.4 .2 Setosa
5.4 3.9 1.7 .4 Setosa
4.6 3.4 1.4 .3 Setosa
5 3.4 1.5 .2 Setosa
4.4 2.9 1.4 .2 Setosa